jackrabbit-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Julian Reschke (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (JCR-3082) occasional index out of bounds exception while running UserManagerImplTest.testPrincipalNameEqualsUserID
Date Thu, 22 Sep 2011 15:40:26 GMT

    [ https://issues.apache.org/jira/browse/JCR-3082?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13112659#comment-13112659
] 

Julian Reschke commented on JCR-3082:
-------------------------------------

This seems to be caused by

    @Override
    public int nextDoc() throws IOException {
        while (currentDoc != NO_MORE_DOCS) {
            if (scorers[currentScorer].nextDoc() != NO_MORE_DOCS) {
                currentDoc = scorers[currentScorer].docID() + starts[currentScorer];
                return currentDoc;
            } else if (++currentScorer < scorers.length) {
                // advance to next scorer
            } else {
                // no more scorers
                currentDoc = NO_MORE_DOCS;
            }
        }

        return currentDoc;
    }

which allows currentScorer to go beyond scorers.length and

    @Override
    public float score() throws IOException {
        return scorers[currentScorer].score();
    }

which assumes it is in-range.

Not sure whether the caller is supposed to call score() when the object is in this state.

Changing it to

    @Override
    public int nextDoc() throws IOException {
        while (currentDoc != NO_MORE_DOCS) {
            if (scorers[currentScorer].nextDoc() != NO_MORE_DOCS) {
                currentDoc = scorers[currentScorer].docID() + starts[currentScorer];
                return currentDoc;
            } else if (currentScorer + 1 < scorers.length) {
                // advance to next scorer
               currentScorer += 1;
            } else {
                // no more scorers
                currentDoc = NO_MORE_DOCS;
            }
        }

        return currentDoc;
    }

fixes the runtime exception, but I'm not totally sure about the correctness.

> occasional index out of bounds exception while running UserManagerImplTest.testPrincipalNameEqualsUserID
> --------------------------------------------------------------------------------------------------------
>
>                 Key: JCR-3082
>                 URL: https://issues.apache.org/jira/browse/JCR-3082
>             Project: Jackrabbit Content Repository
>          Issue Type: Bug
>          Components: jackrabbit-core
>            Reporter: Julian Reschke
>            Assignee: Julian Reschke
>
> Stack trace:
> java.lang.ArrayIndexOutOfBoundsException: 8
> 	at org.apache.jackrabbit.core.query.lucene.MultiScorer.score(MultiScorer.java:89)
> 	at org.apache.lucene.search.ConjunctionScorer.score(ConjunctionScorer.java:133)
> 	at org.apache.lucene.search.BooleanScorer2$2.score(BooleanScorer2.java:182)
> 	at org.apache.lucene.search.BooleanScorer2.score(BooleanScorer2.java:303)
> 	at org.apache.jackrabbit.core.query.lucene.LuceneQueryHits.nextScoreNode(LuceneQueryHits.java:68)
> 	at org.apache.jackrabbit.core.query.lucene.QueryHitsAdapter.nextScoreNodes(QueryHitsAdapter.java:54)
> 	at org.apache.jackrabbit.core.query.lucene.FilterMultiColumnQueryHits.nextScoreNodes(FilterMultiColumnQueryHits.java:63)
> 	at org.apache.jackrabbit.core.query.lucene.QueryResultImpl.collectScoreNodes(QueryResultImpl.java:328)
> 	at org.apache.jackrabbit.core.query.lucene.QueryResultImpl.getResults(QueryResultImpl.java:291)
> 	at org.apache.jackrabbit.core.query.lucene.SingleColumnQueryResult.<init>(SingleColumnQueryResult.java:66)
> 	at org.apache.jackrabbit.core.query.lucene.QueryImpl.execute(QueryImpl.java:134)
> 	at org.apache.jackrabbit.core.query.QueryImpl$1.perform(QueryImpl.java:130)
> 	at org.apache.jackrabbit.core.query.QueryImpl$1.perform(QueryImpl.java:1)
> 	at org.apache.jackrabbit.core.session.SessionState.perform(SessionState.java:200)
> 	at org.apache.jackrabbit.core.query.QueryImpl.execute(QueryImpl.java:126)
> 	at org.apache.jackrabbit.core.security.user.IndexNodeResolver.findNodes(IndexNodeResolver.java:109)
> 	at org.apache.jackrabbit.core.security.user.UserManagerImpl.findAuthorizables(UserManagerImpl.java:498)
> 	at org.apache.jackrabbit.core.security.user.UserManagerImpl.findAuthorizables(UserManagerImpl.java:462)
> 	at org.apache.jackrabbit.core.security.user.UserManagerImplTest.testFindAuthorizableByRelativePath(UserManagerImplTest.java:560)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
> 	at java.lang.reflect.Method.invoke(Unknown Source)
> 	at junit.framework.TestCase.runTest(TestCase.java:154)
> 	at junit.framework.TestCase.runBare(TestCase.java:127)
> 	at junit.framework.TestResult$1.protect(TestResult.java:106)
> 	at junit.framework.TestResult.runProtected(TestResult.java:124)
> 	at junit.framework.TestResult.run(TestResult.java:109)
> 	at junit.framework.TestCase.run(TestCase.java:118)
> 	at org.apache.jackrabbit.test.AbstractJCRTest.run(AbstractJCRTest.java:456)
> 	at junit.framework.TestSuite.runTest(TestSuite.java:208)
> 	at junit.framework.TestSuite.run(TestSuite.java:203)
> 	at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
> 	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message