< prev index next >

src/jdk.xml.bind/share/classes/com/sun/xml/internal/dtdparser/XmlReader.java

Print this page

        

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License version 2 only, as
  * published by the Free Software Foundation.  Oracle designates this

@@ -31,10 +31,11 @@
 import java.io.InputStream;
 import java.io.InputStreamReader;
 import java.io.PushbackInputStream;
 import java.io.Reader;
 import java.util.Hashtable;
+import java.util.Locale;
 
 
 // NOTE:  Add I18N support to this class when JDK gets the ability to
 // defer selection of locale for exception messages ... use the same
 // technique for both.

@@ -84,11 +85,11 @@
     // between here and the real data source, and larger buffers keep
     // that from slowing you down.)
     //
 
     /**
-     * Constructs the reader from an input stream, autodetecting
+     * Constructs the reader from an input stream, auto-detecting
      * the encoding to use according to the heuristic specified
      * in the XML 1.0 recommendation.
      *
      * @param in the input stream from which the reader is constructed
      * @throws IOException on error, such as unrecognized encoding

@@ -102,11 +103,11 @@
      * from standard encoding names to ones that understood by
      * Java where necessary.
      *
      * @param in       the input stream from which the reader is constructed
      * @param encoding the IETF standard name of the encoding to use;
-     *                 if null, autodetection is used.
+     *                 if null, auto-detection is used.
      * @throws IOException on error, including unrecognized encoding
      */
     public static Reader createReader(InputStream in, String encoding)
             throws IOException {
         if (encoding == null)

@@ -176,11 +177,11 @@
     }
 
     // returns an encoding name supported by JDK >= 1.1.6
     // for some cases required by the XML spec
     private static String std2java(String encoding) {
-        String temp = encoding.toUpperCase();
+        String temp = encoding.toUpperCase(Locale.ENGLISH);
         temp = (String) charsets.get(temp);
         return temp != null ? temp : encoding;
     }
 
     /**

@@ -319,11 +320,11 @@
 
         //
         // Next must be "l" (and whitespace) else we conclude
         // error and choose UTF-8.
         //
-        if ((c = r.read()) != 'l') {
+        if ((r.read()) != 'l') {
             setEncoding(pb, "UTF-8");
             return;
         }
 
         //

@@ -756,10 +757,11 @@
     static final class Iso8859_1Reader extends BaseReader {
         Iso8859_1Reader(InputStream in) {
             super(in);
         }
 
+        @Override
         public int read(char buf [], int offset, int len) throws IOException {
             int i;
 
             if (instream == null)
                 return -1;
< prev index next >