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
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