Uploaded image for project: 'FUSE ESB'
  1. FUSE ESB
  2. ESB-1735

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

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Done
    • Affects Version/s: 4.4.1-fuse-07-11
    • Fix Version/s: 4.4.1-fuse-xx-00
    • Component/s: Core
    • Labels:
      None
    • Environment:
      tested on Fuse ESB 4.4.1-fuse-07-11

      Description

      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

        Gliffy Diagrams

          Activity

          Hide
          pfox Pat Fox added a comment -

          test case attached - DEV_4305_testcase.tar

          Show
          pfox Pat Fox added a comment - test case attached - DEV_4305_testcase.tar
          Hide
          pfox Pat Fox added a comment -

          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.

          Show
          pfox Pat Fox added a comment - 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.
          Hide
          gnodet Guillaume Nodet added a comment -

          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.

          Show
          gnodet Guillaume Nodet added a comment - 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.
          Hide
          gnodet Guillaume Nodet added a comment -

          The exception now seems fixed with the changes in https://issues.apache.org/jira/browse/FELIX-3603

          Show
          gnodet Guillaume Nodet added a comment - The exception now seems fixed with the changes in https://issues.apache.org/jira/browse/FELIX-3603
          Hide
          gnodet Guillaume Nodet added a comment -

          Fixed in 4.4 and 7.0 branches

          Show
          gnodet Guillaume Nodet added a comment - Fixed in 4.4 and 7.0 branches

            People

            • Assignee:
              gnodet Guillaume Nodet
              Reporter:
              pfox Pat Fox
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: