jackrabbit-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ernest Evans (JIRA)" <j...@apache.org>
Subject [jira] Created: (JCR-195) ArrayIndexOutOfBounds thrown on re-index of repository
Date Tue, 23 Aug 2005 00:23:08 GMT
ArrayIndexOutOfBounds thrown on re-index of repository

         Key: JCR-195
         URL: http://issues.apache.org/jira/browse/JCR-195
     Project: Jackrabbit
        Type: Bug
  Components: query, xml  
    Versions: 1.0    
 Environment: Windows 2003, Java 1.5, Pentinum Xeon system
    Reporter: Ernest Evans
    Priority: Minor

I encountered a problem with the Lucene NodeIndexer when forcing the repository to re-index

Using the default repository.xml file provided with the examples contribution, I loaded a
number of PDF files using the sample application FSImport.  In this utility, the "encoding"
property is set to the empty string "" for all the files.  The system appeared to index everything
properly.  I then stopped the repository, deleted the index files and then restarted the repositoyr.
 Re-indexing was initiated and a "ArrayIndexOutOfBoundsException" was thrown from the org.apache.jackrabbit.core.query.lucene.NodeIndexer.java

The code in question:

                // jcr:encoding is not mandatory
                String encoding = null;
                if (node.hasPropertyName(JCR_ENCODING)) {
                    PropertyState encodingProp =
                            (PropertyState) stateProvider.getItemState(new PropertyId(node.getUUID(),


Expects the encodingProperty to be set if the property exists.  However, the node has the
property, but the XMLPersistenceManager did not create any entries in the property array.
 Either there is a problem in the XMLPersistenceManager (zero length string issues), or the
NodeIndexer needs to be altered to verify that there is actually a value for a particular

Since the jcr:encoding property is not considered a multi-value property, the requirement
to check for an initialized array is probably not the correct route.

Looking at the code for the XMLPersistenceManager readState(DOMWalker walker, PropertyState
state) method (line 294), it indicates that if the content length for a property is zero,
the property will not have a value added.  However, our encoding property is configured as
the empty string and should be created.  Therefore, a suggested alteration is to check if
the property is a string, and, even if zero length, add the property value.

        ArrayList values = new ArrayList();
        if (walker.enterElement(VALUES_ELEMENT)) {
            while (walker.iterateElements(VALUE_ELEMENT)) {
                // read serialized value
                String content = walker.getContent();
                if ((content.length() > 0) || (PropertyType.STRING == type)) {   // <====
suggested update
                    if (type == PropertyType.BINARY) {
                        // special handling required for binary value:
                        // the value stores the path to the actual binary file in the blob
                        try {
                            values.add(InternalValue.create(new FileSystemResource(blobStore,
                        } catch (IOException ioe) {
                            String msg = "error while reading serialized binary value";
                            throw new ItemStateException(msg, ioe);
                    } else {
                        values.add(InternalValue.valueOf(content, type));

This message is automatically generated by JIRA.
If you think it was sent incorrectly contact one of the administrators:
For more information on JIRA, see:

View raw message