-
Enhancement
-
Resolution: Fixed
-
P3
-
8
-
b50
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8084461 | emb-9 | Roger Riggs | P3 | Resolved | Fixed | team |
Modern Sandboxed Operating System platforms typically do not allow applications to attempt to launch applications. A few examples of these platforms are iOS and Windows Mobile.
The Javadocs allude to the fact that starting a process can fail but doesn't list the situation where
starting a process is prohibited.
* <p>Starting an operating system process is highly system-dependent.
* Among the many things that can go wrong are:
* <ul>
* <li>The operating system program file was not found.
* <li>Access to the program file was denied.
* <li>The working directory does not exist.
* </ul>
*
* <p>In such cases an exception will be thrown. The exact nature
* of the exception is system-dependent, but it will always be a
* subclass of {@link IOException}.
I don't think that IOException is really the best exception to throw in this case. I think UnsupportedOperationException is more meaningful since this operation will never complete successfully on these types of platforms. Using an exception that extends RuntimeException also minimizes any compatibility issues since these exceptions do not need to be caught.
The specification for Runtime.exec and ProcessBuilder.start should be updated to clarify this situation and allow for UnsupportedOperationException to be a supported return from these methods.
The Javadocs allude to the fact that starting a process can fail but doesn't list the situation where
starting a process is prohibited.
* <p>Starting an operating system process is highly system-dependent.
* Among the many things that can go wrong are:
* <ul>
* <li>The operating system program file was not found.
* <li>Access to the program file was denied.
* <li>The working directory does not exist.
* </ul>
*
* <p>In such cases an exception will be thrown. The exact nature
* of the exception is system-dependent, but it will always be a
* subclass of {@link IOException}.
I don't think that IOException is really the best exception to throw in this case. I think UnsupportedOperationException is more meaningful since this operation will never complete successfully on these types of platforms. Using an exception that extends RuntimeException also minimizes any compatibility issues since these exceptions do not need to be caught.
The specification for Runtime.exec and ProcessBuilder.start should be updated to clarify this situation and allow for UnsupportedOperationException to be a supported return from these methods.
- backported by
-
JDK-8084461 (process spec) ProcessBuilder.start and Runtime.exec should throw UnsupportedOperationException on platforms that don't support it
- Resolved
- is cloned by
-
JDK-8072034 (process) ProcessBuilder.start and Runtime.exec UnsupportedOperationException editorial cleanup
- Resolved