jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mreut...@apache.org
Subject svn commit: r924224 - in /jackrabbit/trunk/jackrabbit-core/src: main/java/org/apache/jackrabbit/core/query/lucene/AbstractExcerpt.java test/java/org/apache/jackrabbit/core/query/IndexingRuleTest.java
Date Wed, 17 Mar 2010 11:10:31 GMT
Author: mreutegg
Date: Wed Mar 17 11:10:30 2010
New Revision: 924224

URL: http://svn.apache.org/viewvc?rev=924224&view=rev
Log:
JCR-2574: Row.getValue("rep:excerpt(.)") may throw ArrayIndexOutOfBoundsException

Modified:
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/AbstractExcerpt.java
    jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/query/IndexingRuleTest.java

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/AbstractExcerpt.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/AbstractExcerpt.java?rev=924224&r1=924223&r2=924224&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/AbstractExcerpt.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/AbstractExcerpt.java
Wed Mar 17 11:10:30 2010
@@ -98,7 +98,7 @@ public abstract class AbstractExcerpt im
                 tDocs.close();
             }
             Fieldable[] fields = doc.getFieldables(FieldNames.FULLTEXT);
-            if (fields == null) {
+            if (fields.length == 0) {
                 log.debug("Fulltext field not stored, using {}",
                         SimpleExcerptProvider.class.getName());
                 SimpleExcerptProvider exProvider = new SimpleExcerptProvider();

Modified: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/query/IndexingRuleTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/query/IndexingRuleTest.java?rev=924224&r1=924223&r2=924224&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/query/IndexingRuleTest.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/query/IndexingRuleTest.java
Wed Mar 17 11:10:30 2010
@@ -20,6 +20,7 @@ import javax.jcr.RepositoryException;
 import javax.jcr.Node;
 import javax.jcr.NodeIterator;
 import javax.jcr.Value;
+import javax.jcr.query.QueryResult;
 import javax.jcr.query.RowIterator;
 import java.util.List;
 import java.util.ArrayList;
@@ -122,4 +123,17 @@ public class IndexingRuleTest extends Ab
         assertTrue("Title must not be present in excerpt",
                 excerpt.getString().indexOf("Apache") == -1);
     }
+
+    public void testExcerptOnExcludedProperty() throws RepositoryException {
+        Node node = testRootNode.addNode(nodeName1, NT_UNSTRUCTURED);
+        node.setProperty("rule", "excerpt");
+        node.setProperty("title", TEXT);
+        testRootNode.save();
+        String stmt = "/jcr:root" + testRootNode.getPath() +
+                "/*[jcr:contains(., 'quick')]/rep:excerpt(.)";
+        QueryResult result = executeQuery(stmt);
+        checkResult(result, new Node[]{node});
+        Value excerpt = result.getRows().nextRow().getValue("rep:excerpt(.)");
+        assertNotNull("No excerpt created", excerpt);
+    }
 }



Mime
View raw message