You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@felix.apache.org by "Bram Pouwelse (JIRA)" <ji...@apache.org> on 2015/11/16 20:03:10 UTC

[jira] [Created] (FELIX-5103) ArrayIndexOutOfBoundsException during bundle update

Bram Pouwelse created FELIX-5103:
------------------------------------

             Summary: ArrayIndexOutOfBoundsException during bundle update
                 Key: FELIX-5103
                 URL: https://issues.apache.org/jira/browse/FELIX-5103
             Project: Felix
          Issue Type: Bug
          Components: Framework
    Affects Versions: framework-5.2.0, framework-4.2.1
            Reporter: Bram Pouwelse


I have traces like the one below quite often when bndtools is updating bundles in a running framework.  

{code}
! Error in updating the framework from the properties: Index: 0, Size: 0
! Bundle files does not exist: /Users/brampouwelse/git-repos/path/to/project/generated/mybundle.jar
ERROR: Bundle mybundle [251] Unable to update the bundle. (java.lang.IndexOutOfBoundsException: Index: 0, Size: 0)
java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
    at java.util.ArrayList.rangeCheck(ArrayList.java:653)
    at java.util.ArrayList.get(ArrayList.java:429)
    at org.apache.felix.framework.BundleImpl.adapt(BundleImpl.java:1064)
    at org.apache.felix.framework.BundleImpl.getSymbolicName(BundleImpl.java:896)
    at org.apache.felix.framework.BundleImpl.createRevision(BundleImpl.java:1226)
    at org.apache.felix.framework.BundleImpl.revise(BundleImpl.java:1141)
    at org.apache.felix.framework.Felix.updateBundle(Felix.java:2282)
    at org.apache.felix.framework.BundleImpl.update(BundleImpl.java:973)
    at org.apache.felix.framework.BundleImpl.update(BundleImpl.java:960)
    at aQute.launcher.Launcher.synchronizeFiles(Launcher.java:534)
    at aQute.launcher.Launcher.update(Launcher.java:405)
    at aQute.launcher.Launcher$1.run(Launcher.java:194)
    at java.util.TimerThread.mainLoop(Timer.java:555)
    at java.util.TimerThread.run(Timer.java:505)
! Failed to update bundle /Users/brampouwelse/git-repos/path/to/project/generated/mybundle.jar, exception Update of bundle mybundle [251] failed.
java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
    at java.util.ArrayList.rangeCheck(ArrayList.java:653)
    at java.util.ArrayList.get(ArrayList.java:429)
    at org.apache.felix.framework.BundleImpl.adapt(BundleImpl.java:1064)
ERROR: Bundle myotherbundle [252] Unable to update the bundle. (java.lang.IndexOutOfBoundsException: Index: 0, Size: 0)
    at org.apache.felix.framework.BundleImpl.getSymbolicName(BundleImpl.java:896)
    at org.apache.felix.framework.BundleImpl.createRevision(BundleImpl.java:1226)
    at org.apache.felix.framework.BundleImpl.revise(BundleImpl.java:1141)
    at org.apache.felix.framework.Felix.updateBundle(Felix.java:2282)
    at org.apache.felix.framework.BundleImpl.update(BundleImpl.java:973)
    at org.apache.felix.framework.BundleImpl.update(BundleImpl.java:960)
    at aQute.launcher.Launcher.synchronizeFiles(Launcher.java:534)
    at aQute.launcher.Launcher.update(Launcher.java:405)
    at aQute.launcher.Launcher$1.run(Launcher.java:194)
    at java.util.TimerThread.mainLoop(Timer.java:555)
    at java.util.TimerThread.run(Timer.java:505)
! Failed to update bundle /Users/brampouwelse/git-repos/path/to/project/generated/myotherbundle.jar, exception Update of bundle myotherbundle [252] failed.
{code}

Just had a look at the Felix code and this part is interesting. 

{code:title=BundleImpl.java}
    synchronized void revise(String location, InputStream is)
        throws Exception
    {
        // This operation will increase the revision count for the bundle.
        m_archive.revise(location, is);
        try
        {
            BundleRevision revision = createRevision(true);
            addRevision(revision);
        }
        catch (Exception ex)
        {
            m_archive.rollbackRevise();
            throw ex;
        }
    }
{code}

If the {{createRevision}} call throws an exception {{m_archive.rollbackRevise()}} is called this is removing revision at index 0 but the new revision was never added so it's removing the current revision instead of the new revision.  



Link to the bndtools issue: https://github.com/bndtools/bndtools/issues/1217



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)