Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8055330

(process spec) ProcessBuilder.start and Runtime.exec should throw UnsupportedOperationException on platforms that don't support it

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Fixed
    • Icon: P3 P3
    • 9
    • 8
    • core-libs
    • b50

        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.

              rriggs Roger Riggs
              bobv Bob Vandette (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Created:
                Updated:
                Resolved: