I'd like enhancement instead of subclassing, so I try to run my project with -javaagent: enabled, and I get this exception right at the program start:
java.lang.StringIndexOutOfBoundsException: String index out of range: 0
The reason is the following:
Transformer.premain(String, Instrumentation)
gets called and this calls
Transformer t = new Transformer("", agentArgs);
and then Transformer.parseClassPaths() gets called with "" argument, and this eventually leads to calling
UrlPathHelper.convertUrlString(String)
with "" as its argument. But then, at classpath.charAt(0) the exception above is thrown.
In fact, I can't even imagine this code working for anyone at any time, so I'm quite surprised at its presence. :)
I didn't know if I may create a bug report for this, as it's so surprising, I suppose I don't see something trivial.