Uploaded image for project: 'Code Tools'
  1. Code Tools
  2. CODETOOLS-7037809

regression in com.sun.javatest.util.Properties

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P2
    • jt4.4
    • jt4.4
    • tools
    • None
    • b12
    • generic
    • generic
    • Verified

    Description

      JavaTest analog of java.util.Properties - com.sun.javatest.util.Properties incorrectly parses property files. If user's config files contains:

      k1=v1
      k2= v2
      k3 =v3
      k4 = v4

      the values of properties will be:
      k4 : ' = v4'
      k3 : ' =v3'
      k2 : ' v2'
      k1 : 'v1'

      it is not what the user expects.

      The following example demonstrate the bug:
      ----
      import java.io.BufferedReader;
      import java.io.FileReader;
      import java.io.Reader;
      import com.sun.javatest.util.Properties;

      public class Some {

          public static void main(String args[]) {
      try {
      Properties p = new Properties();
      Reader in = new BufferedReader(new FileReader(args[0]));
      p.load(in);
      in.close();
                  for (Object obj: p.keySet()) {
                      System.out.println(obj + " : '" + p.get(obj) + "'");
                  }
              } catch (Exception e) {
                  System.out.println("ex: " + e);
              }
          }
      }
      ----
      # javac -cp javatest.jar Some.java
      # java -cp javatest.jar:. Some test.props

      Attachments

        Activity

          People

            dfazunen Dmitry Fazunenko (Inactive)
            dfazunen Dmitry Fazunenko (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: