You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by rm...@apache.org on 2011/11/06 13:30:30 UTC
svn commit: r1198350 [1/2] - in /lucene/dev/branches/lucene2621: ./
dev-tools/idea/.idea/ dev-tools/idea/lucene/contrib/
dev-tools/idea/solr/contrib/langid/ dev-tools/maven/lucene/contrib/misc/
dev-tools/maven/lucene/contrib/spatial/ dev-tools/maven/lu...
Author: rmuir
Date: Sun Nov 6 12:30:27 2011
New Revision: 1198350
URL: http://svn.apache.org/viewvc?rev=1198350&view=rev
Log:
LUCENE-3490: merge trunk (1197605:1198349)
Added:
lucene/dev/branches/lucene2621/lucene/src/test/org/apache/lucene/index/TestIndexWriterNRTIsCurrent.java
- copied unchanged from r1198349, lucene/dev/trunk/lucene/src/test/org/apache/lucene/index/TestIndexWriterNRTIsCurrent.java
lucene/dev/branches/lucene2621/solr/core/src/test/org/apache/solr/search/TestValueSourceCache.java
- copied unchanged from r1198349, lucene/dev/trunk/solr/core/src/test/org/apache/solr/search/TestValueSourceCache.java
Modified:
lucene/dev/branches/lucene2621/ (props changed)
lucene/dev/branches/lucene2621/dev-tools/idea/.idea/compiler.xml
lucene/dev/branches/lucene2621/dev-tools/idea/lucene/contrib/ (props changed)
lucene/dev/branches/lucene2621/dev-tools/idea/solr/contrib/langid/langid.iml
lucene/dev/branches/lucene2621/dev-tools/maven/lucene/contrib/misc/pom.xml.template
lucene/dev/branches/lucene2621/dev-tools/maven/lucene/contrib/spatial/pom.xml.template
lucene/dev/branches/lucene2621/dev-tools/maven/lucene/src/pom.xml.template
lucene/dev/branches/lucene2621/dev-tools/maven/lucene/src/test-framework/pom.xml.template
lucene/dev/branches/lucene2621/lucene/ (props changed)
lucene/dev/branches/lucene2621/lucene/BUILD.txt
lucene/dev/branches/lucene2621/lucene/CHANGES.txt
lucene/dev/branches/lucene2621/lucene/build.xml
lucene/dev/branches/lucene2621/lucene/common-build.xml
lucene/dev/branches/lucene2621/lucene/contrib/misc/src/java/org/apache/lucene/store/DirectIOLinuxDirectory.java
lucene/dev/branches/lucene2621/lucene/contrib/misc/src/java/org/apache/lucene/store/WindowsDirectory.java
lucene/dev/branches/lucene2621/lucene/contrib/sandbox/src/test/org/apache/lucene/sandbox/queries/regex/TestSpanRegexQuery.java (props changed)
lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/index/DocumentsWriter.java
lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/index/FieldInfos.java
lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/index/IndexFormatTooNewException.java
lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/index/IndexFormatTooOldException.java
lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/index/IndexWriter.java
lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/index/PrefixCodedTerms.java
lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/index/SegmentInfos.java
lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/index/TermVectorsReader.java
lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/index/codecs/DefaultFieldsReader.java
lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/index/codecs/DefaultSegmentInfosReader.java
lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/index/codecs/MultiLevelSkipListReader.java
lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/index/codecs/lucene3x/SegmentTermEnum.java
lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/index/codecs/lucene3x/TermInfosReaderIndex.java (props changed)
lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/index/codecs/lucene40/Lucene40PostingsWriter.java
lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/index/codecs/sep/SepPostingsWriter.java
lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/search/CollectionStatistics.java
lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/search/TermStatistics.java
lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/store/BufferedIndexInput.java
lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/store/ChecksumIndexInput.java
lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/store/CompoundFileDirectory.java
lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/store/Directory.java
lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/store/IndexInput.java
lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/store/MMapDirectory.java
lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/store/NIOFSDirectory.java
lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/store/RAMDirectory.java
lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/store/RAMInputStream.java
lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/store/SimpleFSDirectory.java
lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/util/CodecUtil.java
lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/util/PagedBytes.java
lucene/dev/branches/lucene2621/lucene/src/test-framework/java/org/apache/lucene/index/MockIndexInput.java
lucene/dev/branches/lucene2621/lucene/src/test-framework/java/org/apache/lucene/store/MockDirectoryWrapper.java
lucene/dev/branches/lucene2621/lucene/src/test-framework/java/org/apache/lucene/store/MockIndexInputWrapper.java
lucene/dev/branches/lucene2621/lucene/src/test/org/apache/lucene/index/TestBackwardsCompatibility.java
lucene/dev/branches/lucene2621/lucene/src/test/org/apache/lucene/index/TestFieldsReader.java
lucene/dev/branches/lucene2621/lucene/src/test/org/apache/lucene/index/TestIndexWriterReader.java
lucene/dev/branches/lucene2621/lucene/src/test/org/apache/lucene/index/TestLazyProxSkipping.java
lucene/dev/branches/lucene2621/lucene/src/test/org/apache/lucene/index/TestMultiLevelSkipList.java
lucene/dev/branches/lucene2621/lucene/src/test/org/apache/lucene/store/TestBufferedIndexInput.java
lucene/dev/branches/lucene2621/lucene/src/test/org/apache/lucene/store/TestHugeRamFile.java
lucene/dev/branches/lucene2621/lucene/src/test/org/apache/lucene/util/TestPagedBytes.java
lucene/dev/branches/lucene2621/modules/facet/src/test/org/apache/lucene/util/SlowRAMDirectory.java
lucene/dev/branches/lucene2621/modules/queries/src/java/org/apache/lucene/queries/function/valuesource/NumericFieldCacheSource.java
lucene/dev/branches/lucene2621/modules/queryparser/src/test/org/apache/lucene/queryparser/xml/builders/TestNumericRangeFilterBuilder.java (props changed)
lucene/dev/branches/lucene2621/solr/ (props changed)
lucene/dev/branches/lucene2621/solr/CHANGES.txt (contents, props changed)
lucene/dev/branches/lucene2621/solr/LICENSE.txt (props changed)
lucene/dev/branches/lucene2621/solr/NOTICE.txt (props changed)
lucene/dev/branches/lucene2621/solr/README.txt (props changed)
lucene/dev/branches/lucene2621/solr/build.xml (props changed)
lucene/dev/branches/lucene2621/solr/client/ (props changed)
lucene/dev/branches/lucene2621/solr/common-build.xml (props changed)
lucene/dev/branches/lucene2621/solr/contrib/ (props changed)
lucene/dev/branches/lucene2621/solr/contrib/clustering/src/test-files/ (props changed)
lucene/dev/branches/lucene2621/solr/contrib/dataimporthandler-extras/src/java/ (props changed)
lucene/dev/branches/lucene2621/solr/contrib/dataimporthandler/CHANGES.txt
lucene/dev/branches/lucene2621/solr/contrib/dataimporthandler/src/java/ (props changed)
lucene/dev/branches/lucene2621/solr/contrib/dataimporthandler/src/test-files/ (props changed)
lucene/dev/branches/lucene2621/solr/contrib/dataimporthandler/src/test/org/ (props changed)
lucene/dev/branches/lucene2621/solr/contrib/uima/src/java/ (props changed)
lucene/dev/branches/lucene2621/solr/contrib/uima/src/test-files/ (props changed)
lucene/dev/branches/lucene2621/solr/core/ (props changed)
lucene/dev/branches/lucene2621/solr/core/src/java/ (props changed)
lucene/dev/branches/lucene2621/solr/core/src/java/org/apache/solr/handler/admin/ShowFileRequestHandler.java
lucene/dev/branches/lucene2621/solr/core/src/java/org/apache/solr/schema/LatLonType.java
lucene/dev/branches/lucene2621/solr/core/src/test/ (props changed)
lucene/dev/branches/lucene2621/solr/core/src/test-files/solr/conf/schema.xml
lucene/dev/branches/lucene2621/solr/core/src/test/org/apache/solr/search/SpatialFilterTest.java
lucene/dev/branches/lucene2621/solr/dev-tools/ (props changed)
lucene/dev/branches/lucene2621/solr/example/ (props changed)
lucene/dev/branches/lucene2621/solr/example/example-DIH/solr/tika/conf/tika-data-config.xml
lucene/dev/branches/lucene2621/solr/lib/ (props changed)
lucene/dev/branches/lucene2621/solr/scripts/ (props changed)
lucene/dev/branches/lucene2621/solr/site/ (props changed)
lucene/dev/branches/lucene2621/solr/site-src/ (props changed)
lucene/dev/branches/lucene2621/solr/solrj/ (props changed)
lucene/dev/branches/lucene2621/solr/solrj/src/java/ (props changed)
lucene/dev/branches/lucene2621/solr/solrj/src/test/org/apache/solr/client/ (props changed)
lucene/dev/branches/lucene2621/solr/solrj/src/test/org/apache/solr/client/solrj/ (props changed)
lucene/dev/branches/lucene2621/solr/solrj/src/test/org/apache/solr/common/ (props changed)
lucene/dev/branches/lucene2621/solr/test-framework/ (props changed)
lucene/dev/branches/lucene2621/solr/testlogging.properties (props changed)
lucene/dev/branches/lucene2621/solr/webapp/ (props changed)
Modified: lucene/dev/branches/lucene2621/dev-tools/idea/.idea/compiler.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene2621/dev-tools/idea/.idea/compiler.xml?rev=1198350&r1=1198349&r2=1198350&view=diff
==============================================================================
--- lucene/dev/branches/lucene2621/dev-tools/idea/.idea/compiler.xml (original)
+++ lucene/dev/branches/lucene2621/dev-tools/idea/.idea/compiler.xml Sun Nov 6 12:30:27 2011
@@ -38,6 +38,8 @@
<entry name="?*.zip" />
<entry name="org.apache.lucene.index.codecs*" />
<entry name="README*" />
+ <entry name="[a-zA-Z][a-zA-Z]" />
+ <entry name="[a-zA-Z][a-zA-Z]-[a-zA-Z][a-zA-Z]" />
</wildcardResourcePatterns>
</component>
<component name="JavacSettings">
Modified: lucene/dev/branches/lucene2621/dev-tools/idea/solr/contrib/langid/langid.iml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene2621/dev-tools/idea/solr/contrib/langid/langid.iml?rev=1198350&r1=1198349&r2=1198350&view=diff
==============================================================================
--- lucene/dev/branches/lucene2621/dev-tools/idea/solr/contrib/langid/langid.iml (original)
+++ lucene/dev/branches/lucene2621/dev-tools/idea/solr/contrib/langid/langid.iml Sun Nov 6 12:30:27 2011
@@ -8,6 +8,7 @@
<sourceFolder url="file://$MODULE_DIR$/src/test" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test-files" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/java" isTestSource="false" />
+ <sourceFolder url="file://$MODULE_DIR$/src/resources" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
Modified: lucene/dev/branches/lucene2621/dev-tools/maven/lucene/contrib/misc/pom.xml.template
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene2621/dev-tools/maven/lucene/contrib/misc/pom.xml.template?rev=1198350&r1=1198349&r2=1198350&view=diff
==============================================================================
--- lucene/dev/branches/lucene2621/dev-tools/maven/lucene/contrib/misc/pom.xml.template (original)
+++ lucene/dev/branches/lucene2621/dev-tools/maven/lucene/contrib/misc/pom.xml.template Sun Nov 6 12:30:27 2011
@@ -53,6 +53,11 @@
<outputDirectory>${build-directory}/classes/java</outputDirectory>
<testOutputDirectory>${build-directory}/classes/test</testOutputDirectory>
<sourceDirectory>src/java</sourceDirectory>
+ <resources>
+ <resource>
+ <directory>src/resources</directory>
+ </resource>
+ </resources>
<testSourceDirectory>src/test</testSourceDirectory>
<testResources>
<testResource>
Modified: lucene/dev/branches/lucene2621/dev-tools/maven/lucene/contrib/spatial/pom.xml.template
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene2621/dev-tools/maven/lucene/contrib/spatial/pom.xml.template?rev=1198350&r1=1198349&r2=1198350&view=diff
==============================================================================
--- lucene/dev/branches/lucene2621/dev-tools/maven/lucene/contrib/spatial/pom.xml.template (original)
+++ lucene/dev/branches/lucene2621/dev-tools/maven/lucene/contrib/spatial/pom.xml.template Sun Nov 6 12:30:27 2011
@@ -38,14 +38,14 @@
<dependencies>
<dependency>
<groupId>${project.groupId}</groupId>
- <artifactId>lucene-core</artifactId>
+ <artifactId>lucene-test-framework</artifactId>
<version>${project.version}</version>
+ <scope>test</scope>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
- <artifactId>lucene-test-framework</artifactId>
+ <artifactId>lucene-core</artifactId>
<version>${project.version}</version>
- <scope>test</scope>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
Modified: lucene/dev/branches/lucene2621/dev-tools/maven/lucene/src/pom.xml.template
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene2621/dev-tools/maven/lucene/src/pom.xml.template?rev=1198350&r1=1198349&r2=1198350&view=diff
==============================================================================
--- lucene/dev/branches/lucene2621/dev-tools/maven/lucene/src/pom.xml.template (original)
+++ lucene/dev/branches/lucene2621/dev-tools/maven/lucene/src/pom.xml.template Sun Nov 6 12:30:27 2011
@@ -57,16 +57,24 @@
<outputDirectory>${build-directory}/classes/java</outputDirectory>
<testOutputDirectory>${build-directory}/classes/test</testOutputDirectory>
<sourceDirectory>java</sourceDirectory>
+ <resources>
+ <resource>
+ <directory>resources</directory>
+ </resource>
+ </resources>
<testSourceDirectory>test</testSourceDirectory>
<testResources>
<testResource>
- <directory>${project.build.testSourceDirectory}</directory>
+ <directory>test-framework/resources</directory>
+ </testResource>
+ <testResource>
+ <directory>test-framework/java</directory>
<excludes>
<exclude>**/*.java</exclude>
</excludes>
</testResource>
<testResource>
- <directory>test-framework</directory>
+ <directory>${project.build.testSourceDirectory}</directory>
<excludes>
<exclude>**/*.java</exclude>
</excludes>
Modified: lucene/dev/branches/lucene2621/dev-tools/maven/lucene/src/test-framework/pom.xml.template
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene2621/dev-tools/maven/lucene/src/test-framework/pom.xml.template?rev=1198350&r1=1198349&r2=1198350&view=diff
==============================================================================
--- lucene/dev/branches/lucene2621/dev-tools/maven/lucene/src/test-framework/pom.xml.template (original)
+++ lucene/dev/branches/lucene2621/dev-tools/maven/lucene/src/test-framework/pom.xml.template Sun Nov 6 12:30:27 2011
@@ -53,9 +53,12 @@
<build>
<directory>${build-directory}</directory>
<outputDirectory>${build-directory}/classes/test-framework</outputDirectory>
- <sourceDirectory>.</sourceDirectory>
+ <sourceDirectory>java</sourceDirectory>
<resources>
<resource>
+ <directory>resources</directory>
+ </resource>
+ <resource>
<directory>${project.build.sourceDirectory}</directory>
<excludes>
<exclude>**/*.java</exclude>
Modified: lucene/dev/branches/lucene2621/lucene/BUILD.txt
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene2621/lucene/BUILD.txt?rev=1198350&r1=1198349&r2=1198350&view=diff
==============================================================================
--- lucene/dev/branches/lucene2621/lucene/BUILD.txt (original)
+++ lucene/dev/branches/lucene2621/lucene/BUILD.txt Sun Nov 6 12:30:27 2011
@@ -1,22 +1,22 @@
Lucene Build Instructions
Basic steps:
- 0) Install JDK 1.5 (or greater), Ant 1.7.x (not 1.6.x, not 1.8.x)
+ 0) Install JDK 1.6 (or greater), Ant 1.7.1+ (not 1.6.x, not 1.8.x)
1) Download Lucene from Apache and unpack it
2) Connect to the top-level of your Lucene installation
3) Install JavaCC (optional)
4) Run ant
-Step 0) Set up your development environment (JDK 1.5 or greater,
-Ant 1.7.x)
+Step 0) Set up your development environment (JDK 1.6 or greater,
+Ant 1.7.1+)
We'll assume that you know how to get and set up the JDK - if you
don't, then we suggest starting at http://java.sun.com and learning
more about Java, before returning to this README. Lucene runs with
-JDK 1.5 and later.
+JDK 1.6 and later.
Like many Open Source java projects, Lucene uses Apache Ant for build
-control. Specifically, you MUST use Ant version 1.7.x
+control. Specifically, you MUST use Ant version 1.7.1+
Ant is "kind of like make without make's wrinkles". Ant is
implemented in java and uses XML-based configuration files. You can
Modified: lucene/dev/branches/lucene2621/lucene/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene2621/lucene/CHANGES.txt?rev=1198350&r1=1198349&r2=1198350&view=diff
==============================================================================
--- lucene/dev/branches/lucene2621/lucene/CHANGES.txt (original)
+++ lucene/dev/branches/lucene2621/lucene/CHANGES.txt Sun Nov 6 12:30:27 2011
@@ -759,6 +759,9 @@ Build
* SOLR-2849: Fix dependencies in Maven POMs. (David Smiley via Steve Rowe)
+* LUCENE-3561: Fix maven xxx-src.jar files that were missing resources.
+ (Uwe Schindler)
+
======================= Lucene 3.4.0 =======================
Bug fixes
Modified: lucene/dev/branches/lucene2621/lucene/build.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene2621/lucene/build.xml?rev=1198350&r1=1198349&r2=1198350&view=diff
==============================================================================
--- lucene/dev/branches/lucene2621/lucene/build.xml (original)
+++ lucene/dev/branches/lucene2621/lucene/build.xml Sun Nov 6 12:30:27 2011
@@ -571,7 +571,9 @@
<target name="jar-test-framework-src" depends="init">
<jarify basedir="${tests-framework.src.dir}" destfile="${build.dir}/lucene-test-framework-${version}-src.jar"
- title="Lucene Search Engine: Test Framework" />
+ title="Lucene Search Engine: Test Framework">
+ <fileset dir="${tests-framework.src.dir}/../resources" erroronmissingdir="no"/>
+ </jarify>
</target>
<!-- Override common-build.xml definition to check for the jar already being up-to-date -->
Modified: lucene/dev/branches/lucene2621/lucene/common-build.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene2621/lucene/common-build.xml?rev=1198350&r1=1198349&r2=1198350&view=diff
==============================================================================
--- lucene/dev/branches/lucene2621/lucene/common-build.xml (original)
+++ lucene/dev/branches/lucene2621/lucene/common-build.xml Sun Nov 6 12:30:27 2011
@@ -129,7 +129,7 @@
<property name="src.dir" location="src/java"/>
<property name="tests.src.dir" location="src/test"/>
- <property name="tests-framework.src.dir" location="${common.dir}/src/test-framework"/>
+ <property name="tests-framework.src.dir" location="${common.dir}/src/test-framework/java"/>
<property name="build.dir" location="build"/>
<!-- Needed in case a contrib needs the original build, also for compile-tools to be called from contrib -->
<property name="common.build.dir" location="${common.dir}/build"/>
@@ -321,9 +321,8 @@
</compile>
<!-- Copy the resources folder (if existent) -->
- <copy todir="${build.dir}/classes/java" includeEmptyDirs="false">
- <globmapper from="resources/*" to="*" handledirsep="yes"/>
- <fileset dir="src" includes="resources/**"/>
+ <copy todir="${build.dir}/classes/java">
+ <fileset dir="${src.dir}/../resources" erroronmissingdir="no"/>
</copy>
</target>
@@ -472,12 +471,11 @@
</path>
<target name="compile-test-framework" depends="compile-core">
- <compile-test-macro srcdir="${tests-framework.src.dir}/java" destdir="${common.dir}/build/classes/test-framework"
+ <compile-test-macro srcdir="${tests-framework.src.dir}" destdir="${common.dir}/build/classes/test-framework"
test.classpath="test-framework.classpath"/>
- <!-- Copy the resources folder (if existent) -->
- <copy todir="${build.dir}/classes/test-framework" includeEmptyDirs="false">
- <globmapper from="resources/*" to="*" handledirsep="yes"/>
- <fileset dir="${tests-framework.src.dir}" includes="resources/**"/>
+ <!-- Copy the resources folder (if existent) -->
+ <copy todir="${build.dir}/classes/test-framework">
+ <fileset dir="${tests-framework.src.dir}/../resources" erroronmissingdir="no"/>
</copy>
</target>
@@ -698,7 +696,7 @@
<fileset dir="contrib" id="clover.contrib.test.src.files">
<include name="**/test/**/*.java"/>
</fileset>
- <fileset dir="${tests-framework.src.dir}" id="clover.test.src.files">
+ <fileset dir="${tests-framework.src.dir}" id="clover.test-framework.src.files">
<include name="**/*.java" />
</fileset>
<fileset dir="${tests.src.dir}" id="clover.test.src.files">
@@ -713,12 +711,14 @@
<current outfile="${clover.report.dir}" title="${final.name}" numThreads="0">
<format type="html" filter="assert"/>
<testsources refid="clover.test.src.files"/>
+ <testsources refid="clover.test-framework.src.files"/>
<testsources refid="clover.contrib.test.src.files"/>
<testresults refid="clover.test.result.files"/>
</current>
<current outfile="${clover.report.dir}/clover.xml" title="${final.name}">
<format type="xml" filter="assert"/>
<testsources refid="clover.test.src.files"/>
+ <testsources refid="clover.test-framework.src.files"/>
<testsources refid="clover.contrib.test.src.files"/>
<testresults refid="clover.test.result.files"/>
</current>
@@ -754,7 +754,9 @@
</target>
<target name="jar-src" depends="init">
- <jarify basedir="${src.dir}" destfile="${build.dir}/${final.name}-src.jar"/>
+ <jarify basedir="${src.dir}" destfile="${build.dir}/${final.name}-src.jar">
+ <fileset dir="${src.dir}/../resources" erroronmissingdir="no"/>
+ </jarify>
</target>
<target name="default" depends="jar-core"/>
Modified: lucene/dev/branches/lucene2621/lucene/contrib/misc/src/java/org/apache/lucene/store/DirectIOLinuxDirectory.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene2621/lucene/contrib/misc/src/java/org/apache/lucene/store/DirectIOLinuxDirectory.java?rev=1198350&r1=1198349&r2=1198350&view=diff
==============================================================================
--- lucene/dev/branches/lucene2621/lucene/contrib/misc/src/java/org/apache/lucene/store/DirectIOLinuxDirectory.java (original)
+++ lucene/dev/branches/lucene2621/lucene/contrib/misc/src/java/org/apache/lucene/store/DirectIOLinuxDirectory.java Sun Nov 6 12:30:27 2011
@@ -245,6 +245,7 @@ public class DirectIOLinuxDirectory exte
public DirectIOLinuxIndexInput(File path, int bufferSize) throws IOException {
// TODO make use of IOContext
+ super("DirectIOLinuxIndexInput(path=\"" + path.getPath() + "\")");
FileDescriptor fd = NativePosixUtil.open_direct(path.toString(), true);
fis = new FileInputStream(fd);
channel = fis.getChannel();
@@ -259,6 +260,7 @@ public class DirectIOLinuxDirectory exte
// for clone
public DirectIOLinuxIndexInput(DirectIOLinuxIndexInput other) throws IOException {
+ super(other.toString());
this.fis = null;
channel = other.channel;
this.bufferSize = other.bufferSize;
@@ -308,7 +310,7 @@ public class DirectIOLinuxDirectory exte
try {
return channel.size();
} catch (IOException ioe) {
- throw new RuntimeException(ioe);
+ throw new RuntimeException("IOException during length(): " + this, ioe);
}
}
@@ -331,9 +333,14 @@ public class DirectIOLinuxDirectory exte
bufferPos = 0;
assert (filePos & ALIGN_NOT_MASK) == filePos : "filePos=" + filePos + " anded=" + (filePos & ALIGN_NOT_MASK);
//System.out.println("X refill filePos=" + filePos);
- int n = channel.read(buffer, filePos);
+ int n;
+ try {
+ n = channel.read(buffer, filePos);
+ } catch (IOException ioe) {
+ throw new IOException(ioe.getMessage() + ": " + this, ioe);
+ }
if (n < 0) {
- throw new IOException("eof");
+ throw new IOException("eof: " + this);
}
buffer.rewind();
}
@@ -365,7 +372,7 @@ public class DirectIOLinuxDirectory exte
try {
return new DirectIOLinuxIndexInput(this);
} catch (IOException ioe) {
- throw new RuntimeException(ioe);
+ throw new RuntimeException("IOException during clone: " + this, ioe);
}
}
}
Modified: lucene/dev/branches/lucene2621/lucene/contrib/misc/src/java/org/apache/lucene/store/WindowsDirectory.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene2621/lucene/contrib/misc/src/java/org/apache/lucene/store/WindowsDirectory.java?rev=1198350&r1=1198349&r2=1198350&view=diff
==============================================================================
--- lucene/dev/branches/lucene2621/lucene/contrib/misc/src/java/org/apache/lucene/store/WindowsDirectory.java (original)
+++ lucene/dev/branches/lucene2621/lucene/contrib/misc/src/java/org/apache/lucene/store/WindowsDirectory.java Sun Nov 6 12:30:27 2011
@@ -19,6 +19,7 @@ package org.apache.lucene.store;
import java.io.File;
import java.io.IOException;
+import java.io.EOFException;
import org.apache.lucene.store.Directory; // javadoc
import org.apache.lucene.store.NativeFSLockFactory; // javadoc
@@ -80,7 +81,7 @@ public class WindowsDirectory extends FS
boolean isOpen;
public WindowsIndexInput(File file, int bufferSize) throws IOException {
- super(bufferSize);
+ super("WindowsIndexInput(path=\"" + file.getPath() + "\")", bufferSize);
fd = WindowsDirectory.open(file.getPath());
length = WindowsDirectory.length(fd);
isOpen = true;
@@ -88,8 +89,16 @@ public class WindowsDirectory extends FS
@Override
protected void readInternal(byte[] b, int offset, int length) throws IOException {
- if (WindowsDirectory.read(fd, b, offset, length, getFilePointer()) != length)
- throw new IOException("Read past EOF");
+ int bytesRead;
+ try {
+ bytesRead = WindowsDirectory.read(fd, b, offset, length, getFilePointer());
+ } catch (IOException ioe) {
+ throw new IOException(ioe.getMessage() + ": " + this, ioe);
+ }
+
+ if (bytesRead != length) {
+ throw new EOFException("Read past EOF: " + this);
+ }
}
@Override
Modified: lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/index/DocumentsWriter.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/index/DocumentsWriter.java?rev=1198350&r1=1198349&r2=1198350&view=diff
==============================================================================
--- lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/index/DocumentsWriter.java (original)
+++ lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/index/DocumentsWriter.java Sun Nov 6 12:30:27 2011
@@ -117,7 +117,14 @@ final class DocumentsWriter {
// TODO: cut over to BytesRefHash in BufferedDeletes
volatile DocumentsWriterDeleteQueue deleteQueue = new DocumentsWriterDeleteQueue();
- private final Queue<FlushTicket> ticketQueue = new LinkedList<DocumentsWriter.FlushTicket>();
+ private final TicketQueue ticketQueue = new TicketQueue();
+ /*
+ * we preserve changes during a full flush since IW might not checkout before
+ * we release all changes. NRT Readers otherwise suddenly return true from
+ * isCurrent while there are actually changes currently committed. See also
+ * #anyChanges() & #flushAllThreads
+ */
+ private volatile boolean pendingChangesInCurrentFullFlush;
private Collection<String> abortedFiles; // List of files that were written before last abort()
@@ -170,6 +177,7 @@ final class DocumentsWriter {
private void applyAllDeletes(DocumentsWriterDeleteQueue deleteQueue) throws IOException {
if (deleteQueue != null && !flushControl.isFullFlush()) {
synchronized (ticketQueue) {
+ ticketQueue.incTicketCount();// first inc the ticket count - freeze opens a window for #anyChanges to fail
// Freeze and insert the delete flush ticket in the queue
ticketQueue.add(new FlushTicket(deleteQueue.freezeGlobalBuffer(null), false));
applyFlushTickets();
@@ -256,9 +264,22 @@ final class DocumentsWriter {
}
boolean anyChanges() {
- return numDocsInRAM.get() != 0 || anyDeletions();
+ if (infoStream != null) {
+ message("docWriter: anyChanges? numDocsInRam=" + numDocsInRAM.get()
+ + " deletes=" + anyDeletions() + " hasTickets:"
+ + ticketQueue.hasTickets() + " pendingChangesInFullFlush: "
+ + pendingChangesInCurrentFullFlush);
+ }
+ /*
+ * changes are either in a DWPT or in the deleteQueue.
+ * yet if we currently flush deletes and / or dwpt there
+ * could be a window where all changes are in the ticket queue
+ * before they are published to the IW. ie we need to check if the
+ * ticket queue has any tickets.
+ */
+ return numDocsInRAM.get() != 0 || anyDeletions() || ticketQueue.hasTickets() || pendingChangesInCurrentFullFlush;
}
-
+
public int getBufferedDeleteTermsSize() {
return deleteQueue.getBufferedDeleteTermsSize();
}
@@ -283,7 +304,7 @@ final class DocumentsWriter {
if (flushControl.anyStalledThreads() || flushControl.numQueuedFlushes() > 0) {
// Help out flushing any queued DWPTs so we can un-stall:
if (infoStream != null) {
- message("DocumentsWriter has queued dwpt; will hijack this thread to flush pending segment(s)");
+ message("docWriter: DocumentsWriter has queued dwpt; will hijack this thread to flush pending segment(s)");
}
do {
// Try pick up pending threads here if possible
@@ -417,7 +438,7 @@ final class DocumentsWriter {
synchronized (ticketQueue) {
// Each flush is assigned a ticket in the order they acquire the ticketQueue lock
ticket = new FlushTicket(flushingDWPT.prepareFlush(), true);
- ticketQueue.add(ticket);
+ ticketQueue.incrementAndAdd(ticket);
}
// flush concurrently without locking
@@ -474,8 +495,11 @@ final class DocumentsWriter {
// Keep publishing eligible flushed segments:
final FlushTicket head = ticketQueue.peek();
if (head != null && head.canPublish()) {
- ticketQueue.poll();
- finishFlush(head.segment, head.frozenDeletes);
+ try {
+ finishFlush(head.segment, head.frozenDeletes);
+ } finally {
+ ticketQueue.poll();
+ }
} else {
break;
}
@@ -489,7 +513,7 @@ final class DocumentsWriter {
if (newSegment == null) {
assert bufferedDeletes != null;
if (bufferedDeletes != null && bufferedDeletes.any()) {
- indexWriter.bufferedDeletesStream.push(bufferedDeletes);
+ indexWriter.publishFrozenDeletes(bufferedDeletes);
if (infoStream != null) {
message("flush: push buffered deletes: " + bufferedDeletes);
}
@@ -535,6 +559,7 @@ final class DocumentsWriter {
// for asserts
private volatile DocumentsWriterDeleteQueue currentFullFlushDelQueue = null;
+
// for asserts
private synchronized boolean setFlushingDeleteQueue(DocumentsWriterDeleteQueue session) {
currentFullFlushDelQueue = session;
@@ -554,6 +579,7 @@ final class DocumentsWriter {
}
synchronized (this) {
+ pendingChangesInCurrentFullFlush = anyChanges();
flushingDeleteQueue = deleteQueue;
/* Cutover to a new delete queue. This must be synced on the flush control
* otherwise a new DWPT could sneak into the loop with an already flushing
@@ -573,11 +599,12 @@ final class DocumentsWriter {
}
// If a concurrent flush is still in flight wait for it
flushControl.waitForFlush();
- if (!anythingFlushed) { // apply deletes if we did not flush any document
+ if (!anythingFlushed && flushingDeleteQueue.anyChanges()) { // apply deletes if we did not flush any document
if (infoStream != null) {
message(Thread.currentThread().getName() + ": flush naked frozen global deletes");
}
synchronized (ticketQueue) {
+ ticketQueue.incTicketCount(); // first inc the ticket count - freeze opens a window for #anyChanges to fail
ticketQueue.add(new FlushTicket(flushingDeleteQueue.freezeGlobalBuffer(null), false));
}
applyFlushTickets();
@@ -590,16 +617,21 @@ final class DocumentsWriter {
}
final void finishFullFlush(boolean success) {
- if (infoStream != null) {
- message(Thread.currentThread().getName() + " finishFullFlush success=" + success);
- }
- assert setFlushingDeleteQueue(null);
- if (success) {
- // Release the flush lock
- flushControl.finishFullFlush();
- } else {
- flushControl.abortFullFlushes();
+ try {
+ if (infoStream != null) {
+ message(Thread.currentThread().getName() + " finishFullFlush success=" + success);
+ }
+ assert setFlushingDeleteQueue(null);
+ if (success) {
+ // Release the flush lock
+ flushControl.finishFullFlush();
+ } else {
+ flushControl.abortFullFlushes();
+ }
+ } finally {
+ pendingChangesInCurrentFullFlush = false;
}
+
}
static final class FlushTicket {
@@ -618,6 +650,46 @@ final class DocumentsWriter {
}
}
+ static final class TicketQueue {
+ private final Queue<FlushTicket> queue = new LinkedList<FlushTicket>();
+ final AtomicInteger ticketCount = new AtomicInteger();
+
+ void incTicketCount() {
+ ticketCount.incrementAndGet();
+ }
+
+ public boolean hasTickets() {
+ assert ticketCount.get() >= 0;
+ return ticketCount.get() != 0;
+ }
+
+ void incrementAndAdd(FlushTicket ticket) {
+ incTicketCount();
+ add(ticket);
+ }
+
+ void add(FlushTicket ticket) {
+ queue.add(ticket);
+ }
+
+ FlushTicket peek() {
+ return queue.peek();
+ }
+
+ FlushTicket poll() {
+ try {
+ return queue.poll();
+ } finally {
+ ticketCount.decrementAndGet();
+ }
+ }
+
+ void clear() {
+ queue.clear();
+ ticketCount.set(0);
+ }
+ }
+
// use by IW during close to assert all DWPT are inactive after final flush
boolean assertNoActiveDWPT() {
Iterator<ThreadState> activePerThreadsIterator = perThreadPool.getAllPerThreadsIterator();
Modified: lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/index/FieldInfos.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/index/FieldInfos.java?rev=1198350&r1=1198349&r2=1198350&view=diff
==============================================================================
--- lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/index/FieldInfos.java (original)
+++ lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/index/FieldInfos.java Sun Nov 6 12:30:27 2011
@@ -650,10 +650,10 @@ public final class FieldInfos implements
format = input.readVInt();
if (format > FORMAT_MINIMUM) {
- throw new IndexFormatTooOldException(fileName, format, FORMAT_MINIMUM, FORMAT_CURRENT);
+ throw new IndexFormatTooOldException(input, format, FORMAT_MINIMUM, FORMAT_CURRENT);
}
if (format < FORMAT_CURRENT) {
- throw new IndexFormatTooNewException(fileName, format, FORMAT_MINIMUM, FORMAT_CURRENT);
+ throw new IndexFormatTooNewException(input, format, FORMAT_MINIMUM, FORMAT_CURRENT);
}
final int size = input.readVInt(); //read in the size
@@ -675,7 +675,7 @@ public final class FieldInfos implements
if (format <= FORMAT_OMIT_POSITIONS) {
indexOptions = IndexOptions.DOCS_AND_FREQS;
} else {
- throw new CorruptIndexException("Corrupt fieldinfos, OMIT_POSITIONS set but format=" + format);
+ throw new CorruptIndexException("Corrupt fieldinfos, OMIT_POSITIONS set but format=" + format + " (resource: " + input + ")");
}
} else {
indexOptions = IndexOptions.DOCS_AND_FREQS_AND_POSITIONS;
@@ -745,7 +745,7 @@ public final class FieldInfos implements
}
if (input.getFilePointer() != input.length()) {
- throw new CorruptIndexException("did not read all bytes from file \"" + fileName + "\": read " + input.getFilePointer() + " vs size " + input.length());
+ throw new CorruptIndexException("did not read all bytes from file \"" + fileName + "\": read " + input.getFilePointer() + " vs size " + input.length() + " (resource: " + input + ")");
}
}
Modified: lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/index/IndexFormatTooNewException.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/index/IndexFormatTooNewException.java?rev=1198350&r1=1198349&r2=1198350&view=diff
==============================================================================
--- lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/index/IndexFormatTooNewException.java (original)
+++ lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/index/IndexFormatTooNewException.java Sun Nov 6 12:30:27 2011
@@ -17,15 +17,24 @@
package org.apache.lucene.index;
+import org.apache.lucene.store.DataInput;
+
/**
* This exception is thrown when Lucene detects
* an index that is newer than this Lucene version.
*/
public class IndexFormatTooNewException extends CorruptIndexException {
- public IndexFormatTooNewException(String filename, int version, int minVersion, int maxVersion) {
- super("Format version is not supported" + (filename!=null ? (" in file '" + filename + "'") : "") +
- ": " + version + " (needs to be between " + minVersion + " and " + maxVersion + ")");
+ /** @lucene.internal */
+ public IndexFormatTooNewException(String resourceDesc, int version, int minVersion, int maxVersion) {
+ super("Format version is not supported (resource: " + resourceDesc + "): "
+ + version + " (needs to be between " + minVersion + " and " + maxVersion + ")");
+ assert resourceDesc != null;
+ }
+
+ /** @lucene.internal */
+ public IndexFormatTooNewException(DataInput in, int version, int minVersion, int maxVersion) {
+ this(in.toString(), version, minVersion, maxVersion);
}
}
Modified: lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/index/IndexFormatTooOldException.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/index/IndexFormatTooOldException.java?rev=1198350&r1=1198349&r2=1198350&view=diff
==============================================================================
--- lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/index/IndexFormatTooOldException.java (original)
+++ lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/index/IndexFormatTooOldException.java Sun Nov 6 12:30:27 2011
@@ -17,21 +17,36 @@
package org.apache.lucene.index;
+import org.apache.lucene.store.DataInput;
+
/**
* This exception is thrown when Lucene detects
* an index that is too old for this Lucene version
*/
public class IndexFormatTooOldException extends CorruptIndexException {
- public IndexFormatTooOldException(String filename, String version) {
- super("Format version is not supported" + (filename!=null ? (" in file '" + filename + "'") : "") +
- ": " + version + ". This version of Lucene only supports indexes created with release 3.0 and later.");
+ /** @lucene.internal */
+ public IndexFormatTooOldException(String resourceDesc, String version) {
+ super("Format version is not supported (resource: " + resourceDesc + "): " +
+ version + ". This version of Lucene only supports indexes created with release 3.0 and later.");
+ assert resourceDesc != null;
+ }
+
+ /** @lucene.internal */
+ public IndexFormatTooOldException(DataInput in, String version) {
+ this(in.toString(), version);
}
- public IndexFormatTooOldException(String filename, int version, int minVersion, int maxVersion) {
- super("Format version is not supported" + (filename!=null ? (" in file '" + filename + "'") : "") +
- ": " + version + " (needs to be between " + minVersion + " and " + maxVersion +
+ /** @lucene.internal */
+ public IndexFormatTooOldException(String resourceDesc, int version, int minVersion, int maxVersion) {
+ super("Format version is not supported (resource: " + resourceDesc + "): " +
+ version + " (needs to be between " + minVersion + " and " + maxVersion +
"). This version of Lucene only supports indexes created with release 3.0 and later.");
+ assert resourceDesc != null;
}
+ /** @lucene.internal */
+ public IndexFormatTooOldException(DataInput in, int version, int minVersion, int maxVersion) {
+ this(in.toString(), version, minVersion, maxVersion);
+ }
}
Modified: lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/index/IndexWriter.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/index/IndexWriter.java?rev=1198350&r1=1198349&r2=1198350&view=diff
==============================================================================
--- lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/index/IndexWriter.java (original)
+++ lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/index/IndexWriter.java Sun Nov 6 12:30:27 2011
@@ -2354,6 +2354,13 @@ public class IndexWriter implements Clos
return newSegment;
}
+ synchronized void publishFrozenDeletes(FrozenBufferedDeletes packet) throws IOException {
+ assert packet != null && packet.any();
+ synchronized (bufferedDeletesStream) {
+ bufferedDeletesStream.push(packet);
+ }
+ }
+
/**
* Atomically adds the segment private delete packet and publishes the flushed
* segments SegmentInfo to the index writer. NOTE: use
@@ -2984,14 +2991,14 @@ public class IndexWriter implements Clos
final boolean anySegmentFlushed;
synchronized (fullFlushLock) {
+ boolean flushSuccess = false;
try {
anySegmentFlushed = docWriter.flushAllThreads();
- success = true;
+ flushSuccess = true;
} finally {
- docWriter.finishFullFlush(success);
+ docWriter.finishFullFlush(flushSuccess);
}
}
- success = false;
synchronized(this) {
maybeApplyDeletes(applyAllDeletes);
doAfterFlush();
@@ -4074,6 +4081,10 @@ public class IndexWriter implements Clos
synchronized boolean nrtIsCurrent(SegmentInfos infos) {
//System.out.println("IW.nrtIsCurrent " + (infos.version == segmentInfos.version && !docWriter.anyChanges() && !bufferedDeletesStream.any()));
ensureOpen();
+ if (infoStream != null) {
+ message("nrtIsCurrent: infoVersion matches: " + (infos.version == segmentInfos.version) + " DW changes: " + docWriter.anyChanges() + " BD changes: "+bufferedDeletesStream.any());
+
+ }
return infos.version == segmentInfos.version && !docWriter.anyChanges() && !bufferedDeletesStream.any();
}
Modified: lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/index/PrefixCodedTerms.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/index/PrefixCodedTerms.java?rev=1198350&r1=1198349&r2=1198350&view=diff
==============================================================================
--- lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/index/PrefixCodedTerms.java (original)
+++ lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/index/PrefixCodedTerms.java Sun Nov 6 12:30:27 2011
@@ -20,7 +20,6 @@ package org.apache.lucene.index;
import java.io.IOException;
import java.util.Iterator;
-import org.apache.lucene.index.Term;
import org.apache.lucene.store.IndexInput;
import org.apache.lucene.store.RAMFile;
import org.apache.lucene.store.RAMInputStream;
@@ -56,7 +55,7 @@ class PrefixCodedTerms implements Iterab
PrefixCodedTermsIterator() {
try {
- input = new RAMInputStream(buffer);
+ input = new RAMInputStream("PrefixCodedTermsIterator", buffer);
} catch (IOException e) {
throw new RuntimeException(e);
}
Modified: lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/index/SegmentInfos.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/index/SegmentInfos.java?rev=1198350&r1=1198349&r2=1198350&view=diff
==============================================================================
--- lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/index/SegmentInfos.java (original)
+++ lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/index/SegmentInfos.java Sun Nov 6 12:30:27 2011
@@ -255,10 +255,10 @@ public final class SegmentInfos implemen
// check that it is a format we can understand
if (format > DefaultSegmentInfosWriter.FORMAT_MINIMUM)
- throw new IndexFormatTooOldException(segmentFileName, format,
+ throw new IndexFormatTooOldException(input, format,
DefaultSegmentInfosWriter.FORMAT_MINIMUM, DefaultSegmentInfosWriter.FORMAT_CURRENT);
if (format < DefaultSegmentInfosWriter.FORMAT_CURRENT)
- throw new IndexFormatTooNewException(segmentFileName, format,
+ throw new IndexFormatTooNewException(input, format,
DefaultSegmentInfosWriter.FORMAT_MINIMUM, DefaultSegmentInfosWriter.FORMAT_CURRENT);
if (format <= DefaultSegmentInfosWriter.FORMAT_4_0) {
@@ -271,7 +271,7 @@ public final class SegmentInfos implemen
final long checksumNow = input.getChecksum();
final long checksumThen = input.readLong();
if (checksumNow != checksumThen)
- throw new CorruptIndexException("checksum mismatch in segments file");
+ throw new CorruptIndexException("checksum mismatch in segments file (resource: " + input + ")");
success = true;
}
finally {
@@ -634,8 +634,7 @@ public final class SegmentInfos implemen
}
} else {
/* TODO: Investigate this!
- throw new IndexFormatTooNewException("segments.gen version number invalid: " + version +
- " (must be " + FORMAT_SEGMENTS_GEN_CURRENT + ")");
+ throw new IndexFormatTooNewException(genInput, version, FORMAT_SEGMENTS_GEN_CURRENT, FORMAT_SEGMENTS_GEN_CURRENT);
*/
}
} catch (IOException err2) {
Modified: lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/index/TermVectorsReader.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/index/TermVectorsReader.java?rev=1198350&r1=1198349&r2=1198350&view=diff
==============================================================================
--- lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/index/TermVectorsReader.java (original)
+++ lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/index/TermVectorsReader.java Sun Nov 6 12:30:27 2011
@@ -17,12 +17,9 @@ package org.apache.lucene.index;
* limitations under the License.
*/
-import org.apache.lucene.index.MergePolicy.OneMerge;
-import org.apache.lucene.store.BufferedIndexInput;
import org.apache.lucene.store.Directory;
import org.apache.lucene.store.IOContext;
import org.apache.lucene.store.IndexInput;
-import org.apache.lucene.store.IOContext.Context;
import org.apache.lucene.util.ArrayUtil;
import org.apache.lucene.util.BytesRef;
import org.apache.lucene.util.IOUtils;
@@ -186,9 +183,9 @@ class TermVectorsReader implements Clone
{
int format = in.readInt();
if (format < FORMAT_MINIMUM)
- throw new IndexFormatTooOldException(fn, format, FORMAT_MINIMUM, FORMAT_CURRENT);
+ throw new IndexFormatTooOldException(in, format, FORMAT_MINIMUM, FORMAT_CURRENT);
if (format > FORMAT_CURRENT)
- throw new IndexFormatTooNewException(fn, format, FORMAT_MINIMUM, FORMAT_CURRENT);
+ throw new IndexFormatTooNewException(in, format, FORMAT_MINIMUM, FORMAT_CURRENT);
return format;
}
Modified: lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/index/codecs/DefaultFieldsReader.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/index/codecs/DefaultFieldsReader.java?rev=1198350&r1=1198349&r2=1198350&view=diff
==============================================================================
--- lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/index/codecs/DefaultFieldsReader.java (original)
+++ lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/index/codecs/DefaultFieldsReader.java Sun Nov 6 12:30:27 2011
@@ -88,9 +88,9 @@ public final class DefaultFieldsReader e
try {
int format = idxStream.readInt();
if (format < DefaultFieldsWriter.FORMAT_MINIMUM)
- throw new IndexFormatTooOldException(indexStreamFN, format, DefaultFieldsWriter.FORMAT_MINIMUM, DefaultFieldsWriter.FORMAT_CURRENT);
+ throw new IndexFormatTooOldException(idxStream, format, DefaultFieldsWriter.FORMAT_MINIMUM, DefaultFieldsWriter.FORMAT_CURRENT);
if (format > DefaultFieldsWriter.FORMAT_CURRENT)
- throw new IndexFormatTooNewException(indexStreamFN, format, DefaultFieldsWriter.FORMAT_MINIMUM, DefaultFieldsWriter.FORMAT_CURRENT);
+ throw new IndexFormatTooNewException(idxStream, format, DefaultFieldsWriter.FORMAT_MINIMUM, DefaultFieldsWriter.FORMAT_CURRENT);
} finally {
idxStream.close();
}
@@ -128,9 +128,9 @@ public final class DefaultFieldsReader e
format = cloneableIndexStream.readInt();
if (format < DefaultFieldsWriter.FORMAT_MINIMUM)
- throw new IndexFormatTooOldException(indexStreamFN, format, DefaultFieldsWriter.FORMAT_MINIMUM, DefaultFieldsWriter.FORMAT_CURRENT);
+ throw new IndexFormatTooOldException(cloneableIndexStream, format, DefaultFieldsWriter.FORMAT_MINIMUM, DefaultFieldsWriter.FORMAT_CURRENT);
if (format > DefaultFieldsWriter.FORMAT_CURRENT)
- throw new IndexFormatTooNewException(indexStreamFN, format, DefaultFieldsWriter.FORMAT_MINIMUM, DefaultFieldsWriter.FORMAT_CURRENT);
+ throw new IndexFormatTooNewException(cloneableIndexStream, format, DefaultFieldsWriter.FORMAT_MINIMUM, DefaultFieldsWriter.FORMAT_CURRENT);
fieldsStream = (IndexInput) cloneableFieldsStream.clone();
@@ -271,33 +271,4 @@ public final class DefaultFieldsReader e
return fieldsStream;
}
-
- /**
- * Skip the field. We still have to read some of the information about the field, but can skip past the actual content.
- * This will have the most payoff on large fields.
- */
- private void skipField(int numeric) throws IOException {
- final int numBytes;
- switch(numeric) {
- case 0:
- numBytes = fieldsStream.readVInt();
- break;
- case DefaultFieldsWriter.FIELD_IS_NUMERIC_INT:
- case DefaultFieldsWriter.FIELD_IS_NUMERIC_FLOAT:
- numBytes = 4;
- break;
- case DefaultFieldsWriter.FIELD_IS_NUMERIC_LONG:
- case DefaultFieldsWriter.FIELD_IS_NUMERIC_DOUBLE:
- numBytes = 8;
- break;
- default:
- throw new FieldReaderException("Invalid numeric type: " + Integer.toHexString(numeric));
- }
-
- skipFieldBytes(numBytes);
- }
-
- private void skipFieldBytes(int toRead) throws IOException {
- fieldsStream.seek(fieldsStream.getFilePointer() + toRead);
- }
}
Modified: lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/index/codecs/DefaultSegmentInfosReader.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/index/codecs/DefaultSegmentInfosReader.java?rev=1198350&r1=1198349&r2=1198350&view=diff
==============================================================================
--- lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/index/codecs/DefaultSegmentInfosReader.java (original)
+++ lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/index/codecs/DefaultSegmentInfosReader.java Sun Nov 6 12:30:27 2011
@@ -64,7 +64,7 @@ public class DefaultSegmentInfosReader e
IndexFileNames.COMPOUND_FILE_STORE_EXTENSION), context, false);
}
} else if (si.getUseCompoundFile()) {
- dir = new CompoundFileDirectory(dir,IndexFileNames.segmentFileName(
+ dir = new CompoundFileDirectory(dir, IndexFileNames.segmentFileName(
si.name, "", IndexFileNames.COMPOUND_FILE_EXTENSION), context, false);
}
@@ -83,7 +83,7 @@ public class DefaultSegmentInfosReader e
// If it's a 3x index touched by 3.1+ code, then segments record their
// version, whether they are 2.x ones or not. We detect that and throw
// appropriate exception.
- throw new IndexFormatTooOldException(si.name, si.getVersion());
+ throw new IndexFormatTooOldException("segment " + si.name + " in resource " + input, si.getVersion());
}
infos.add(si);
}
Modified: lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/index/codecs/MultiLevelSkipListReader.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/index/codecs/MultiLevelSkipListReader.java?rev=1198350&r1=1198349&r2=1198350&view=diff
==============================================================================
--- lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/index/codecs/MultiLevelSkipListReader.java (original)
+++ lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/index/codecs/MultiLevelSkipListReader.java Sun Nov 6 12:30:27 2011
@@ -255,6 +255,7 @@ public abstract class MultiLevelSkipList
private int pos;
SkipBuffer(IndexInput input, int length) throws IOException {
+ super("SkipBuffer on " + input);
data = new byte[length];
pointer = input.getFilePointer();
input.readBytes(data, 0, length);
Modified: lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/index/codecs/lucene3x/SegmentTermEnum.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/index/codecs/lucene3x/SegmentTermEnum.java?rev=1198350&r1=1198349&r2=1198350&view=diff
==============================================================================
--- lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/index/codecs/lucene3x/SegmentTermEnum.java (original)
+++ lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/index/codecs/lucene3x/SegmentTermEnum.java Sun Nov 6 12:30:27 2011
@@ -85,9 +85,9 @@ public final class SegmentTermEnum imple
// check that it is a format we can understand
if (format > FORMAT_MINIMUM)
- throw new IndexFormatTooOldException(null, format, FORMAT_MINIMUM, FORMAT_CURRENT);
+ throw new IndexFormatTooOldException(input, format, FORMAT_MINIMUM, FORMAT_CURRENT);
if (format < FORMAT_CURRENT)
- throw new IndexFormatTooNewException(null, format, FORMAT_MINIMUM, FORMAT_CURRENT);
+ throw new IndexFormatTooNewException(input, format, FORMAT_MINIMUM, FORMAT_CURRENT);
size = input.readLong(); // read the size
Modified: lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/index/codecs/lucene40/Lucene40PostingsWriter.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/index/codecs/lucene40/Lucene40PostingsWriter.java?rev=1198350&r1=1198349&r2=1198350&view=diff
==============================================================================
--- lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/index/codecs/lucene40/Lucene40PostingsWriter.java (original)
+++ lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/index/codecs/lucene40/Lucene40PostingsWriter.java Sun Nov 6 12:30:27 2011
@@ -163,7 +163,7 @@ public final class Lucene40PostingsWrite
final int delta = docID - lastDocID;
if (docID < 0 || (df > 0 && delta <= 0)) {
- throw new CorruptIndexException("docs out of order (" + docID + " <= " + lastDocID + " )");
+ throw new CorruptIndexException("docs out of order (" + docID + " <= " + lastDocID + " ) (freqOut: " + freqOut + ")");
}
if ((++df % skipInterval) == 0) {
Modified: lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/index/codecs/sep/SepPostingsWriter.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/index/codecs/sep/SepPostingsWriter.java?rev=1198350&r1=1198349&r2=1198350&view=diff
==============================================================================
--- lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/index/codecs/sep/SepPostingsWriter.java (original)
+++ lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/index/codecs/sep/SepPostingsWriter.java Sun Nov 6 12:30:27 2011
@@ -20,7 +20,6 @@ package org.apache.lucene.index.codecs.s
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
-import java.util.Set;
import org.apache.lucene.index.CorruptIndexException;
import org.apache.lucene.index.DocsEnum;
@@ -203,7 +202,7 @@ public final class SepPostingsWriter ext
//System.out.println("SEPW: startDoc: write doc=" + docID + " delta=" + delta + " out.fp=" + docOut);
if (docID < 0 || (df > 0 && delta <= 0)) {
- throw new CorruptIndexException("docs out of order (" + docID + " <= " + lastDocID + " )");
+ throw new CorruptIndexException("docs out of order (" + docID + " <= " + lastDocID + " ) (docOut: " + docOut + ")");
}
if ((++df % skipInterval) == 0) {
Modified: lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/search/CollectionStatistics.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/search/CollectionStatistics.java?rev=1198350&r1=1198349&r2=1198350&view=diff
==============================================================================
--- lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/search/CollectionStatistics.java (original)
+++ lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/search/CollectionStatistics.java Sun Nov 6 12:30:27 2011
@@ -40,33 +40,33 @@ public class CollectionStatistics {
}
/** returns the field name */
- public String field() {
+ public final String field() {
return field;
}
/** returns the total number of documents, regardless of
* whether they all contain values for this field.
* @see IndexReader#maxDoc() */
- public int maxDoc() {
+ public final int maxDoc() {
return maxDoc;
}
/** returns the total number of documents that
* have at least one term for this field.
* @see Terms#getDocCount() */
- public int docCount() {
+ public final int docCount() {
return docCount;
}
/** returns the total number of tokens for this field
* @see Terms#getSumTotalTermFreq() */
- public long sumTotalTermFreq() {
+ public final long sumTotalTermFreq() {
return sumTotalTermFreq;
}
/** returns the total number of postings for this field
* @see Terms#getSumDocFreq() */
- public long sumDocFreq() {
+ public final long sumDocFreq() {
return sumDocFreq;
}
}
Modified: lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/search/TermStatistics.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/search/TermStatistics.java?rev=1198350&r1=1198349&r2=1198350&view=diff
==============================================================================
--- lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/search/TermStatistics.java (original)
+++ lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/search/TermStatistics.java Sun Nov 6 12:30:27 2011
@@ -35,19 +35,19 @@ public class TermStatistics {
}
/** returns the term text */
- public BytesRef term() {
+ public final BytesRef term() {
return term;
}
/** returns the number of documents this term occurs in
* @see IndexReader#docFreq(String, BytesRef) */
- public int docFreq() {
+ public final int docFreq() {
return docFreq;
}
/** returns the total number of occurrences of this term
* @see IndexReader#totalTermFreq(String, BytesRef) */
- public long totalTermFreq() {
+ public final long totalTermFreq() {
return totalTermFreq;
}
}
Modified: lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/store/BufferedIndexInput.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/store/BufferedIndexInput.java?rev=1198350&r1=1198349&r2=1198350&view=diff
==============================================================================
--- lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/store/BufferedIndexInput.java (original)
+++ lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/store/BufferedIndexInput.java Sun Nov 6 12:30:27 2011
@@ -51,14 +51,17 @@ public abstract class BufferedIndexInput
return buffer[bufferPosition++];
}
- public BufferedIndexInput() {}
-
- public BufferedIndexInput(IOContext context) {
- this(bufferSize(context));
+ public BufferedIndexInput(String resourceDesc) {
+ this(resourceDesc, BUFFER_SIZE);
+ }
+
+ public BufferedIndexInput(String resourceDesc, IOContext context) {
+ this(resourceDesc, bufferSize(context));
}
/** Inits BufferedIndexInput with a specific bufferSize */
- public BufferedIndexInput(int bufferSize) {
+ public BufferedIndexInput(String resourceDesc, int bufferSize) {
+ super(resourceDesc);
checkBufferSize(bufferSize);
this.bufferSize = bufferSize;
}
Modified: lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/store/ChecksumIndexInput.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/store/ChecksumIndexInput.java?rev=1198350&r1=1198349&r2=1198350&view=diff
==============================================================================
--- lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/store/ChecksumIndexInput.java (original)
+++ lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/store/ChecksumIndexInput.java Sun Nov 6 12:30:27 2011
@@ -31,6 +31,7 @@ public class ChecksumIndexInput extends
Checksum digest;
public ChecksumIndexInput(IndexInput main) {
+ super("ChecksumIndexInput(" + main + ")");
this.main = main;
digest = new CRC32();
}
Modified: lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/store/CompoundFileDirectory.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/store/CompoundFileDirectory.java?rev=1198350&r1=1198349&r2=1198350&view=diff
==============================================================================
--- lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/store/CompoundFileDirectory.java (original)
+++ lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/store/CompoundFileDirectory.java Sun Nov 6 12:30:27 2011
@@ -139,7 +139,7 @@ public final class CompoundFileDirectory
if (firstInt < CompoundFileWriter.FORMAT_PRE_VERSION) {
if (firstInt < CompoundFileWriter.FORMAT_CURRENT) {
throw new CorruptIndexException("Incompatible format version: "
- + firstInt + " expected " + CompoundFileWriter.FORMAT_CURRENT);
+ + firstInt + " expected " + CompoundFileWriter.FORMAT_CURRENT + " (resource: " + stream + ")");
}
// It's a post-3.1 index, read the count.
count = stream.readVInt();
@@ -155,7 +155,7 @@ public final class CompoundFileDirectory
for (int i=0; i<count; i++) {
long offset = stream.readLong();
if (offset < 0 || offset > streamLength) {
- throw new CorruptIndexException("Invalid CFS entry offset: " + offset);
+ throw new CorruptIndexException("Invalid CFS entry offset: " + offset + " (resource: " + stream + ")");
}
String id = stream.readString();
@@ -218,7 +218,7 @@ public final class CompoundFileDirectory
if (entry == null) {
throw new IOException("No sub-file with id " + id + " found (fileName=" + name + " files: " + entries.keySet() + ")");
}
- return handle.openSlice(entry.offset, entry.length);
+ return handle.openSlice(name, entry.offset, entry.length);
}
/** Returns an array of strings, one for each file in the directory. */
@@ -318,13 +318,13 @@ public final class CompoundFileDirectory
}
@Override
- public IndexInput openSlice(long offset, long length) throws IOException {
- return handle.openSlice(entry.offset + offset, length);
+ public IndexInput openSlice(String sliceDescription, long offset, long length) throws IOException {
+ return handle.openSlice(sliceDescription, entry.offset + offset, length);
}
@Override
public IndexInput openFullSlice() throws IOException {
- return openSlice(0, entry.length);
+ return openSlice("full-slice", 0, entry.length);
}
};
}
Modified: lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/store/Directory.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/store/Directory.java?rev=1198350&r1=1198349&r2=1198350&view=diff
==============================================================================
--- lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/store/Directory.java (original)
+++ lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/store/Directory.java Sun Nov 6 12:30:27 2011
@@ -225,8 +225,8 @@ public abstract class Directory implemen
return new IndexInputSlicer() {
private final IndexInput base = Directory.this.openInput(name, context);
@Override
- public IndexInput openSlice(long offset, long length) {
- return new SlicedIndexInput(base, offset, length);
+ public IndexInput openSlice(String sliceDescription, long offset, long length) {
+ return new SlicedIndexInput("SlicedIndexInput(" + sliceDescription + " in " + base + ")", base, offset, length);
}
@Override
public void close() throws IOException {
@@ -258,7 +258,7 @@ public abstract class Directory implemen
/**
* Returns an {@link IndexInput} slice starting at the given offset with the given length.
*/
- public abstract IndexInput openSlice(long offset, long length) throws IOException;
+ public abstract IndexInput openSlice(String sliceDescription, long offset, long length) throws IOException;
/**
* Returns an {@link IndexInput} slice starting at offset <i>0</i> with a
@@ -275,12 +275,12 @@ public abstract class Directory implemen
long fileOffset;
long length;
- SlicedIndexInput(final IndexInput base, final long fileOffset, final long length) {
- this(base, fileOffset, length, BufferedIndexInput.BUFFER_SIZE);
+ SlicedIndexInput(final String sliceDescription, final IndexInput base, final long fileOffset, final long length) {
+ this(sliceDescription, base, fileOffset, length, BufferedIndexInput.BUFFER_SIZE);
}
- SlicedIndexInput(final IndexInput base, final long fileOffset, final long length, int readBufferSize) {
- super(readBufferSize);
+ SlicedIndexInput(final String sliceDescription, final IndexInput base, final long fileOffset, final long length, int readBufferSize) {
+ super("SlicedIndexInput(" + sliceDescription + " in " + base + " slice=" + fileOffset + ":" + (fileOffset+length) + ")", readBufferSize);
this.base = (IndexInput) base.clone();
this.fileOffset = fileOffset;
this.length = length;
Modified: lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/store/IndexInput.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/store/IndexInput.java?rev=1198350&r1=1198349&r2=1198350&view=diff
==============================================================================
--- lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/store/IndexInput.java (original)
+++ lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/store/IndexInput.java Sun Nov 6 12:30:27 2011
@@ -26,6 +26,18 @@ import java.io.IOException;
*/
public abstract class IndexInput extends DataInput implements Cloneable,Closeable {
+ private final String resourceDescription;
+
+ /** resourceDescription should be a non-null, opaque string
+ * describing this resource; it's returned from
+ * {@link #toString}. */
+ protected IndexInput(String resourceDescription) {
+ if (resourceDescription == null) {
+ throw new IllegalArgumentException("resourceDescription must not be null");
+ }
+ this.resourceDescription = resourceDescription;
+ }
+
/** Closes the stream to further operations. */
public abstract void close() throws IOException;
@@ -66,5 +78,9 @@ public abstract class IndexInput extends
numBytes -= toCopy;
}
}
-
+
+ @Override
+ public String toString() {
+ return resourceDescription;
+ }
}
Modified: lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/store/MMapDirectory.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/store/MMapDirectory.java?rev=1198350&r1=1198349&r2=1198350&view=diff
==============================================================================
--- lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/store/MMapDirectory.java (original)
+++ lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/store/MMapDirectory.java Sun Nov 6 12:30:27 2011
@@ -213,7 +213,7 @@ public class MMapDirectory extends FSDir
File f = new File(getDirectory(), name);
RandomAccessFile raf = new RandomAccessFile(f, "r");
try {
- return new MMapIndexInput(raf, 0, raf.length(), chunkSizePower);
+ return new MMapIndexInput("MMapIndexInput(path=\"" + f + "\")", raf, 0, raf.length(), chunkSizePower);
} finally {
raf.close();
}
@@ -221,7 +221,7 @@ public class MMapDirectory extends FSDir
public IndexInputSlicer createSlicer(final String name, final IOContext context) throws IOException {
ensureOpen();
- File f = new File(getDirectory(), name);
+ final File f = new File(getDirectory(), name);
final RandomAccessFile raf = new RandomAccessFile(f, "r");
return new IndexInputSlicer() {
@Override
@@ -230,13 +230,13 @@ public class MMapDirectory extends FSDir
}
@Override
- public IndexInput openSlice(long offset, long length) throws IOException {
- return new MMapIndexInput(raf, offset, length, chunkSizePower);
+ public IndexInput openSlice(String sliceDescription, long offset, long length) throws IOException {
+ return new MMapIndexInput("MMapIndexInput(" + sliceDescription + " in path=\"" + f + "\" slice=" + offset + ":" + (offset+length) + ")", raf, offset, length, chunkSizePower);
}
@Override
public IndexInput openFullSlice() throws IOException {
- return openSlice(0, raf.length());
+ return openSlice("full-slice", 0, raf.length());
}
};
}
@@ -256,8 +256,9 @@ public class MMapDirectory extends FSDir
private ByteBuffer curBuf; // redundant for speed: buffers[curBufIndex]
private boolean isClone = false;
-
- MMapIndexInput(RandomAccessFile raf, long offset, long length, int chunkSizePower) throws IOException {
+
+ MMapIndexInput(String resourceDescription, RandomAccessFile raf, long offset, long length, int chunkSizePower) throws IOException {
+ super(resourceDescription);
this.length = length;
this.chunkSizePower = chunkSizePower;
this.chunkSize = 1L << chunkSizePower;
@@ -296,8 +297,9 @@ public class MMapDirectory extends FSDir
} catch (BufferUnderflowException e) {
do {
curBufIndex++;
- if (curBufIndex >= buffers.length)
- throw new IOException("read past EOF");
+ if (curBufIndex >= buffers.length) {
+ throw new IOException("read past EOF: " + this);
+ }
curBuf = buffers[curBufIndex];
curBuf.position(0);
} while (!curBuf.hasRemaining());
@@ -316,8 +318,9 @@ public class MMapDirectory extends FSDir
len -= curAvail;
offset += curAvail;
curBufIndex++;
- if (curBufIndex >= buffers.length)
- throw new IOException("read past EOF");
+ if (curBufIndex >= buffers.length) {
+ throw new IOException("read past EOF: " + this);
+ }
curBuf = buffers[curBufIndex];
curBuf.position(0);
curAvail = curBuf.remaining();
@@ -369,13 +372,15 @@ public class MMapDirectory extends FSDir
this.curBufIndex = bi;
this.curBuf = b;
} catch (ArrayIndexOutOfBoundsException aioobe) {
- if (pos < 0L)
- throw new IllegalArgumentException("Seeking to negative position");
+ if (pos < 0L) {
+ throw new IllegalArgumentException("Seeking to negative position: " + this);
+ }
throw new IOException("seek past EOF");
} catch (IllegalArgumentException iae) {
- if (pos < 0L)
- throw new IllegalArgumentException("Seeking to negative position");
- throw new IOException("seek past EOF");
+ if (pos < 0L) {
+ throw new IllegalArgumentException("Seeking to negative position: " + this);
+ }
+ throw new IOException("seek past EOF: " + this);
}
}
@@ -386,8 +391,9 @@ public class MMapDirectory extends FSDir
@Override
public Object clone() {
- if (buffers == null)
- throw new AlreadyClosedException("MMapIndexInput already closed");
+ if (buffers == null) {
+ throw new AlreadyClosedException("MMapIndexInput already closed: " + this);
+ }
final MMapIndexInput clone = (MMapIndexInput)super.clone();
clone.isClone = true;
clone.buffers = new ByteBuffer[buffers.length];
@@ -399,7 +405,7 @@ public class MMapDirectory extends FSDir
try {
clone.seek(getFilePointer());
} catch(IOException ioe) {
- throw new RuntimeException("Should never happen", ioe);
+ throw new RuntimeException("Should never happen: " + this, ioe);
}
return clone;
}
Modified: lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/store/NIOFSDirectory.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/store/NIOFSDirectory.java?rev=1198350&r1=1198349&r2=1198350&view=diff
==============================================================================
--- lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/store/NIOFSDirectory.java (original)
+++ lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/store/NIOFSDirectory.java Sun Nov 6 12:30:27 2011
@@ -83,8 +83,8 @@ public class NIOFSDirectory extends FSDi
public IndexInputSlicer createSlicer(final String name,
final IOContext context) throws IOException {
ensureOpen();
- final File file = new File(getDirectory(), name);
- final Descriptor descriptor = new Descriptor(file, "r");
+ final File path = new File(getDirectory(), name);
+ final Descriptor descriptor = new Descriptor(path, "r");
return new Directory.IndexInputSlicer() {
@Override
@@ -93,14 +93,14 @@ public class NIOFSDirectory extends FSDi
}
@Override
- public IndexInput openSlice(long offset, long length) throws IOException {
- return new NIOFSIndexInput(descriptor, descriptor.getChannel(), offset,
+ public IndexInput openSlice(String sliceDescription, long offset, long length) throws IOException {
+ return new NIOFSIndexInput(sliceDescription, path, descriptor, descriptor.getChannel(), offset,
length, BufferedIndexInput.bufferSize(context), getReadChunkSize());
}
@Override
public IndexInput openFullSlice() throws IOException {
- return openSlice(0, descriptor.length);
+ return openSlice("full-slice", 0, descriptor.length);
}
};
}
@@ -115,12 +115,12 @@ public class NIOFSDirectory extends FSDi
final FileChannel channel;
public NIOFSIndexInput(File path, IOContext context, int chunkSize) throws IOException {
- super(path, context, chunkSize);
+ super("NIOFSIndexInput(path=\"" + path + "\")", path, context, chunkSize);
channel = file.getChannel();
}
- public NIOFSIndexInput(Descriptor file, FileChannel fc, long off, long length, int bufferSize, int chunkSize) throws IOException {
- super(file, off, length, bufferSize, chunkSize);
+ public NIOFSIndexInput(String sliceDescription, File path, Descriptor file, FileChannel fc, long off, long length, int bufferSize, int chunkSize) throws IOException {
+ super("NIOFSIndexInput(" + sliceDescription + " in path=\"" + path + "\" slice=" + off + ":" + (off+length) + ")", file, off, length, bufferSize, chunkSize);
channel = fc;
isClone = true;
}
@@ -181,7 +181,7 @@ public class NIOFSDirectory extends FSDi
long pos = getFilePointer() + off;
if (pos + len > end) {
- throw new IOException("read past EOF");
+ throw new IOException("read past EOF: " + this);
}
try {
@@ -209,6 +209,8 @@ public class NIOFSDirectory extends FSDi
+ "with a value smaller than the current chunk size (" + chunkSize + ")");
outOfMemoryError.initCause(e);
throw outOfMemoryError;
+ } catch (IOException ioe) {
+ throw new IOException(ioe.getMessage() + ": " + this, ioe);
}
}
}
Modified: lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/store/RAMDirectory.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/store/RAMDirectory.java?rev=1198350&r1=1198349&r2=1198350&view=diff
==============================================================================
--- lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/store/RAMDirectory.java (original)
+++ lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/store/RAMDirectory.java Sun Nov 6 12:30:27 2011
@@ -183,7 +183,7 @@ public class RAMDirectory extends Direct
if (file == null) {
throw new FileNotFoundException(name);
}
- return new RAMInputStream(file);
+ return new RAMInputStream(name, file);
}
/** Closes the store to future operations, releasing associated memory. */
Modified: lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/store/RAMInputStream.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/store/RAMInputStream.java?rev=1198350&r1=1198349&r2=1198350&view=diff
==============================================================================
--- lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/store/RAMInputStream.java (original)
+++ lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/store/RAMInputStream.java Sun Nov 6 12:30:27 2011
@@ -18,6 +18,7 @@ package org.apache.lucene.store;
*/
import java.io.IOException;
+import java.io.EOFException;
/** A memory-resident {@link IndexInput} implementation.
*
@@ -35,11 +36,12 @@ public class RAMInputStream extends Inde
private long bufferStart;
private int bufferLength;
- public RAMInputStream(RAMFile f) throws IOException {
+ public RAMInputStream(String name, RAMFile f) throws IOException {
+ super("RAMInputStream(name=" + name + ")");
file = f;
length = file.length;
if (length/BUFFER_SIZE >= Integer.MAX_VALUE) {
- throw new IOException("Too large RAMFile! "+length);
+ throw new IOException("RAMInputStream too large length=" + length + ": " + name);
}
// make sure that we switch to the
@@ -88,9 +90,9 @@ public class RAMInputStream extends Inde
bufferStart = (long) BUFFER_SIZE * (long) currentBufferIndex;
if (currentBufferIndex >= file.numBuffers()) {
// end of file reached, no more buffers left
- if (enforceEOF)
- throw new IOException("Read past EOF");
- else {
+ if (enforceEOF) {
+ throw new EOFException("Read past EOF: " + this);
+ } else {
// Force EOF if a read takes place at this position
currentBufferIndex--;
bufferPosition = BUFFER_SIZE;
Modified: lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/store/SimpleFSDirectory.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/store/SimpleFSDirectory.java?rev=1198350&r1=1198349&r2=1198350&view=diff
==============================================================================
--- lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/store/SimpleFSDirectory.java (original)
+++ lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/store/SimpleFSDirectory.java Sun Nov 6 12:30:27 2011
@@ -55,10 +55,9 @@ public class SimpleFSDirectory extends F
@Override
public IndexInput openInput(String name, IOContext context) throws IOException {
ensureOpen();
- return new SimpleFSIndexInput(new File(directory, name), context, getReadChunkSize());
+ final File path = new File(directory, name);
+ return new SimpleFSIndexInput("SimpleFSIndexInput(path=\"" + path.getPath() + "\")", path, context, getReadChunkSize());
}
-
-
public IndexInputSlicer createSlicer(final String name,
final IOContext context) throws IOException {
@@ -73,19 +72,18 @@ public class SimpleFSDirectory extends F
}
@Override
- public IndexInput openSlice(long offset, long length) throws IOException {
- return new SimpleFSIndexInput(descriptor, offset,
+ public IndexInput openSlice(String sliceDescription, long offset, long length) throws IOException {
+ return new SimpleFSIndexInput("SimpleFSIndexInput(" + sliceDescription + " in path=\"" + file.getPath() + "\" slice=" + offset + ":" + (offset+length) + ")", descriptor, offset,
length, BufferedIndexInput.bufferSize(context), getReadChunkSize());
}
@Override
public IndexInput openFullSlice() throws IOException {
- return openSlice(0, descriptor.length);
+ return openSlice("full-slice", 0, descriptor.length);
}
};
}
-
protected static class SimpleFSIndexInput extends BufferedIndexInput {
protected static class Descriptor extends RandomAccessFile {
@@ -117,16 +115,16 @@ public class SimpleFSDirectory extends F
protected final long off;
protected final long end;
- public SimpleFSIndexInput(File path, IOContext context, int chunkSize) throws IOException {
- super(context);
+ public SimpleFSIndexInput(String resourceDesc, File path, IOContext context, int chunkSize) throws IOException {
+ super(resourceDesc, context);
this.file = new Descriptor(path, "r");
this.chunkSize = chunkSize;
this.off = 0L;
this.end = file.length;
}
- public SimpleFSIndexInput(Descriptor file, long off, long length, int bufferSize, int chunkSize) throws IOException {
- super(bufferSize);
+ public SimpleFSIndexInput(String resourceDesc, Descriptor file, long off, long length, int bufferSize, int chunkSize) throws IOException {
+ super(resourceDesc, bufferSize);
this.file = file;
this.chunkSize = chunkSize;
this.off = off;
@@ -147,7 +145,7 @@ public class SimpleFSDirectory extends F
int total = 0;
if (position + len > end) {
- throw new IOException("read past EOF");
+ throw new IOException("read past EOF: " + this);
}
try {
@@ -172,6 +170,8 @@ public class SimpleFSDirectory extends F
+ "with a value smaller than the current chunk size (" + chunkSize + ")");
outOfMemoryError.initCause(e);
throw outOfMemoryError;
+ } catch (IOException ioe) {
+ throw new IOException(ioe.getMessage() + ": " + this, ioe);
}
}
}
Modified: lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/util/CodecUtil.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/util/CodecUtil.java?rev=1198350&r1=1198349&r2=1198350&view=diff
==============================================================================
--- lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/util/CodecUtil.java (original)
+++ lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/util/CodecUtil.java Sun Nov 6 12:30:27 2011
@@ -18,13 +18,13 @@ package org.apache.lucene.util;
*/
-import org.apache.lucene.store.DataInput;
-import org.apache.lucene.store.DataOutput;
+import java.io.IOException;
+
import org.apache.lucene.index.CorruptIndexException;
import org.apache.lucene.index.IndexFormatTooNewException;
import org.apache.lucene.index.IndexFormatTooOldException;
-
-import java.io.IOException;
+import org.apache.lucene.store.DataInput;
+import org.apache.lucene.store.DataOutput;
/**
* @lucene.experimental
@@ -56,20 +56,20 @@ public final class CodecUtil {
// Safety to guard against reading a bogus string:
final int actualHeader = in.readInt();
if (actualHeader != CODEC_MAGIC) {
- throw new CorruptIndexException("codec header mismatch: actual header=" + actualHeader + " vs expected header=" + CODEC_MAGIC);
+ throw new CorruptIndexException("codec header mismatch: actual header=" + actualHeader + " vs expected header=" + CODEC_MAGIC + " (resource: " + in + ")");
}
final String actualCodec = in.readString();
if (!actualCodec.equals(codec)) {
- throw new CorruptIndexException("codec mismatch: actual codec=" + actualCodec + " vs expected codec=" + codec);
+ throw new CorruptIndexException("codec mismatch: actual codec=" + actualCodec + " vs expected codec=" + codec + " (resource: " + in + ")");
}
final int actualVersion = in.readInt();
if (actualVersion < minVersion) {
- throw new IndexFormatTooOldException(null, actualVersion, minVersion, maxVersion);
+ throw new IndexFormatTooOldException(in, actualVersion, minVersion, maxVersion);
}
if (actualVersion > maxVersion) {
- throw new IndexFormatTooNewException(null, actualVersion, minVersion, maxVersion);
+ throw new IndexFormatTooNewException(in, actualVersion, minVersion, maxVersion);
}
return actualVersion;