Menu

#80 IndexOutOfBoundsException ?

open
nobody
None
5
2007-11-26
2007-11-26
Anonymous
No

Sometimes, i got the following exception:
(Is this a bug in cobertura?)

coverage:

[exec] Exception in thread "Thread-3" java.lang.IndexOutOfBoundsException: Index: 0, Size: 1

[exec] at java.util.ArrayList.RangeCheck(Unknown Source)
[exec] at java.util.ArrayList.get(Unknown Source)
[exec] at net.sourceforge.cobertura.coveragedata.LineData.getJumpData(LineData.java:316)
[exec] at net.sourceforge.cobertura.coveragedata.LineData.touchJump(LineData.java:259)

Discussion

  • Jiri Mares

    Jiri Mares - 2007-11-26

    Logged In: YES
    user_id=819956
    Originator: NO

    This is really strange .. also from the exception it looks everything is alright ... It would be better to discuss in mailing list ... it happens sometimes, everytime??

     
  • Nobody/Anonymous

    Logged In: NO

    Hi,
    I have also seen this. Unfortunately I cannot consistently reproduce it. Stack trace is:

    [jacorb-junit] Exception in thread "RequestProcessor-4" java.lang.IndexOutOfBoundsException: Index: 0, Size: 1
    [jacorb-junit] at java.util.ArrayList.RangeCheck(ArrayList.java:546)
    [jacorb-junit] at java.util.ArrayList.get(ArrayList.java:321)
    [jacorb-junit] at net.sourceforge.cobertura.coveragedata.LineData.getSwitchData(LineData.java:334)
    [jacorb-junit] at net.sourceforge.cobertura.coveragedata.LineData.touchSwitch(LineData.java:264)
    [jacorb-junit] at net.sourceforge.cobertura.coveragedata.ClassData.touchSwitch(ClassData.java:467)

     
  • Jiri Mares

    Jiri Mares - 2007-12-03

    Logged In: YES
    user_id=819956
    Originator: NO

    Aren't you running tests in mutli-threaded environment?

     
  • Nobody/Anonymous

    Logged In: NO

    I have similar bug. It happened inside thread, started from test case

    The more complete exception stack trace looks like:

    java.lang.IndexOutOfBoundsException: Index: 0, Size: 1
    at java.util.ArrayList.RangeCheck(ArrayList.java:546)
    at java.util.ArrayList.get(ArrayList.java:321)
    at net.sourceforge.cobertura.coveragedata.LineData.getJumpData(LineData.java:316)
    at net.sourceforge.cobertura.coveragedata.LineData.touchJump(LineData.java:259)
    at net.sourceforge.cobertura.coveragedata.ClassData.touchJump(ClassData.java:453)

     
  • Jiri Mares

    Jiri Mares - 2007-12-21

    Logged In: YES
    user_id=819956
    Originator: NO

    As I think the cobertura coverage collection is not thread safe at the moment ...

     
  • Michael Koch

    Michael Koch - 2008-01-22

    Logged In: YES
    user_id=243486
    Originator: NO

    The same happens to me sometimes in a java.util.Timer thread, so thread safety may really be an issue.

    Exception in thread "Timer-0" java.lang.IndexOutOfBoundsException: Index: 0, Size: 1
    at java.util.ArrayList.RangeCheck(ArrayList.java:547)
    at java.util.ArrayList.get(ArrayList.java:322)
    at net.sourceforge.cobertura.coveragedata.LineData.getJumpData(LineData.java:316)
    at net.sourceforge.cobertura.coveragedata.LineData.touchJump(LineData.java:259)
    at net.sourceforge.cobertura.coveragedata.ClassData.touchJump(ClassData.java:453)
    at de.rowa.nadis.remote.CallbackProxy$CallbackInvocationHandler.invoke(CallbackProxy.java:239)
    at $Proxy2.isAlive(Unknown Source)
    at de.rowa.nadis.remote.CallbackProxy.checkConnection(CallbackProxy.java:165)
    at de.rowa.nadis.remote.ConnectionMonitor$ConnectionMonitorTask.run(ConnectionMonitor.java:95)
    at java.util.TimerThread.mainLoop(Timer.java:512)
    at java.util.TimerThread.run(Timer.java:462)

     
  • Gary Levin

    Gary Levin - 2008-05-20

    Logged In: YES
    user_id=304909
    Originator: NO

    We have seen the same problem as this one. It does make Cobertura much less useful. If this is being discussed elsewhere, can someone provide a pointer to the forum? Thanks.

     
  • Jiri Mares

    Jiri Mares - 2008-05-22

    Logged In: YES
    user_id=819956
    Originator: NO

    Aren't you running in multi-threaded environment?

     
  • Gary Levin

    Gary Levin - 2008-05-22

    Logged In: YES
    user_id=304909
    Originator: NO

    We are running a multi-threaded program.

    * Is there an option for Cobertura to inform it that the program is multi-threaded?

    * Is the code generated (injected) by Cobertura thread-safe, or does it depend on the thread-safety of the programs being instrumented?

    The error we are seeing is occurring in a constructor, which should by its nature be thread-safe.

    Thanks for monitoring this problem.

     
  • Jiri Mares

    Jiri Mares - 2008-05-22

    Logged In: YES
    user_id=819956
    Originator: NO

    Unfortunately, at the moment the coverage data objects are not multi-thread-aware :-(

     
  • Anonymous

    Anonymous - 2008-10-06

    java.lang.IndexOutOfBoundsException: Index: 0, Size: 2
    at java.util.ArrayList.RangeCheck(ArrayList.java:546)
    at java.util.ArrayList.get(ArrayList.java:321)
    at net.sourceforge.cobertura.coveragedata.LineData.getJumpData(LineData.java:316)
    at net.sourceforge.cobertura.coveragedata.LineData.touchJump(LineData.java:259)
    at net.sourceforge.cobertura.coveragedata.ClassData.touchJump(ClassData.java:453)

     
  • Anonymous

    Anonymous - 2010-11-24

    I am experiencing exactly the same issue with Sonar 2.4, Cobertura 1.9.4.1.

    I am using multiple threads in my test.

    I found someone who did a detailed analysis of this problem and proposed a solution here:

    http://old.nabble.com/Cobertura-1.9-potential-threading-bug-fix-td19326045.html

    Since I am getting this error on every second build, this is pretty much making Cobertura unusable for me. Could we bump up the priority on this?

     

    Last edit: Anonymous 2017-03-23

Log in to post a comment.