jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mreut...@apache.org
Subject svn commit: r796757 - /jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/SearchIndex.java
Date Wed, 22 Jul 2009 14:55:30 GMT
Author: mreutegg
Date: Wed Jul 22 14:55:29 2009
New Revision: 796757

URL: http://svn.apache.org/viewvc?rev=796757&view=rev
Log:
JCR-2222: Unclosed files when aggregated property states are indexed

Modified:
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/SearchIndex.java

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/SearchIndex.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/SearchIndex.java?rev=796757&r1=796756&r2=796757&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/SearchIndex.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/SearchIndex.java
Wed Jul 22 14:55:29 2009
@@ -1315,24 +1315,28 @@
                             String namePrefix = FieldNames.createNamedValue(getNamespaceMappings().translateName(propState.getName()),
"");
                             NodeState parent = (NodeState) ism.getItemState(propState.getParentId());
                             Document aDoc = createDocument(parent, getNamespaceMappings(),
getIndex().getIndexFormatVersion());
-                            // find the right fields to transfer
-                            Fieldable[] fields = aDoc.getFieldables(FieldNames.PROPERTIES);
-                            Token t = new Token();
-                            for (Fieldable field : fields) {
-                                // assume properties fields use SingleTokenStream
-                                t = field.tokenStreamValue().next(t);
-                                String value = new String(t.termBuffer(), 0, t.termLength());
-                                if (value.startsWith(namePrefix)) {
-                                    // extract value
-                                    value = value.substring(namePrefix.length());
-                                    // create new named value
-                                    Path p = getRelativePath(state, propState);
-                                    String path = getNamespaceMappings().translatePath(p);
-                                    value = FieldNames.createNamedValue(path, value);
-                                    t.setTermBuffer(value);
-                                    doc.add(new Field(field.name(), new SingletonTokenStream(t)));
-                                    doc.add(new Field(FieldNames.AGGREGATED_NODE_UUID, parent.getNodeId().toString(),
Field.Store.NO, Field.Index.NOT_ANALYZED_NO_NORMS));
+                            try {
+                                // find the right fields to transfer
+                                Fieldable[] fields = aDoc.getFieldables(FieldNames.PROPERTIES);
+                                Token t = new Token();
+                                for (Fieldable field : fields) {
+                                    // assume properties fields use SingleTokenStream
+                                    t = field.tokenStreamValue().next(t);
+                                    String value = new String(t.termBuffer(), 0, t.termLength());
+                                    if (value.startsWith(namePrefix)) {
+                                        // extract value
+                                        value = value.substring(namePrefix.length());
+                                        // create new named value
+                                        Path p = getRelativePath(state, propState);
+                                        String path = getNamespaceMappings().translatePath(p);
+                                        value = FieldNames.createNamedValue(path, value);
+                                        t.setTermBuffer(value);
+                                        doc.add(new Field(field.name(), new SingletonTokenStream(t)));
+                                        doc.add(new Field(FieldNames.AGGREGATED_NODE_UUID,
parent.getNodeId().toString(), Field.Store.NO, Field.Index.NOT_ANALYZED_NO_NORMS));
+                                    }
                                 }
+                            } finally {
+                                Util.disposeDocument(aDoc);
                             }
                         }
                     }



Mime
View raw message