java.lang.ArrayIndexOutOfBoundsException: -31163

Atlassian JIRA | Brenden Bain [Atlassian] | 5 years ago
  1. Speed up your debug routine!

    Automated exception search integrated into your IDE

  2. 0

    This exception occurs in the BND tool while scanning the classes in order to calculate the package imports. {code} 2011-05-26 15:20:53,323 main INFO [atlassian.plugin.loaders.ScanningPluginLoader] Plugin Unit: /source/com/atlassian/studio/trunk/studio-fireball/target/home/jira-home/plugins/.bundled-plugins/jira-ical-feed-1.0.jar (1303156310000) created java.lang.ArrayIndexOutOfBoundsException: -31163 at aQute.lib.osgi.Clazz.parseClassFile(Clazz.java:213) at aQute.lib.osgi.Clazz.<init>(Clazz.java:65) at aQute.lib.osgi.Processor.analyzeJar(Processor.java:159) at aQute.lib.osgi.Processor.analyzeBundleClasspath(Processor.java:97) at aQute.lib.osgi.Analyzer.analyze(Analyzer.java:194) at aQute.lib.osgi.Builder.analyze(Builder.java:94) at aQute.lib.osgi.Analyzer.calcManifest(Analyzer.java:293) at com.atlassian.plugin.osgi.factory.transform.stage.GenerateManifestStage.execute(GenerateManifestStage.java:154) at com.atlassian.plugin.osgi.factory.transform.DefaultPluginTransformer.transform(DefaultPluginTransformer.java:200) at com.atlassian.plugin.osgi.factory.OsgiPluginFactory.createOsgiPluginJar(OsgiPluginFactory.java:302) at com.atlassian.plugin.osgi.factory.OsgiPluginFactory.create(OsgiPluginFactory.java:250) at com.atlassian.plugin.loaders.ScanningPluginLoader.deployPluginFromUnit(ScanningPluginLoader.java:116) at com.atlassian.plugin.loaders.ScanningPluginLoader.loadAllPlugins(ScanningPluginLoader.java:89) at com.atlassian.plugin.manager.DefaultPluginManager.init(DefaultPluginManager.java:150) at com.atlassian.jira.plugin.JiraPluginManager.start(JiraPluginManager.java:59) at com.atlassian.jira.ComponentManager$PluginSystem.start(ComponentManager.java:1380) at com.atlassian.jira.ComponentManager.quickStart(ComponentManager.java:254) at com.atlassian.jira.ComponentManager.start(ComponentManager.java:237) at com.atlassian.jira.upgrade.ConsistencyLauncher.launchConsistencyChecker(ConsistencyLauncher.java:61) at com.atlassian.jira.upgrade.ConsistencyLauncher.start(ConsistencyLauncher.java:39) at com.atlassian.jira.startup.DefaultJiraLauncher.start(DefaultJiraLauncher.java:39) at com.atlassian.jira.startup.LauncherContextListener$1.create(LauncherContextListener.java:57) at com.atlassian.jira.startup.LauncherContextListener$1.create(LauncherContextListener.java:52) at com.atlassian.multitenant.impl.MultiTenantComponentMapImpl.get(MultiTenantComponentMapImpl.java:121) at com.atlassian.multitenant.impl.MultiTenantComponentMapImpl.onTenantStart(MultiTenantComponentMapImpl.java:165) at com.atlassian.multitenant.impl.DefaultMultiTenantManager$1.consume(DefaultMultiTenantManager.java:134) at com.atlassian.multitenant.impl.DefaultMultiTenantManager$1.consume(DefaultMultiTenantManager.java:131) at com.atlassian.multitenant.impl.DefaultMultiTenantManager.runForEachListener(DefaultMultiTenantManager.java:256) at com.atlassian.multitenant.impl.DefaultMultiTenantManager.startTenant(DefaultMultiTenantManager.java:130) at com.atlassian.multitenant.impl.DefaultMultiTenantManager.startAll(DefaultMultiTenantManager.java:203) at com.atlassian.jira.startup.LauncherContextListener.contextInitialized(LauncherContextListener.java:85) at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3934) at org.apache.catalina.core.StandardContext.start(StandardContext.java:4429) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045) at org.apache.catalina.core.StandardHost.start(StandardHost.java:722) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045) at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443) at org.apache.catalina.core.StandardService.start(StandardService.java:516) at org.apache.catalina.core.StandardServer.start(StandardServer.java:710) at org.apache.catalina.startup.Catalina.start(Catalina.java:583) 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.catalina.startup.Bootstrap.start(Bootstrap.java:288) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413) {code} -I attached the com.atlassian.jira.extra:jira-ical-feed:1.0 artifact causing the problem, maybe it helps isolating the bug in BND or to improve the exception handling.- Edit (BRENDEN): This is actually caused when generating the OSGi manafest in JIM (and not the ical plugin like we have thought). After talking to Pawel Niewiadomski it looks like he has seen this error for a while and it causes not problems for JIM. The exception is thrown while trying to process "org/sqlite/SQLite" for its dependencies. BND actually catches the exception logs it and then continues onto the other classes in the plugin. This causes no problems for JIM because SQLite has no external dependencies. This is a bug in the bndlib that we ship in JIRA (0.0.255) and the one used by AMPS (0.0.311). It appears to be fixed in (0.0.357). There in BND there is a class called {{Clazz}} that is designed to parse a Java Class File. It does this: {code} for (Iterator e = classes.iterator(); e.hasNext();) { int class_index = ((Integer) e.next()).shortValue(); doClassReference((String) pool[class_index]); } {code} This is broken because pool (Java Constant Pool) is indexed by an unsigned 16-bit integer but this code tries to index it by a signed 16-bit integer which is where the negative comes from. This bug will happen with any class with a large constant pool (e.g. a large class). JIRA seems to ship {{Clazz}} twice: once as an OSGi bundle in bundled plugins and once in atlassian-plugins-osgi. Both have the bug. The AMPS plugin uses maven-bundle-plugin-2.0.0 -> bndlib-0.0.311 which also has the bug (the source of bndlib-0.0.311 is incorrect and does not match its actual artifact). AMPS appears to have maven-bundle-plugin-2.0.0 hardcoded internally which makes it hard to choose another version from a POM. I guess we have to update BND everywhere we use this.

    Ecosystem JIRA | 6 years ago | Fabian Kraemer
    java.lang.ArrayIndexOutOfBoundsException: -31163

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. java.lang.ArrayIndexOutOfBoundsException

      -31163

      at aQute.lib.osgi.Clazz.parseClassFile()
    2. aQute
      Analyzer.calcManifest
      1. aQute.lib.osgi.Clazz.parseClassFile(Clazz.java:213)
      2. aQute.lib.osgi.Clazz.<init>(Clazz.java:65)
      3. aQute.lib.osgi.Processor.analyzeJar(Processor.java:159)
      4. aQute.lib.osgi.Processor.analyzeBundleClasspath(Processor.java:97)
      5. aQute.lib.osgi.Analyzer.analyze(Analyzer.java:194)
      6. aQute.lib.osgi.Builder.analyze(Builder.java:94)
      7. aQute.lib.osgi.Analyzer.calcManifest(Analyzer.java:293)
      7 frames
    3. com.atlassian.plugin
      DefaultPluginTransformer.transform
      1. com.atlassian.plugin.osgi.factory.transform.stage.GenerateManifestStage.execute(GenerateManifestStage.java:154)
      2. com.atlassian.plugin.osgi.factory.transform.DefaultPluginTransformer.transform(DefaultPluginTransformer.java:200)
      2 frames