Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-4937

Sorting an ObservableList instance results in IndexOutOfBoundsException

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.8.0
    • 1.8.2, 1.9-beta-3, 1.7.11
    • None
    • None

    Description

      Reported at the Griffon user ML

      l = [1, 4, 2] as ObservableList
      l.sort()
      

      results in

      java.lang.IndexOutOfBoundsException: Index: 3, Size: 3
      	at java.util.ArrayList.RangeCheck(ArrayList.java:547)
      	at java.util.ArrayList.set(ArrayList.java:337)
      	at groovy.util.ObservableList.set(ObservableList.java:349)
      	at groovy.util.ObservableList$ObservableListIterator.set(ObservableList.java:439)
      	at java.util.Collections.sort(Collections.java:163)
      	at org.codehaus.groovy.runtime.DefaultGroovyMethods.sort(DefaultGroovyMethods.java:5918)
      	at org.codehaus.groovy.runtime.dgm$595.invoke(Unknown Source)
      	at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite$PojoMetaMethodSiteNoUnwrapNoCoerce.invoke(PojoMetaMethodSite.java:271)
      	at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite.call(PojoMetaMethodSite.java:53)
      	at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:42)
      	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
      	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:112)
      	at ConsoleScript3.run(ConsoleScript3:2)
      	at groovy.lang.GroovyShell.runScriptOrMainOrTestOrRunnable(GroovyShell.java:266)
      	at groovy.lang.GroovyShell.run(GroovyShell.java:517)
      	at groovy.lang.GroovyShell.run(GroovyShell.java:172)
      	at groovy.lang.GroovyShell$run.call(Unknown Source)
      	at groovy.ui.Console$_runScriptImpl_closure16.doCall(Console.groovy:910)
      	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.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90)
      	at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233)
      	at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:272)
      	at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:885)
      	at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.callCurrent(PogoMetaClassSite.java:66)
      	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:141)
      	at groovy.ui.Console$_runScriptImpl_closure16.doCall(Console.groovy)
      	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.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90)
      	at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233)
      	at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:272)
      	at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:885)
      	at groovy.lang.Closure.call(Closure.java:405)
      	at groovy.lang.Closure.call(Closure.java:399)
      	at groovy.lang.Closure.run(Closure.java:483)
      	at java.lang.Thread.run(Thread.java:680)
      

      Attachments

        1. groovy-4937.patch
          2 kB
          Tim Yates

        Activity

          People

            paulk Paul King
            aalmiray Andres Almiray
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: