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

(process) ProcessBuilder.command() returns unmodifiable list

XMLWordPrintable

    • b26
    • generic
    • generic



      Name: skR10005 Date: 10/15/2003


      The following new api tests fail on JDK1.5.0-b23:
      api/java_lang/ProcessBuilder/index.html#command3[command3001]
      api/java_lang/ProcessBuilder/index.html#command3[command3002]

      The API specification of the method ProcessBuilder.command() does not
      specify that returned List may reject adding new elements.

      The following simple test can be used to reproduce the failure:
      ===============================test.java=======================
      public class test {
          public static void main(String[] argv) {
              ProcessBuilder pb = new ProcessBuilder();
              pb.command().add("anything");
          }
      }
      ===============================================================
      $ javac -d . -source 1.5 test.java
      $ java -version
      java version "1.5.0-beta"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-beta-b23)
      Java HotSpot(TM) Client VM (build 1.5.0-beta-b23, mixed mode)
      $ java -cp . test
      Exception in thread "main" java.lang.UnsupportedOperationException
              at java.util.AbstractList.add(AbstractList.java:151)
              at java.util.AbstractList.add(AbstractList.java:89)
              at test.main(test.java:4)
      $

      ======================================================================

            alanb Alan Bateman
            serjsunw Serj Serj (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: