Menu

#53 performPostCommand using wrong exec method (/w spaces in fn)

open
nobody
None
5
2008-02-23
2008-02-23
Daniel Ecer
No

From Common#performPostCommand:
Process subprocess = Runtime.getRuntime().exec(commandline); // anyone has told that works better
// Process subprocess = Runtime.getRuntime().exec(arguments);

-> I am not sure in which case #exec(String) works better than #exec(String[]) - at least in Java 6 that is incorrect based on the code... the #exec(String) method then uses a StringTokenizer to build the argument array - this does not work for file names with spaces (it does not help to use quotes)
I'd advise to revert it to use exec(arguments) instead.

Discussion

  • Daniel Ecer

    Daniel Ecer - 2008-02-23

    Logged In: YES
    user_id=1273096
    Originator: YES

    (see also 1753817)

     
  • Nobody/Anonymous

    Logged In: NO

    >>> I am not sure in which case #exec(String) works better than
    #exec(String[])

    i also preferring String[], but so many people bother me with String, so i've closed my eyes and changed it to String...

     

Log in to post a comment.