Uploaded image for project: 'ModeShape'
  1. ModeShape
  2. MODE-1738

SELECT ... JOIN ... ORDER BY array index out of bounds exception

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Critical
    • 3.1.0.Final
    • 3.0.1.Final
    • Query
    • None

    Description

      The following query

      SELECT s.[inf:name] FROM [inf:patient] AS p JOIN [inf:section] AS s ON ISCHILDNODE(s, p) WHERE p.[inf:masterNs] = $ns AND p.[inf:masterId] = $urno ORDER BY s.[inf:name]
      

      gives a class cast exception

      java.lang.IndexOutOfBoundsException: Index: 19, Size: 1
              at java.util.ArrayList.RangeCheck(ArrayList.java:547)
              at java.util.ArrayList.get(ArrayList.java:322)
              at java.util.Collections$UnmodifiableList.get(Collections.java:1152)
              at org.modeshape.jcr.query.process.ProcessingComponent.createDynamicOperation(ProcessingComponent.java:160)
              at org.modeshape.jcr.query.process.SortValuesComponent.createSortComparator(SortValuesComponent.java:127)
              at org.modeshape.jcr.query.process.SortValuesComponent.createSortComparator(SortValuesComponent.java:83)
              at org.modeshape.jcr.query.process.SortValuesComponent.<init>(SortValuesComponent.java:53)
              at org.modeshape.jcr.query.process.QueryProcessor.createComponent(QueryProcessor.java:346)
              at org.modeshape.jcr.query.process.QueryProcessor.execute(QueryProcessor.java:88)
              at org.modeshape.jcr.query.process.QueryEngine.execute(QueryEngine.java:140)
              at org.modeshape.jcr.query.lucene.LuceneQueryEngine$1.getResults(LuceneQueryEngine.java:151)
              at org.modeshape.jcr.query.JcrQuery.execute(JcrQuery.java:119)
              at au.com.infomedix.modeshapetest.AppTest.testJoinAndOrderBy(AppTest.java:87)
              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
              at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
              at java.lang.reflect.Method.invoke(Method.java:597)
              at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45)
              at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
              at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42)
              at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
              at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
              at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:30)
              at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263)
              at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:68)
              at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47)
              at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
              at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
              at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
              at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
              at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
              at org.junit.runners.ParentRunner.run(ParentRunner.java:300)
              at org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:53)
              at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:123)
              at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:104)
              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
              at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
              at java.lang.reflect.Method.invoke(Method.java:597)
              at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:164)
              at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:110)
              at org.apache.maven.surefire.booter.SurefireStarter.invokeProvider(SurefireStarter.java:175)
              at org.apache.maven.surefire.booter.SurefireStarter.runSuitesInProcessWhenForked(SurefireStarter.java:107)
              at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:68)
      

      See the attached test case that shows a working query without orderby and the same query with an orderby that gets the exception.

      Attachments

        Activity

          People

            rhauch Randall Hauch (Inactive)
            bwallis42_jira Brian Wallis (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: