I'm trying to pass a text/String parameter to my java tool from Jenkins which is a String containing all sorts of characters.
When the args4j option parses the flag then it only considers the first word and as soon as it hits the second word(after space) it starts throwing an exception.
here's a snippet
@Option(name = "-data_string", usage = "Data")
private String dataString;
When I pass argument as -data_string="This is a test" then I get Exception
Exception in thread "main" java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoader.java:58)Caused by: org.kohsuke.args4j.CmdLineException: "-data_string=This is a test" is not a valid option
at org.kohsuke.args4j.CmdLineParser.parseArgument(CmdLineParser.java:512)
at scraper.client.ScraperClient.main(ScraperClient.java:28)
... 5 more
Please suggest.