Consider the following test case:
import java.util.*;
import java.io.*;
public class Test {
public static void main(String[] args) throws Exception {
Properties props = System.getProperties();
try (OutputStream out = new FileOutputStream("props.xml")) {
props.storeToXML(out, "comment", "Vinnie");
}
}
}
When run it prints the following to the console:
Warning: The encoding 'Vinnie' is not supported by the Java runtime.
Warning: encoding "Vinnie" not supported, using UTF-8
It's very impolite for the JDK to print messages to the console, this should be an exception instead.
import java.util.*;
import java.io.*;
public class Test {
public static void main(String[] args) throws Exception {
Properties props = System.getProperties();
try (OutputStream out = new FileOutputStream("props.xml")) {
props.storeToXML(out, "comment", "Vinnie");
}
}
}
When run it prints the following to the console:
Warning: The encoding 'Vinnie' is not supported by the Java runtime.
Warning: encoding "Vinnie" not supported, using UTF-8
It's very impolite for the JDK to print messages to the console, this should be an exception instead.
- relates to
-
JDK-8228854 Default ErrorListener reports warnings and errors to the console
-
- Resolved
-
-
JDK-8000685 (props) Properties.storeToXML/loadFromXML should only require UTF-8 and UTF-16 to be supported
-
- Closed
-
-
JDK-8228973 Default ErrorListener reports warnings and errors to the console
-
- Closed
-