[ 
https://issues.apache.org/jira/browse/FELIX-5972?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16663944#comment-16663944
 ] 

Thomas Watson commented on FELIX-5972:
--------------------------------------

I was about to close this bug as "not a bug" but I think instead we should add 
some logic that detects that a single resource is being wrapped multiple times 
which would indicate that the resource is providing multiple osgi.wiring.host 
capabilities.  If we detect that an IllegalStateException should probably be 
thrown with blame placed on the ResolveContext implementation.

> prevent ArrayIndexOutOfBoundsException while resolving
> ------------------------------------------------------
>
>                 Key: FELIX-5972
>                 URL: https://issues.apache.org/jira/browse/FELIX-5972
>             Project: Felix
>          Issue Type: Bug
>          Components: Resolver
>            Reporter: Stefan Bischof
>            Priority: Major
>
> ***Describe the bug*
>  when resolving I got an java.lang.ArrayIndexOutOfBoundsException: -1
> it may cause the -runpath Instruction
> *To Reproduce*
>  push the resolve button at {{test.log/works.bndrun}} -> it resolves
>  push the resolve button at {{test.log/fail.bndrun}} -> Exception
>  the only diff is that there is one mor required bundle
> i tried so centralize all logging instructions
>  cnf/ext/logging.bnd
> provide an Example
>  Repo: {{[https://github.com/stbischof/logging/tree/master]}}
> Command:
> {code:java}
> java -jar biz.aQute.bnd-4.1.0.jar clean
> java -jar biz.aQute.bnd-4.1.0.jar _par
> java -jar biz.aQute.bnd-4.1.0.jar resolve resolve **/fail.bndrun 
> {code}
>  
> *Expected behavior*
>  it should resolve
> *Stacktrace*
>  
> {code:java}
> java.lang.ArrayIndexOutOfBoundsException: -1 000: Exception: 
> java.lang.ArrayIndexOutOfBoundsException: -1 at 
> java.util.ArrayList.elementData(ArrayList.java:422) at 
> java.util.ArrayList.set(ArrayList.java:450) at 
> org.apache.felix.resolver.util.ShadowList.replace(ShadowList.java:74) at 
> org.apache.felix.resolver.Candidates.prepare(Candidates.java:939) at 
> org.apache.felix.resolver.ResolverImpl.getInitialCandidates(ResolverImpl.java:547)
>  at org.apache.felix.resolver.ResolverImpl.doResolve(ResolverImpl.java:432) 
> at org.apache.felix.resolver.ResolverImpl.resolve(ResolverImpl.java:421) at 
> org.apache.felix.resolver.ResolverImpl.resolve(ResolverImpl.java:375) at 
> biz.aQute.resolve.BndResolver.resolve(BndResolver.java:32) at 
> biz.aQute.resolve.ResolveProcess.resolveRequired(ResolveProcess.java:81) at 
> biz.aQute.resolve.ProjectResolver.resolve(ProjectResolver.java:105) at 
> biz.aQute.resolve.Bndrun.resolve(Bndrun.java:95) at 
> aQute.bnd.main.ResolveCommand._resolve(ResolveCommand.java:275) at 
> sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 
> at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>  at java.lang.reflect.Method.invoke(Method.java:498) at 
> aQute.lib.getopt.CommandLine.execute(CommandLine.java:150) at 
> aQute.lib.getopt.CommandLine.subCmd(CommandLine.java:624) at 
> aQute.bnd.main.bnd._resolve(bnd.java:4237) at 
> sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 
> at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>  at java.lang.reflect.Method.invoke(Method.java:498) at 
> aQute.lib.getopt.CommandLine.execute(CommandLine.java:150) at 
> aQute.bnd.main.bnd._bnd(bnd.java:444) at 
> sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 
> at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>  at java.lang.reflect.Method.invoke(Method.java:498) at 
> aQute.lib.getopt.CommandLine.execute(CommandLine.java:150) at 
> aQute.bnd.main.bnd.start(bnd.java:292) at 
> aQute.bnd.main.bnd.main(bnd.java:269) {code}
> **
>  
>  
> *Environment (please complete the following information):*
>  * bnd-Version: {{bndtools 4.2.0.2018.10.19.2218-SNAPSHOT}}
>  * Java-Version: {{java -version}}
>  
> {code:java}
> openjdk version "1.8.0_181" OpenJDK Runtime Environment (build 1.8.0_181-b15) 
> OpenJDK 64-Bit Server VM (build 25.181-b15, mixed mode)  
> {code}
>  * bnd-Part: bnd-lib,bndtools
>  * OS: Linux
>  * OSGi-Framework: Felix
>  * Related Spec: none
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to