-
Bug
-
Resolution: Done
-
Major
-
jboss-fuse-6.2
-
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 "/".