Effective October 27, 2012, online and email support for FuseSource products will move to Red Hat support channels. For more information, please see the JIRA Migration to Red Hat FAQ.
As of October 27th, please open all new issues in the Red Hat Customer Portal .
Issue Details (XML | Word | Printable)

Key: ESB-1735
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Guillaume Nodet
Reporter: Pat Fox
Votes: 0
Watchers: 2
Operations

If you were logged in you would be able to see more operations.
FUSE ESB

ArrayIndexOutOfBoundsExcpetion: -1 if you sign a your bundle which contains only a XML config

Created: 19/Jul/12 09:21 AM   Updated: 31/Jul/12 06:26 AM
Component/s: Core
Affects Version/s: 4.4.1-fuse-07-11
Fix Version/s: 4.4.1-fuse-xx-00

File Attachments: 1. File DEV_4305_testcase.tar (68 kB)

Environment: tested on Fuse ESB 4.4.1-fuse-07-11

External Issue URL: https://issues.apache.org/jira/browse/FELIX-3603


 Description  « Hide
When installing a signed bundle that only contains files within the META-INF directory (such as camel route xml files etc), Fuse ESB throw a "java.lang.ArrayIndexOutOfBoundsException: -1".

Workaround: add a dumpy file to the bundle before signing the bundle. The bundle will then install without an exception



 All   Comments   Change History      Sort Order: Ascending order - Click to sort in descending order
Pat Fox added a comment - 19/Jul/12 09:25 AM
test case attached - DEV_4305_testcase.tar

Pat Fox added a comment - 19/Jul/12 10:17 AM
To replicate issue using test case.

Setup Fuse ESB to use security:

install org.apache.felix.framework.security version 1.4.2 using following command in Fuse ESB shell:

osgi:install mvn:org.apache.felix/org.apache.felix.framework.security/1.4.2

Note: it will work it the above bundle is only in a resolve state.

create an "all.policy" with the following contents

grant {
 permission java.security.AllPermission;
};

shutdown Fuse ESB process. Export the following environment variable and then run ."/servicemix" in the same shell

export JAVA_OPTS="-Djava.security.policy=<LOCATION_OF_POLICY_FILE>all.policy -Dorg.osgi.framework.security="osgi" -Dorg.osgi.framework.trust.repositories="<TEST_CASE_DIR>/DEV-4305/truststore.jks""

Build and sign bundle

In .../DEV-4305/DEV-4305-ArrayIndexOutOfBoundsExcpetion/ run

mvn install

in .../DEV-4305/ take a copy of the jar and sign it

cp DEV-4305-ArrayIndexOutOfBoundsExcpetion/target/DEV-4305-ArrayIndexOutOfBoundsExcpetion-1.0-SNAPSHOT.jar  .

jarsigner -keystore keystore.jks -storepass password DEV-4305-ArrayIndexOutOfBoundsExcpetion-1.0-SNAPSHOT.jar selfsigned

NOTE: I have include a test cert to sign the jar in the test case.

Deploy the Bundle

In the Fuse ESB console, try to deploy the singed bundle using the following command

osgi:install file:<TEST_CASE_DIR>/DEV-4305/DEV-4305-ArrayIndexOutOfBoundsExcpetion-1.0-SNAPSHOT.jar

This should result in the following output

java.lang.ArrayIndexOutOfBoundsException: -1
karaf@root>

Workaround

Add a dummy file to ".../DEV-4305/DEV-4305-ArrayIndexOutOfBoundsExcpetion/src/main/resources" directory and repeat the Build and sign bundle & Deploy the Bundle steps.


Guillaume Nodet added a comment - 21/Jul/12 11:46 AM
I raised https://issues.apache.org/jira/browse/FELIX-3603 which I think is the core issue.
Once this one is fixed, we need to check what happens with an empty bundle (i.e. no resources other than META-INF/xxx files), but given those are not signed, I think the bundle won't be even considered as a signed bundle anymore, so this Exception should go away.

Guillaume Nodet added a comment - 25/Jul/12 02:34 PM
The exception now seems fixed with the changes in https://issues.apache.org/jira/browse/FELIX-3603

Guillaume Nodet added a comment - 27/Jul/12 10:00 AM
Fixed in 4.4 and 7.0 branches