Opened 14 years ago

Closed 14 years ago

#1565 closed defect (fixed)

Command line options for the external program executor that contain quotes are not handled correctly

Reported by: Nicklas Nordborg Owned by: Nicklas Nordborg
Priority: minor Milestone: BASE 2.17
Component: coreplugins Version:
Keywords: Cc:

Description

When using the external program executor it is possible to specify command line options as a plug-in parameter. This is a string value that is split on white-space. Command line arguments that contains white-space should be quoted. But this case is not handled correctly by the external program executor. Consider for example this java program which is located in a path that contains spaces. We need to quote the path:

  • External program: java
  • Command line options: -cp "/tmp/foo bar" CopyStdin2Stdout

The following exception is thrown:

java.lang.RuntimeException: [1] Exception in thread "main" java.lang.NoClassDefFoundError: CopyStdin2Stdout
Caused by: java.lang.ClassNotFoundException: CopyStdin2Stdout
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
Could not find the main class: CopyStdin2Stdout. Program will exit.

at net.sf.basedb.plugins.executor.ExternalProgramExecutor.runExternalProgram(ExternalProgramExecutor.java:783)
at net.sf.basedb.plugins.executor.ExternalProgramExecutor.run(ExternalProgramExecutor.java:301)
at net.sf.basedb.core.PluginExecutionRequest.invoke(PluginExecutionRequest.java:116)
at net.sf.basedb.core.InternalJobQueue$JobRunner.run(InternalJobQueue.java:510)
at java.lang.Thread.run(Thread.java:619)

If the program is located in a path without spaces it works as expected.

Change History (2)

comment:1 by Nicklas Nordborg, 14 years ago

Owner: changed from everyone to Nicklas Nordborg
Status: newassigned

comment:2 by Nicklas Nordborg, 14 years ago

Resolution: fixed
Status: assignedclosed

(In [5534]) Fixes #1565: Command line options for the external program executor that contain quotes are not handled correctly

Note: See TracTickets for help on using tickets.