994 * denies write access to the file 995 * 996 * </ul> 997 * 998 * @throws IOException if an I/O error occurs 999 * 1000 * @see Runtime#exec(String[], String[], java.io.File) 1001 */ 1002 public Process start() throws IOException { 1003 // Must convert to array first -- a malicious user-supplied 1004 // list might try to circumvent the security check. 1005 String[] cmdarray = command.toArray(new String[command.size()]); 1006 cmdarray = cmdarray.clone(); 1007 1008 for (String arg : cmdarray) 1009 if (arg == null) 1010 throw new NullPointerException(); 1011 // Throws IndexOutOfBoundsException if command is empty 1012 String prog = cmdarray[0]; 1013 1014 SecurityManager security = System.getSecurityManager(); 1015 if (security != null) 1016 security.checkExec(prog); 1017 1018 String dir = directory == null ? null : directory.toString(); 1019 1020 try { 1021 return ProcessImpl.start(cmdarray, 1022 environment, 1023 dir, 1024 redirects, 1025 redirectErrorStream); 1026 } catch (IOException e) { 1027 // It's much easier for us to create a high-quality error 1028 // message than the low-level C code which found the problem. 1029 throw new IOException( 1030 "Cannot run program \"" + prog + "\"" 1031 + (dir == null ? "" : " (in directory \"" + dir + "\")") 1032 + ": " + e.getMessage(), 1033 e); 1034 } 1035 } 1036 } | 994 * denies write access to the file 995 * 996 * </ul> 997 * 998 * @throws IOException if an I/O error occurs 999 * 1000 * @see Runtime#exec(String[], String[], java.io.File) 1001 */ 1002 public Process start() throws IOException { 1003 // Must convert to array first -- a malicious user-supplied 1004 // list might try to circumvent the security check. 1005 String[] cmdarray = command.toArray(new String[command.size()]); 1006 cmdarray = cmdarray.clone(); 1007 1008 for (String arg : cmdarray) 1009 if (arg == null) 1010 throw new NullPointerException(); 1011 // Throws IndexOutOfBoundsException if command is empty 1012 String prog = cmdarray[0]; 1013 1014 String dir = directory == null ? null : directory.toString(); 1015 1016 return ProcessImpl.start(cmdarray, 1017 environment, 1018 dir, 1019 redirects, 1020 redirectErrorStream); 1021 } 1022 } |