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

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

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P4
    • Resolution: Not an Issue
    • Affects Version/s: 6, 7, 8
    • Fix Version/s: tbd
    • Component/s: xml
    • Labels:
      None
    • Subcomponent:

      Description

      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.

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                Created:
                Updated:
                Resolved: