svn commit: r462661 - in /xml/xindice/trunk: java/src/org/apache/xindice/core/filer/Paged.java status.xml

[email protected]
Newsgroups gmane.text.xml.xindice.devel
Message-ID <[email protected]>
Author: vgritsenko
Date: Tue Oct 10 18:59:54 2006
New Revision: 462661

URL: http://svn.apache.org/viewvc?view=rev&rev=462661
Log:
            <action dev="VG" type="fix" fixes-bug="31159">
                Data files were created 6Mb in size instead of 4Mb (default value).
            </action>


Modified:
    xml/xindice/trunk/java/src/org/apache/xindice/core/filer/Paged.java
    xml/xindice/trunk/status.xml

Modified: xml/xindice/trunk/java/src/org/apache/xindice/core/filer/Paged.java
URL: http://svn.apache.org/viewvc/xml/xindice/trunk/java/src/org/apache/xindice/core/filer/Paged.java?view=diff&rev=462661&r1=462660&r2=462661
==============================================================================
--- xml/xindice/trunk/java/src/org/apache/xindice/core/filer/Paged.java (original)
+++ xml/xindice/trunk/java/src/org/apache/xindice/core/filer/Paged.java Tue Oct 10 18:59:54 2006
@@ -571,8 +571,8 @@
                                                       fileHeader.getPageSize()));
         fileHeader.setMaxKeySize(config.getShortAttribute(CONFIG_KEYSIZE_MAX,
                                                           fileHeader.getMaxKeySize()));
-
         try {
+            createFile();
             fileHeader.write();
             flush();
             return true;
@@ -582,6 +582,18 @@
         }
     }
 
+    private void createFile() throws IOException {
+        RandomAccessFile raf = null;
+        try {
+            raf = getDescriptor();
+            long o = fileHeader.headerSize + (fileHeader.totalCount + 1) * fileHeader.pageSize - 1;
+            raf.seek(o);
+            raf.write(0);
+        }  finally {
+            putDescriptor(raf);
+        }
+    }
+
     public synchronized boolean open() throws DBException {
         RandomAccessFile raf = null;
         try {
@@ -1333,7 +1345,7 @@
                 raf = getDescriptor();
                 if (this.offset >= raf.length()) {
                     // Grow the file
-                    long o = (fileHeader.headerSize + ((fileHeader.totalCount * 3) / 2) * fileHeader.pageSize) + (fileHeader.pageSize - 1);
+                    long o = fileHeader.headerSize + (fileHeader.totalCount * 3 / 2 + 1) * fileHeader.pageSize - 1;
                     raf.seek(o);
                     raf.writeByte(0);
                 }

Modified: xml/xindice/trunk/status.xml
URL: http://svn.apache.org/viewvc/xml/xindice/trunk/status.xml?view=diff&rev=462661&r1=462660&r2=462661
==============================================================================
--- xml/xindice/trunk/status.xml (original)
+++ xml/xindice/trunk/status.xml Tue Oct 10 18:59:54 2006
@@ -73,7 +73,10 @@
     </todo>
 
     <changes>
-        <release version="1.1b5-dev" date="Dec 15 2005">
+        <release version="1.1b5-dev" date="Oct 10 2006">
+            <action dev="VG" type="fix" fixes-bug="31159">
+                Data files were created 6Mb in size instead of 4Mb (default value).
+            </action>
             <action dev="VG" type="fix" fixes-bug="37383" due-to="Terry Rosenbaum">
                 Fix ClassCastException in MemValueIndexer.
             </action>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.