Changeset 4083


Ignore:
Timestamp:
Dec 20, 2010, 1:13:01 PM (12 years ago)
Author:
olle
Message:

Refs #668. Class/file plugins/RunMsInspectPlugin.java in plugin/ updated to use the java.lang.Runtime.getRuntime().exec(String[] cmdarray) version of the exec() call, instead of exec(String cmd), in order to work with space characters in file and directory paths.

  1. Private method void msInspectSearchLocal(Request request, Response response, ...) updated to use the java.lang.Runtime.getRuntime().exec(String[] cmdarray) version of the exec() call, instead of exec(String cmd).
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/plugin/src/org/proteios/plugins/RunMsInspectPlugin.java

    r4082 r4083  
    439439    try
    440440    {
    441       String cmd = msInspectProgramPath;
     441      List<String> cmdList = new ArrayList<String>();
    442442      if (msInspectProgramPath.endsWith(".jar") || msInspectProgramPath.endsWith(".JAR"))
    443443      {
     
    449449        }
    450450        String memoryOption = new String("-Xmx" + memoryInMegaBytes + "M");
    451         cmd = new String("java");
    452         cmd = cmd + " " + memoryOption;
    453         cmd = cmd + " -jar " + msInspectProgramPath;
    454       }
    455       cmd = cmd + " --findpeptides";
    456       cmd = cmd + " --outdir=" + msInspectOutputDirPath;
    457       cmd = cmd + " " + spectrumFileTmp;
     451        cmdList.add("java");
     452        cmdList.add(memoryOption);
     453        cmdList.add("-jar");
     454      }
     455      cmdList.add(msInspectProgramPath);
     456      cmdList.add("--findpeptides");
     457      cmdList.add("--outdir=" + msInspectOutputDirPath);
     458      cmdList.add(spectrumFileTmp.getPath());
    458459      //
    459460      // Execute msInspect feature detection using local installation
     
    464465        throw new IOException("Job command is aborted. Closing down.");
    465466      }
    466       log.debug("cmd = \"" + cmd + "\"");
     467      log.debug("cmdList = " + cmdList);
     468      // Convert command list to string array
     469      String[] cmdArr = new String[cmdList.size()];
     470      cmdArr = cmdList.toArray(cmdArr);
    467471      Runtime rt = Runtime.getRuntime();
    468       Process proc = rt.exec(cmd);
     472      Process proc = rt.exec(cmdArr);
    469473      /*
    470474      // any error message?
Note: See TracChangeset for help on using the changeset viewer.