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

serializer.setEncoding emits warning message for unrecognized encoding, falls back to UTF-8

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not an Issue
    • Icon: P4 P4
    • tbd
    • 6, 7, 8
    • xml
    • None

      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.

            joehw Joe Wang
            alanb Alan Bateman
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: