bndtools / bnd

Bnd/Bndtools. Tooling to build OSGi bundles including Eclipse, Maven, and Gradle plugins.
https://bndtools.org
Other
528 stars 306 forks source link

Bnd ArrayIndexOutOfBoundsException with * command on Conditional-Package option #2220

Closed reyman closed 6 years ago

reyman commented 6 years ago

Hi, I recently reported the issue in goomph which use the latest version of bndtools to declare Manifest :

When i add * option to 'Conditional-Package', i have an error java.lang.ArrayIndexOutOfBoundsException

I already report this error in goomph issue tracker : https://github.com/diffplug/goomph/issues/40#issuecomment-348743514

The code which report this error is here : https://github.com/ANRGenstar/gamaplugin

bjhargrave commented 6 years ago

When I cloned the gamaplugin project and ran ./gradlew, I saw the following downloads:

Download https://plugins.gradle.org/m2/biz/aQute/bnd/bndlib/2.2.0/bndlib-2.2.0.pom
Download https://plugins.gradle.org/m2/biz/aQute/bnd/parent/2.2.0/parent-2.2.0.pom
Download https://plugins.gradle.org/m2/biz/aQute/bnd/biz.aQute.bndlib/3.2.0/biz.aQute.bndlib-3.2.0.pom
Download https://plugins.gradle.org/m2/biz/aQute/bnd/bndlib/2.2.0/bndlib-2.2.0.jar
Download https://plugins.gradle.org/m2/biz/aQute/bnd/biz.aQute.bndlib/3.2.0/biz.aQute.bndlib-3.2.0.jar

So it appears that both bndlib 2.2.0 and bndlib 3.2.0 are BOTH being used which is a source of concern.

And I was able to build the project without seeing any ArrayIndexOutOfBoundsException.

So you need to provide more specific directions on how to reproduce the issue with Bndlib 3.5 which is the current release. The code in this area has change quite significantly since 3.2 and the stacktrace information in your bug is incomplete (it is missing the top lines) and does not fit the current code.

Even more disturbing is that the stacktrace information does fit the Bndlib 2.2 code: https://github.com/bndtools/bnd/blob/e3dce61619372a2d7eb57c8c239c17f363cc99f6/biz.aQute.bndlib/src/aQute/bnd/osgi/Clazz.java#L418-L428 which means your problem may be caused by having 2 versions of Bndlib on the gradle plugin classpath since it appears you are in the Bndlib 2.2 code when you get the exception. This could also explain by trying to use Bndlib 3.5 did not address the problem.

I suggest you understand why there are 2 versions of Bndlib present and fix that first. Perhaps some other dependent is pulling in Bndlib 2.2.

reyman commented 6 years ago

Ok thanks for information, i try to trace the error and i post here if i have news.

Edit : Hum, i use bnd-tools and goomph in my root buildscrit, and they use different version of bndlib :

I try to search which package download bndlib 2.2.0 ....

Edit, found using buildEnvironement command, bnd-platform:1.5.0 use bndlib 2.2.0, so this is probably a problem of bnd-tools ..

+--- org.standardout:bnd-platform:1.5.0
|    +--- biz.aQute.bnd:bndlib:2.2.0
|    |    \--- org.osgi:org.osgi.core:4.2.0
|    +--- commons-io:commons-io:2.4
|    \--- de.undercouch:gradle-download-task:3.1.1
|         \--- org.apache.httpcomponents:httpclient:4.4.1
|              +--- org.apache.httpcomponents:httpcore:4.4.1
|              +--- commons-logging:commons-logging:1.2
|              \--- commons-codec:commons-codec:1.9
\--- com.diffplug.gradle:goomph:3.9.0-SNAPSHOT
     +--- com.diffplug.durian:durian-core:1.2.0
     +--- com.diffplug.durian:durian-collect:1.2.0
     |    \--- com.diffplug.durian:durian-core:1.2.0
     +--- com.diffplug.durian:durian-io:1.2.0
     |    +--- com.diffplug.durian:durian-core:1.2.0
     |    \--- com.diffplug.durian:durian-collect:1.2.0 (*)
     +--- com.diffplug.durian:durian-swt:2.0.0
     |    +--- com.diffplug.durian:durian-core:1.2.0
     |    +--- com.diffplug.durian:durian-collect:1.2.0 (*)
     |    +--- com.diffplug.durian:durian-concurrent:1.2.0
     |    |    +--- com.diffplug.durian:durian-core:1.2.0
     |    |    \--- com.diffplug.durian:durian-collect:1.2.0 (*)
     |    +--- com.diffplug.durian:durian-rx:2.0.0
     |    |    +--- com.diffplug.durian:durian-core:1.2.0
     |    |    +--- com.diffplug.durian:durian-concurrent:1.2.0 (*)
     |    |    \--- io.reactivex:rxjava:1.1.0
     |    \--- io.reactivex:rxjava:1.1.0
     +--- commons-io:commons-io:2.4
     +--- com.diffplug.spotless:spotless-lib:1.5.1
     +--- biz.aQute.bnd:biz.aQute.bndlib:3.2.0
     \--- org.eclipse.tycho:org.eclipse.osgi:3.10.101.v20150820-1432

I update the version of Bnd-platform to latest SNAPSHOT version : https://github.com/stempler/bnd-platform#using-the-current-snapshot

bjhargrave commented 6 years ago

The joys of transitive dependencies...

I will close this issue since the problem is not in Bnd itself.