Uploaded image for project: 'Red Hat Fuse'
  1. Red Hat Fuse
  2. ENTESB-3858

EnsembleAddAction.applyEnsembleConfiguration Throws StringIndexOutOfBoundsException

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • jboss-fuse-6.2.1
    • jboss-fuse-6.2
    • Fabric8 v1
    • None
    • % %

      In io.fabric8.commands.EnsembleAddAction.applyEnsembleConfiguration(), there's the following line of code:

      currentDataDir = currentDataDir.substring(0, currentDataDir.lastIndexOf("/"));
      

      If you run in a Windows environment, the above results in a StringIndexOutOfBoundsException because lastIndexOf("/") returns a -1.

      java.lang.StringIndexOutOfBoundsException: String index out of range: -1
      	at java.lang.String.substring(String.java:1955)[:1.8.0_45]
      	at io.fabric8.commands.EnsembleAddAction.applyEnsembleConfiguration(EnsembleAddAction.java:117)
      	at io.fabric8.commands.EnsembleAddAction.doExecute(EnsembleAddAction.java:84)
      	at org.apache.karaf.shell.console.AbstractAction.execute(AbstractAction.java:33)
      	at org.apache.felix.gogo.commands.basic.AbstractCommand.execute(AbstractCommand.java:35)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)[:1.8.0_45]
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)[:1.8.0_45]
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)[:1.8.0_45]
      	at java.lang.reflect.Method.invoke(Method.java:497)[:1.8.0_45]
      

      Code should guard against this and use File.separator instead of hard-coded "/".

            janstey@redhat.com Jonathan Anstey
            Argo_Integration Travis North (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: