jython - WLST Ant Task white space within arguments -


i using wlst ant task allows list of space delimited arguments passed in under arguments attribute.

the issue when pass file directory contains space. instance "program files" becomes 2 arguments of program , files.

is there suggestions around this?

my suggestion below work 1 value. example append "program files" argument end , loop known end argument actual end of sys.argv. ie if want "program files" 4th system argument inside wlst script append sys.argv[4],[5]...[end].

short answer wlst 11.1.1.9.0: can't around this.

i have same problem , debugged bit.

my findings: class wlsttask in weblogic-11.1.1.9.jar calls via command line wlstinterpreterinvoker parses args:

private void parseargs(string[] arg) {     (int = 0; < arg.length; i++) {       this.arguments = (this.arguments + " " + arg[i]); } [...] 

for reasons don't know these args parsed again, before python script invoked:

private void executepyscript() {     [...]     if (this.arguments != null) {         string[] args = stringutils.splitcompletely(this.arguments, " ");     [...]   public static string[] splitcompletely(string paramstring1, string paramstring2) {     return splitcompletely(new stringtokenizer(paramstring1, paramstring2)); }  private static string[] splitcompletely(stringtokenizer paramstringtokenizer) {     int = paramstringtokenizer.counttokens();     string[] arrayofstring = new string[i];      (int j = 0; j < i; j++) arrayofstring[j] = paramstringtokenizer.nexttoken();     return arrayofstring; } 

unfortunately stringtokenizer method not distinguish quoted strings , sys.argv in python gets separate arguments, if quote parameter

there 2 possible alternatives:

  • replace spaces in ant else (eg %20) , 'decode' them in python.
  • write property file in ant , read in pyhton.

the code executepyscript() in 12.2.1 has changed lot , seems problem may gone there (i haven't checked)

if ((this.arguments.indexof("\"") == -1) && (this.arguments.indexof("'") == -1))   args = stringutils.splitcompletely(this.arguments, " "); else {   args = splitquotedstring(this.arguments); } 

Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -