You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-commits@lucene.apache.org by yo...@apache.org on 2006/05/21 03:01:43 UTC

svn commit: r408114 - in /lucene/java/trunk: CHANGES.txt src/java/org/apache/lucene/store/RAMDirectory.java

Author: yonik
Date: Sat May 20 18:01:42 2006
New Revision: 408114

URL: http://svn.apache.org/viewvc?rev=408114&view=rev
Log:
fix RAMDirectory(Directory) 2GB size limitation: LUCENE-546

Modified:
    lucene/java/trunk/CHANGES.txt
    lucene/java/trunk/src/java/org/apache/lucene/store/RAMDirectory.java

Modified: lucene/java/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/java/trunk/CHANGES.txt?rev=408114&r1=408113&r2=408114&view=diff
==============================================================================
--- lucene/java/trunk/CHANGES.txt (original)
+++ lucene/java/trunk/CHANGES.txt Sat May 20 18:01:42 2006
@@ -69,6 +69,9 @@
 14. LUCENE-556: Added empty extractTerms() implementation to MatchAllDocsQuery and
     ConstantScoreQuery in order to allow their use with a MultiSearcher.
     (Yonik Seeley)
+
+15. LUCENE-546: Creating a RAMDirectory from a Directory truncated files over 2GB.
+    (Peter Royal via Yonik Seeley)
     
 1.9.1
 

Modified: lucene/java/trunk/src/java/org/apache/lucene/store/RAMDirectory.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/java/org/apache/lucene/store/RAMDirectory.java?rev=408114&r1=408113&r2=408114&view=diff
==============================================================================
--- lucene/java/trunk/src/java/org/apache/lucene/store/RAMDirectory.java (original)
+++ lucene/java/trunk/src/java/org/apache/lucene/store/RAMDirectory.java Sat May 20 18:01:42 2006
@@ -60,10 +60,10 @@
       // read current file
       IndexInput is = dir.openInput(files[i]);
       // and copy to ram disk
-      int len = (int) is.length();
-      int readCount = 0;
+      long len = is.length();
+      long readCount = 0;
       while (readCount < len) {
-        int toRead = readCount + BufferedIndexOutput.BUFFER_SIZE > len ? len - readCount : BufferedIndexOutput.BUFFER_SIZE;
+        int toRead = readCount + BufferedIndexOutput.BUFFER_SIZE > len ? (int)(len - readCount) : BufferedIndexOutput.BUFFER_SIZE;
         is.readBytes(buf, 0, toRead);
         os.writeBytes(buf, toRead);
         readCount += toRead;