Author: schor
Date: Tue Dec 11 15:45:22 2018
New Revision: 1848693

URL: http://svn.apache.org/viewvc?rev=1848693&view=rev
Log:
[UIMA-5390] auto refactor use StandardCharsets.UTF_8, plus occasional removal 
of unused imports

Modified:
    
uima/uv3/uimaj-v3/trunk/jVinci/src/main/java/org/apache/vinci/transport/document/XMLToXTalk.java
    
uima/uv3/uimaj-v3/trunk/uimaj-component-test-util/src/main/java/org/apache/uima/test/junit_extension/AnnotationWriter.java
    
uima/uv3/uimaj-v3/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/CommonSerDes.java
    
uima/uv3/uimaj-v3/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/UimaDecompiler.java
    
uima/uv3/uimaj-v3/trunk/uimaj-core/src/main/java/org/apache/uima/pear/tools/InstallationDescriptorHandler.java
    
uima/uv3/uimaj-v3/trunk/uimaj-core/src/main/java/org/apache/uima/pear/util/XMLUtil.java
    
uima/uv3/uimaj-v3/trunk/uimaj-core/src/main/java/org/apache/uima/uimacpp/CppUimajEngine.java
    
uima/uv3/uimaj-v3/trunk/uimaj-core/src/main/java/org/apache/uima/util/CasIOUtils.java
    
uima/uv3/uimaj-v3/trunk/uimaj-core/src/main/java/org/apache/uima/util/TCasToInlineXml.java
    
uima/uv3/uimaj-v3/trunk/uimaj-core/src/main/java/org/apache/uima/util/impl/Settings_impl.java
    
uima/uv3/uimaj-v3/trunk/uimaj-core/src/test/java/org/apache/uima/analysis_engine/impl/AnnotationWriter.java
    
uima/uv3/uimaj-v3/trunk/uimaj-core/src/test/java/org/apache/uima/analysis_engine/impl/TestAnnotator2.java
    
uima/uv3/uimaj-v3/trunk/uimaj-core/src/test/java/org/apache/uima/analysis_engine/impl/sequencer/SequencerTestAnnotator.java
    
uima/uv3/uimaj-v3/trunk/uimaj-core/src/test/java/org/apache/uima/cas/impl/XmiCasDeserializerTest.java
    
uima/uv3/uimaj-v3/trunk/uimaj-core/src/test/java/org/apache/uima/cas/test/TypeOrderTest.java
    
uima/uv3/uimaj-v3/trunk/uimaj-core/src/test/java/org/apache/uima/resource/impl/ConfigurableDataResourceSpecifier_implTest.java
    
uima/uv3/uimaj-v3/trunk/uimaj-core/src/test/java/org/apache/uima/resource/impl/DataResource_implTest.java
    
uima/uv3/uimaj-v3/trunk/uimaj-core/src/test/java/org/apache/uima/resource/impl/TestResourceInterface_impl.java
    
uima/uv3/uimaj-v3/trunk/uimaj-core/src/test/java/org/apache/uima/util/XMLSerializerTest.java
    
uima/uv3/uimaj-v3/trunk/uimaj-ep-pear-packager/src/main/java/org/apache/uima/pear/nature/ProjectCustomizer.java
    
uima/uv3/uimaj-v3/trunk/uimaj-examples/src/main/java/org/apache/uima/examples/cpe/InlineXmlCasConsumer.java
    
uima/uv3/uimaj-v3/trunk/uimaj-tools/src/main/java/org/apache/uima/tools/components/InlineXmlCasConsumer.java
    
uima/uv3/uimaj-v3/trunk/uimaj-tools/src/main/java/org/apache/uima/tools/docanalyzer/AnnotationViewerDialog.java

Modified: 
uima/uv3/uimaj-v3/trunk/jVinci/src/main/java/org/apache/vinci/transport/document/XMLToXTalk.java
URL: 
http://svn.apache.org/viewvc/uima/uv3/uimaj-v3/trunk/jVinci/src/main/java/org/apache/vinci/transport/document/XMLToXTalk.java?rev=1848693&r1=1848692&r2=1848693&view=diff
==============================================================================
--- 
uima/uv3/uimaj-v3/trunk/jVinci/src/main/java/org/apache/vinci/transport/document/XMLToXTalk.java
 (original)
+++ 
uima/uv3/uimaj-v3/trunk/jVinci/src/main/java/org/apache/vinci/transport/document/XMLToXTalk.java
 Tue Dec 11 15:45:22 2018
@@ -32,6 +32,7 @@ import java.io.OutputStreamWriter;
 import java.io.RandomAccessFile;
 import java.io.Reader;
 import java.io.Writer;
+import java.nio.charset.StandardCharsets;
 import java.util.ArrayList;
 
 import javax.xml.parsers.ParserConfigurationException;
@@ -205,7 +206,7 @@ public class XMLToXTalk {
     Writer xml_os = null;
     if (xml_filename != null) {
       xml_os = new BufferedWriter(new OutputStreamWriter(new 
FileOutputStream(xml_filename),
-              "UTF-8"));
+              StandardCharsets.UTF_8));
     }
     File file = new File(filename);
     OutputStream os = new BufferedOutputStream(new FileOutputStream(file));

Modified: 
uima/uv3/uimaj-v3/trunk/uimaj-component-test-util/src/main/java/org/apache/uima/test/junit_extension/AnnotationWriter.java
URL: 
http://svn.apache.org/viewvc/uima/uv3/uimaj-v3/trunk/uimaj-component-test-util/src/main/java/org/apache/uima/test/junit_extension/AnnotationWriter.java?rev=1848693&r1=1848692&r2=1848693&view=diff
==============================================================================
--- 
uima/uv3/uimaj-v3/trunk/uimaj-component-test-util/src/main/java/org/apache/uima/test/junit_extension/AnnotationWriter.java
 (original)
+++ 
uima/uv3/uimaj-v3/trunk/uimaj-component-test-util/src/main/java/org/apache/uima/test/junit_extension/AnnotationWriter.java
 Tue Dec 11 15:45:22 2018
@@ -22,6 +22,7 @@ import java.io.File;
 import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.OutputStreamWriter;
+import java.nio.charset.StandardCharsets;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.HashMap;
@@ -103,7 +104,8 @@ public class AnnotationWriter extends Ca
                        }
                        try
                        {
-                               this.fileWriter = new OutputStreamWriter(new 
FileOutputStream(this.outFile, false), "UTF-8");
+                               this.fileWriter = new OutputStreamWriter(new 
FileOutputStream(this.outFile, false),
+                                                               
StandardCharsets.UTF_8);
                        }
                        catch (IOException e)
                        {
@@ -365,7 +367,7 @@ public class AnnotationWriter extends Ca
                                                        new Object[] { oPath, 
"outputFile" });
                                }
                                //write result specification to the output file
-                               this.fileWriter = new OutputStreamWriter(new 
FileOutputStream(oFile, false), "UTF-8");
+                               this.fileWriter = new OutputStreamWriter(new 
FileOutputStream(oFile, false), StandardCharsets.UTF_8);
                        }
                        catch (IOException e)
                        {

Modified: 
uima/uv3/uimaj-v3/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/CommonSerDes.java
URL: 
http://svn.apache.org/viewvc/uima/uv3/uimaj-v3/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/CommonSerDes.java?rev=1848693&r1=1848692&r2=1848693&view=diff
==============================================================================
--- 
uima/uv3/uimaj-v3/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/CommonSerDes.java
 (original)
+++ 
uima/uv3/uimaj-v3/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/CommonSerDes.java
 Tue Dec 11 15:45:22 2018
@@ -25,6 +25,7 @@ import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
 import java.nio.ByteBuffer;
+import java.nio.charset.StandardCharsets;
 
 import org.apache.uima.UIMARuntimeException;
 
@@ -167,7 +168,7 @@ public class CommonSerDes {
       bytebuf[1] = dis.readByte(); // I
       bytebuf[2] = dis.readByte(); // M
       bytebuf[3] = dis.readByte(); // A
-      String s = new String(bytebuf, "UTF-8");
+      String s = new String(bytebuf, StandardCharsets.UTF_8);
       return s.equals("UIMA") || s.equals("AMIU");
     } catch (IOException e) {
       return false;

Modified: 
uima/uv3/uimaj-v3/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/UimaDecompiler.java
URL: 
http://svn.apache.org/viewvc/uima/uv3/uimaj-v3/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/UimaDecompiler.java?rev=1848693&r1=1848692&r2=1848693&view=diff
==============================================================================
--- 
uima/uv3/uimaj-v3/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/UimaDecompiler.java
 (original)
+++ 
uima/uv3/uimaj-v3/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/UimaDecompiler.java
 Tue Dec 11 15:45:22 2018
@@ -25,13 +25,10 @@ import java.io.File;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStreamWriter;
-import java.io.UnsupportedEncodingException;
+import java.nio.charset.StandardCharsets;
 import java.util.Arrays;
-import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
-import org.apache.uima.internal.util.Misc;
-
 import com.strobel.assembler.InputTypeLoader;
 import com.strobel.assembler.metadata.Buffer;
 import com.strobel.assembler.metadata.CompositeTypeLoader;
@@ -39,6 +36,7 @@ import com.strobel.assembler.metadata.IT
 import com.strobel.decompiler.Decompiler;
 import com.strobel.decompiler.DecompilerSettings;
 import com.strobel.decompiler.PlainTextOutput;
+import org.apache.uima.internal.util.Misc;
 
 /**
  * Decompiler
@@ -68,12 +66,7 @@ public class UimaDecompiler {
    */
   private final static byte[] errorMsg;
   static {
-    byte[] temp = null;
-    try {
-      temp = "!!! ERROR: Failed to load class".getBytes("UTF-8");
-    } catch (UnsupportedEncodingException e) {
-    }
-    errorMsg = temp;
+    errorMsg = "!!! ERROR: Failed to load 
class".getBytes(StandardCharsets.UTF_8);
   }
 
   private final DecompilerSettings decompilerSettings = 
DecompilerSettings.javaDefaults();

Modified: 
uima/uv3/uimaj-v3/trunk/uimaj-core/src/main/java/org/apache/uima/pear/tools/InstallationDescriptorHandler.java
URL: 
http://svn.apache.org/viewvc/uima/uv3/uimaj-v3/trunk/uimaj-core/src/main/java/org/apache/uima/pear/tools/InstallationDescriptorHandler.java?rev=1848693&r1=1848692&r2=1848693&view=diff
==============================================================================
--- 
uima/uv3/uimaj-v3/trunk/uimaj-core/src/main/java/org/apache/uima/pear/tools/InstallationDescriptorHandler.java
 (original)
+++ 
uima/uv3/uimaj-v3/trunk/uimaj-core/src/main/java/org/apache/uima/pear/tools/InstallationDescriptorHandler.java
 Tue Dec 11 15:45:22 2018
@@ -26,6 +26,7 @@ import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStreamWriter;
 import java.io.PrintWriter;
+import java.nio.charset.StandardCharsets;
 import java.util.Hashtable;
 import java.util.Iterator;
 import java.util.Properties;
@@ -176,7 +177,7 @@ public class InstallationDescriptorHandl
     xmlBuffer.append(XML_HEADER);
     xmlBuffer.append('\n');
     xmlBuffer.append(insdObject.toString());
-    byte[] xmlContentBytes = xmlBuffer.toString().getBytes("UTF-8");
+    byte[] xmlContentBytes = 
xmlBuffer.toString().getBytes(StandardCharsets.UTF_8);
     iStream = new ByteArrayInputStream(xmlContentBytes);
     return iStream;
   }
@@ -399,7 +400,7 @@ public class InstallationDescriptorHandl
           throws IOException {
     PrintWriter oWriter = null;
     try {
-      oWriter = new PrintWriter(new OutputStreamWriter(new 
FileOutputStream(xmlFile), "UTF-8"));
+      oWriter = new PrintWriter(new OutputStreamWriter(new 
FileOutputStream(xmlFile), StandardCharsets.UTF_8));
       oWriter.println(XML_HEADER);
       printInstallationDescriptor(insdObject, oWriter);
     } catch (IOException exc) {

Modified: 
uima/uv3/uimaj-v3/trunk/uimaj-core/src/main/java/org/apache/uima/pear/util/XMLUtil.java
URL: 
http://svn.apache.org/viewvc/uima/uv3/uimaj-v3/trunk/uimaj-core/src/main/java/org/apache/uima/pear/util/XMLUtil.java?rev=1848693&r1=1848692&r2=1848693&view=diff
==============================================================================
--- 
uima/uv3/uimaj-v3/trunk/uimaj-core/src/main/java/org/apache/uima/pear/util/XMLUtil.java
 (original)
+++ 
uima/uv3/uimaj-v3/trunk/uimaj-core/src/main/java/org/apache/uima/pear/util/XMLUtil.java
 Tue Dec 11 15:45:22 2018
@@ -27,6 +27,7 @@ import java.io.IOException;
 import java.io.InputStream;
 import java.io.InputStreamReader;
 import java.io.PrintWriter;
+import java.nio.charset.StandardCharsets;
 import java.util.Enumeration;
 import java.util.Properties;
 import java.util.StringTokenizer;
@@ -236,29 +237,29 @@ public class XMLUtil {
       System.arraycopy(buffer, 0, buffer6, 0, 6);  
       if (utf8Signature) {
         // check for UTF-8
-        String test = new String(buffer, "UTF-8");
+        String test = new String(buffer, StandardCharsets.UTF_8);
         if (test.startsWith(FIRST_XML_CHARS))
           encoding = "UTF-8";
       } else if (utf16Signature) {
         // check for UTF-16
-        String test = new String(buffer6, "UTF-16");
+        String test = new String(buffer6, StandardCharsets.UTF_16);
         if (test.startsWith(FIRST_XML_CHARS))
           encoding = "UTF-16";
       } else if (utf32Signature) {
         // we don't support this
       } else {
         // no signature - check for UTF-8 in XML header characters
-        String test = new String(buffer, "UTF-8");
+        String test = new String(buffer, StandardCharsets.UTF_8);
         if (test.startsWith(FIRST_XML_CHARS))
           encoding = "UTF-8";
         else {
           // next, check for UTF-16LE in XML header characters
-          test = new String(buffer6, "UTF-16LE");
+          test = new String(buffer6, StandardCharsets.UTF_16LE);
           if (test.startsWith(FIRST_XML_CHARS)) {
             encoding = "UTF-16LE";
           } else {
             // next, check for UTF-16BE in XML header characters
-            test = new String(buffer6, "UTF-16BE");
+            test = new String(buffer6, StandardCharsets.UTF_16BE);
             if (test.startsWith(FIRST_XML_CHARS)) {
               encoding = "UTF-16BE";
             }
@@ -269,7 +270,7 @@ public class XMLUtil {
       if (encoding == null) {
         // last resort: check 1st non-space XML character - '<'
         // check 1st non-space XML character for UTF-8
-        fReader = new BufferedReader(new InputStreamReader(new 
FileInputStream(xmlFile), "UTF-8"));
+        fReader = new BufferedReader(new InputStreamReader(new 
FileInputStream(xmlFile), StandardCharsets.UTF_8));
         String line = null;
         try {
           while ((line = fReader.readLine()) != null) {
@@ -286,7 +287,7 @@ public class XMLUtil {
         if (encoding == null) {
           // check 1st non-space XML character for UTF-16
           fReader = new BufferedReader(
-                  new InputStreamReader(new FileInputStream(xmlFile), 
"UTF-16"));
+                  new InputStreamReader(new FileInputStream(xmlFile), 
StandardCharsets.UTF_16));
           try {
             while ((line = fReader.readLine()) != null) {
               String xmlLine = line.trim();

Modified: 
uima/uv3/uimaj-v3/trunk/uimaj-core/src/main/java/org/apache/uima/uimacpp/CppUimajEngine.java
URL: 
http://svn.apache.org/viewvc/uima/uv3/uimaj-v3/trunk/uimaj-core/src/main/java/org/apache/uima/uimacpp/CppUimajEngine.java?rev=1848693&r1=1848692&r2=1848693&view=diff
==============================================================================
--- 
uima/uv3/uimaj-v3/trunk/uimaj-core/src/main/java/org/apache/uima/uimacpp/CppUimajEngine.java
 (original)
+++ 
uima/uv3/uimaj-v3/trunk/uimaj-core/src/main/java/org/apache/uima/uimacpp/CppUimajEngine.java
 Tue Dec 11 15:45:22 2018
@@ -24,6 +24,7 @@ import java.io.IOException;
 import java.io.PrintWriter;
 import java.io.StringWriter;
 import java.io.UnsupportedEncodingException;
+import java.nio.charset.StandardCharsets;
 
 import org.apache.uima.UIMAFramework;
 import org.apache.uima.analysis_engine.AnalysisEngine;
@@ -112,7 +113,7 @@ public class CppUimajEngine {
       serializer.stringSubtypeValues = stringSubTypeValues;
       serializer.stringSubtypeValuePos = stringSubTypeValuePos;
 
-      byte[] bar = config.getBytes("UTF-16");
+      byte[] bar = config.getBytes(StandardCharsets.UTF_16);
       ByteArrayInputStream bais = new ByteArrayInputStream(bar);
       XMLInputSource in = new XMLInputSource(bais, null);
       ResourceSpecifier specifier = 
UIMAFramework.getXMLParser().parseResourceSpecifier(in);
@@ -313,7 +314,7 @@ public class CppUimajEngine {
 
     try {
       byte[] bar;
-      bar = inDesc.getBytes("UTF-16");
+      bar = inDesc.getBytes(StandardCharsets.UTF_16);
       ByteArrayInputStream bais = new ByteArrayInputStream(bar);
       XMLInputSource in = new XMLInputSource(bais, null);
       ResourceSpecifier specifier = 
UIMAFramework.getXMLParser().parseResourceSpecifier(in);

Modified: 
uima/uv3/uimaj-v3/trunk/uimaj-core/src/main/java/org/apache/uima/util/CasIOUtils.java
URL: 
http://svn.apache.org/viewvc/uima/uv3/uimaj-v3/trunk/uimaj-core/src/main/java/org/apache/uima/util/CasIOUtils.java?rev=1848693&r1=1848692&r2=1848693&view=diff
==============================================================================
--- 
uima/uv3/uimaj-v3/trunk/uimaj-core/src/main/java/org/apache/uima/util/CasIOUtils.java
 (original)
+++ 
uima/uv3/uimaj-v3/trunk/uimaj-core/src/main/java/org/apache/uima/util/CasIOUtils.java
 Tue Dec 11 15:45:22 2018
@@ -18,9 +18,6 @@
  */
 package org.apache.uima.util;
 
-import static org.apache.uima.cas.impl.Serialization.serializeCAS;
-import static org.apache.uima.cas.impl.Serialization.serializeWithCompression;
-
 import java.io.BufferedInputStream;
 import java.io.Closeable;
 import java.io.DataInputStream;
@@ -30,6 +27,7 @@ import java.io.ObjectInputStream;
 import java.io.ObjectOutputStream;
 import java.io.OutputStream;
 import java.net.URL;
+import java.nio.charset.StandardCharsets;
 
 import org.apache.uima.UIMARuntimeException;
 import org.apache.uima.cas.CAS;
@@ -52,6 +50,9 @@ import org.apache.uima.cas.impl.XCASSeri
 import org.apache.uima.cas.impl.XmiCasSerializer;
 import org.xml.sax.SAXException;
 
+import static org.apache.uima.cas.impl.Serialization.serializeCAS;
+import static org.apache.uima.cas.impl.Serialization.serializeWithCompression;
+
 /**
  * <p>A collection of static methods aimed at making it easy to</p>
  * <ul>
@@ -358,7 +359,7 @@ public class CasIOUtils {
     byte[] firstPartOfFile = new byte[6];
     int bytesReadCount = casInputStream.read(firstPartOfFile);
     casInputStream.reset();
-    String start = new String(firstPartOfFile, 0, bytesReadCount, 
"UTF-8").toLowerCase();
+    String start = new String(firstPartOfFile, 0, bytesReadCount, 
StandardCharsets.UTF_8).toLowerCase();
 
     if (start.startsWith("<?xml ")) {  // could be XCAS or XMI
       try {

Modified: 
uima/uv3/uimaj-v3/trunk/uimaj-core/src/main/java/org/apache/uima/util/TCasToInlineXml.java
URL: 
http://svn.apache.org/viewvc/uima/uv3/uimaj-v3/trunk/uimaj-core/src/main/java/org/apache/uima/util/TCasToInlineXml.java?rev=1848693&r1=1848692&r2=1848693&view=diff
==============================================================================
--- 
uima/uv3/uimaj-v3/trunk/uimaj-core/src/main/java/org/apache/uima/util/TCasToInlineXml.java
 (original)
+++ 
uima/uv3/uimaj-v3/trunk/uimaj-core/src/main/java/org/apache/uima/util/TCasToInlineXml.java
 Tue Dec 11 15:45:22 2018
@@ -20,7 +20,7 @@
 package org.apache.uima.util;
 
 import java.io.ByteArrayOutputStream;
-import java.io.UnsupportedEncodingException;
+import java.nio.charset.StandardCharsets;
 import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.List;
@@ -209,11 +209,9 @@ public class TCasToInlineXml implements
       handler.endDocument();
 
       // return XML string
-      return new String(byteArrayOutputStream.toByteArray(),"UTF-8");
+      return new String(byteArrayOutputStream.toByteArray(), 
StandardCharsets.UTF_8);
     } catch (SAXException e) {
       throw new UIMARuntimeException(e);
-    } catch (UnsupportedEncodingException e) {
-      throw new UIMARuntimeException(e);
     }
   }
 

Modified: 
uima/uv3/uimaj-v3/trunk/uimaj-core/src/main/java/org/apache/uima/util/impl/Settings_impl.java
URL: 
http://svn.apache.org/viewvc/uima/uv3/uimaj-v3/trunk/uimaj-core/src/main/java/org/apache/uima/util/impl/Settings_impl.java?rev=1848693&r1=1848692&r2=1848693&view=diff
==============================================================================
--- 
uima/uv3/uimaj-v3/trunk/uimaj-core/src/main/java/org/apache/uima/util/impl/Settings_impl.java
 (original)
+++ 
uima/uv3/uimaj-v3/trunk/uimaj-core/src/main/java/org/apache/uima/util/impl/Settings_impl.java
 Tue Dec 11 15:45:22 2018
@@ -26,6 +26,7 @@ import java.io.IOException;
 import java.io.InputStream;
 import java.io.InputStreamReader;
 import java.net.URL;
+import java.nio.charset.StandardCharsets;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.Set;
@@ -99,7 +100,7 @@ public class Settings_impl implements Se
    */
   public void load(InputStream in) throws IOException {
     // Process each logical line (after blanks & comments removed and 
continuations extended)
-    rdr = new BufferedReader(new InputStreamReader(in, "UTF-8"));
+    rdr = new BufferedReader(new InputStreamReader(in, 
StandardCharsets.UTF_8));
     String line;
     final String legalPunc = "./-~_";   // Acceptable punctuation characters
     while ((line = getLine()) != null) {

Modified: 
uima/uv3/uimaj-v3/trunk/uimaj-core/src/test/java/org/apache/uima/analysis_engine/impl/AnnotationWriter.java
URL: 
http://svn.apache.org/viewvc/uima/uv3/uimaj-v3/trunk/uimaj-core/src/test/java/org/apache/uima/analysis_engine/impl/AnnotationWriter.java?rev=1848693&r1=1848692&r2=1848693&view=diff
==============================================================================
--- 
uima/uv3/uimaj-v3/trunk/uimaj-core/src/test/java/org/apache/uima/analysis_engine/impl/AnnotationWriter.java
 (original)
+++ 
uima/uv3/uimaj-v3/trunk/uimaj-core/src/test/java/org/apache/uima/analysis_engine/impl/AnnotationWriter.java
 Tue Dec 11 15:45:22 2018
@@ -23,6 +23,7 @@ import java.io.File;
 import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.OutputStreamWriter;
+import java.nio.charset.StandardCharsets;
 
 import org.apache.uima.cas.CAS;
 import org.apache.uima.cas.FSIterator;
@@ -65,7 +66,8 @@ public class AnnotationWriter extends Ca
     this.outFile = new File(testBaseDir, "CpmOutput.txt");
 
     try {
-      this.fileWriter = new OutputStreamWriter(new 
FileOutputStream(this.outFile, false), "UTF-8");
+      this.fileWriter = new OutputStreamWriter(new 
FileOutputStream(this.outFile, false),
+              StandardCharsets.UTF_8);
     } catch (Exception e) {
       throw new ResourceInitializationException(e);
     }

Modified: 
uima/uv3/uimaj-v3/trunk/uimaj-core/src/test/java/org/apache/uima/analysis_engine/impl/TestAnnotator2.java
URL: 
http://svn.apache.org/viewvc/uima/uv3/uimaj-v3/trunk/uimaj-core/src/test/java/org/apache/uima/analysis_engine/impl/TestAnnotator2.java?rev=1848693&r1=1848692&r2=1848693&view=diff
==============================================================================
--- 
uima/uv3/uimaj-v3/trunk/uimaj-core/src/test/java/org/apache/uima/analysis_engine/impl/TestAnnotator2.java
 (original)
+++ 
uima/uv3/uimaj-v3/trunk/uimaj-core/src/test/java/org/apache/uima/analysis_engine/impl/TestAnnotator2.java
 Tue Dec 11 15:45:22 2018
@@ -24,6 +24,7 @@ import java.io.File;
 import java.io.FileInputStream;
 import java.io.IOException;
 import java.io.InputStream;
+import java.nio.charset.StandardCharsets;
 import java.util.HashMap;
 import java.util.Map;
 
@@ -39,7 +40,6 @@ import org.apache.uima.impl.UimaContext_
 import org.apache.uima.resource.Resource;
 import org.apache.uima.resource.ResourceConfigurationException;
 import org.apache.uima.resource.ResourceInitializationException;
-import org.apache.uima.test.junit_extension.JUnitExtension;
 import org.apache.uima.util.Settings;
 import org.apache.uima.util.UimaContextHolderTest;
 import org.apache.uima.util.XMLInputSource;
@@ -123,7 +123,7 @@ public class TestAnnotator2 extends CasA
                 "loop3 = three ${loop1} \n" ;
       InputStream is;
       try {
-        is = new ByteArrayInputStream(lines.getBytes("UTF-8"));
+        is = new ByteArrayInputStream(lines.getBytes(StandardCharsets.UTF_8));
         testSettings.load(is);
         is.close();
         String val = testSettings.lookUp("foo");

Modified: 
uima/uv3/uimaj-v3/trunk/uimaj-core/src/test/java/org/apache/uima/analysis_engine/impl/sequencer/SequencerTestAnnotator.java
URL: 
http://svn.apache.org/viewvc/uima/uv3/uimaj-v3/trunk/uimaj-core/src/test/java/org/apache/uima/analysis_engine/impl/sequencer/SequencerTestAnnotator.java?rev=1848693&r1=1848692&r2=1848693&view=diff
==============================================================================
--- 
uima/uv3/uimaj-v3/trunk/uimaj-core/src/test/java/org/apache/uima/analysis_engine/impl/sequencer/SequencerTestAnnotator.java
 (original)
+++ 
uima/uv3/uimaj-v3/trunk/uimaj-core/src/test/java/org/apache/uima/analysis_engine/impl/sequencer/SequencerTestAnnotator.java
 Tue Dec 11 15:45:22 2018
@@ -23,6 +23,7 @@ import java.io.File;
 import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.OutputStreamWriter;
+import java.nio.charset.StandardCharsets;
 import java.util.Arrays;
 import java.util.Comparator;
 
@@ -101,7 +102,7 @@ public class SequencerTestAnnotator exte
             if (fp.canWrite()) {
                // write result specification to the output file
                OutputStreamWriter writer = new OutputStreamWriter(
-                     new FileOutputStream(fp, true), "UTF-8");
+                     new FileOutputStream(fp, true), StandardCharsets.UTF_8);
                writer.write("\nResultSpec for annotator " + this.name + ":\n");
                TypeOrFeature[] tofs = resultSpec.getResultTypesAndFeatures();
                // sort by name to ensure consistent output for testing purposes

Modified: 
uima/uv3/uimaj-v3/trunk/uimaj-core/src/test/java/org/apache/uima/cas/impl/XmiCasDeserializerTest.java
URL: 
http://svn.apache.org/viewvc/uima/uv3/uimaj-v3/trunk/uimaj-core/src/test/java/org/apache/uima/cas/impl/XmiCasDeserializerTest.java?rev=1848693&r1=1848692&r2=1848693&view=diff
==============================================================================
--- 
uima/uv3/uimaj-v3/trunk/uimaj-core/src/test/java/org/apache/uima/cas/impl/XmiCasDeserializerTest.java
 (original)
+++ 
uima/uv3/uimaj-v3/trunk/uimaj-core/src/test/java/org/apache/uima/cas/impl/XmiCasDeserializerTest.java
 Tue Dec 11 15:45:22 2018
@@ -29,6 +29,7 @@ import java.io.InputStream;
 import java.io.PrintWriter;
 import java.io.StringReader;
 import java.io.StringWriter;
+import java.nio.charset.StandardCharsets;
 import java.util.Iterator;
 import java.util.List;
 
@@ -2154,7 +2155,7 @@ public class XmiCasDeserializerTest exte
     ByteArrayOutputStream baos = new ByteArrayOutputStream();    
     XmiCasSerializer.serialize(cas, null, baos, false, serSharedData);
     baos.close();
-    String xmiStr = new String(baos.toByteArray(), "UTF-8");   //note by 
default XmiCasSerializer generates UTF-8
+    String xmiStr = new String(baos.toByteArray(), StandardCharsets.UTF_8);   
//note by default XmiCasSerializer generates UTF-8
     
     //workaround for newline serialization problem in Sun Java 1.4.2
     //this test file should contain CRLF line endings, but Sun Java loses them
@@ -2171,7 +2172,7 @@ public class XmiCasDeserializerTest exte
     ByteArrayOutputStream baos = new ByteArrayOutputStream();    
     XmiCasSerializer.serialize(cas, null, baos, false, serSharedData, marker);
     baos.close();
-    String xmiStr = new String(baos.toByteArray(), "UTF-8");   //note by 
default XmiCasSerializer generates UTF-8
+    String xmiStr = new String(baos.toByteArray(), StandardCharsets.UTF_8);   
//note by default XmiCasSerializer generates UTF-8
     
     //workaround for newline serialization problem in Sun Java 1.4.2
     //this test file should contain CRLF line endings, but Sun Java loses them
@@ -2184,14 +2185,14 @@ public class XmiCasDeserializerTest exte
   
   /** Utility method for deserializing a CAS from an XMI String */
   private void deserialize(String xmlStr, CAS cas, XmiSerializationSharedData 
sharedData, boolean lenient, int mergePoint) throws FactoryConfigurationError, 
ParserConfigurationException, SAXException, IOException {
-    byte[] bytes = xmlStr.getBytes("UTF-8"); //this assumes the encoding is 
UTF-8, which is the default output encoding of the XmiCasSerializer
+    byte[] bytes = xmlStr.getBytes(StandardCharsets.UTF_8); //this assumes the 
encoding is UTF-8, which is the default output encoding of the XmiCasSerializer
     ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
     XmiCasDeserializer.deserialize(bais, cas, lenient, sharedData, mergePoint);
     bais.close();
   }
   
   private void deserialize(String xmlStr, CAS cas, XmiSerializationSharedData 
sharedData, boolean lenient, int mergePoint, AllowPreexistingFS allow) throws 
FactoryConfigurationError, ParserConfigurationException, SAXException, 
IOException {
-    byte[] bytes = xmlStr.getBytes("UTF-8"); //this assumes the encoding is 
UTF-8, which is the default output encoding of the XmiCasSerializer
+    byte[] bytes = xmlStr.getBytes(StandardCharsets.UTF_8); //this assumes the 
encoding is UTF-8, which is the default output encoding of the XmiCasSerializer
     ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
     XmiCasDeserializer.deserialize(bais, cas, lenient, sharedData, mergePoint, 
allow);
     bais.close();

Modified: 
uima/uv3/uimaj-v3/trunk/uimaj-core/src/test/java/org/apache/uima/cas/test/TypeOrderTest.java
URL: 
http://svn.apache.org/viewvc/uima/uv3/uimaj-v3/trunk/uimaj-core/src/test/java/org/apache/uima/cas/test/TypeOrderTest.java?rev=1848693&r1=1848692&r2=1848693&view=diff
==============================================================================
--- 
uima/uv3/uimaj-v3/trunk/uimaj-core/src/test/java/org/apache/uima/cas/test/TypeOrderTest.java
 (original)
+++ 
uima/uv3/uimaj-v3/trunk/uimaj-core/src/test/java/org/apache/uima/cas/test/TypeOrderTest.java
 Tue Dec 11 15:45:22 2018
@@ -23,6 +23,7 @@ import java.io.File;
 import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.OutputStreamWriter;
+import java.nio.charset.StandardCharsets;
 
 import org.apache.uima.UIMAFramework;
 import org.apache.uima.analysis_engine.AnalysisEngine;
@@ -193,7 +194,7 @@ public class TypeOrderTest extends TestC
     Assert.assertNotNull(refFile);
     File outputFile = new File(JUnitExtension.getFile("CASTests"), 
"CasTypeOderTest_testouput.txt");
     OutputStreamWriter fileWriter = new OutputStreamWriter(new 
FileOutputStream(
-            outputFile , false), "UTF-8");
+            outputFile , false), StandardCharsets.UTF_8);
     Assert.assertNotNull(fileWriter);   
     
     for (int i = 0; i < 10; i++) {

Modified: 
uima/uv3/uimaj-v3/trunk/uimaj-core/src/test/java/org/apache/uima/resource/impl/ConfigurableDataResourceSpecifier_implTest.java
URL: 
http://svn.apache.org/viewvc/uima/uv3/uimaj-v3/trunk/uimaj-core/src/test/java/org/apache/uima/resource/impl/ConfigurableDataResourceSpecifier_implTest.java?rev=1848693&r1=1848692&r2=1848693&view=diff
==============================================================================
--- 
uima/uv3/uimaj-v3/trunk/uimaj-core/src/test/java/org/apache/uima/resource/impl/ConfigurableDataResourceSpecifier_implTest.java
 (original)
+++ 
uima/uv3/uimaj-v3/trunk/uimaj-core/src/test/java/org/apache/uima/resource/impl/ConfigurableDataResourceSpecifier_implTest.java
 Tue Dec 11 15:45:22 2018
@@ -21,6 +21,7 @@ package org.apache.uima.resource.impl;
 
 import java.io.ByteArrayInputStream;
 import java.io.StringWriter;
+import java.nio.charset.StandardCharsets;
 
 import org.apache.uima.UIMAFramework;
 import org.apache.uima.resource.metadata.ConfigurationParameter;
@@ -67,7 +68,7 @@ public class ConfigurableDataResourceSpe
       String xmlStr = sw.getBuffer().toString();
 
       // parse back
-      ByteArrayInputStream inStream = new 
ByteArrayInputStream(xmlStr.getBytes("UTF-8"));
+      ByteArrayInputStream inStream = new 
ByteArrayInputStream(xmlStr.getBytes(StandardCharsets.UTF_8));
       XMLInputSource in = new XMLInputSource(inStream, null);
       ConfigurableDataResourceSpecifier_impl parsedSpec = 
(ConfigurableDataResourceSpecifier_impl) UIMAFramework
               .getXMLParser().parse(in);

Modified: 
uima/uv3/uimaj-v3/trunk/uimaj-core/src/test/java/org/apache/uima/resource/impl/DataResource_implTest.java
URL: 
http://svn.apache.org/viewvc/uima/uv3/uimaj-v3/trunk/uimaj-core/src/test/java/org/apache/uima/resource/impl/DataResource_implTest.java?rev=1848693&r1=1848692&r2=1848693&view=diff
==============================================================================
--- 
uima/uv3/uimaj-v3/trunk/uimaj-core/src/test/java/org/apache/uima/resource/impl/DataResource_implTest.java
 (original)
+++ 
uima/uv3/uimaj-v3/trunk/uimaj-core/src/test/java/org/apache/uima/resource/impl/DataResource_implTest.java
 Tue Dec 11 15:45:22 2018
@@ -24,6 +24,7 @@ import java.io.File;
 import java.io.InputStream;
 import java.io.InputStreamReader;
 import java.net.URL;
+import java.nio.charset.StandardCharsets;
 import java.util.Collections;
 
 import org.apache.uima.resource.ResourceInitializationException;
@@ -107,7 +108,7 @@ public class DataResource_implTest exten
 
       // try to get an input stream and read from the file
       InputStream inStr = dr.getInputStream();
-      BufferedReader bufRdr = new BufferedReader(new InputStreamReader(inStr, 
"utf-8"));
+      BufferedReader bufRdr = new BufferedReader(new InputStreamReader(inStr, 
StandardCharsets.UTF_8));
       String result = bufRdr.readLine();
       inStr.close();
 

Modified: 
uima/uv3/uimaj-v3/trunk/uimaj-core/src/test/java/org/apache/uima/resource/impl/TestResourceInterface_impl.java
URL: 
http://svn.apache.org/viewvc/uima/uv3/uimaj-v3/trunk/uimaj-core/src/test/java/org/apache/uima/resource/impl/TestResourceInterface_impl.java?rev=1848693&r1=1848692&r2=1848693&view=diff
==============================================================================
--- 
uima/uv3/uimaj-v3/trunk/uimaj-core/src/test/java/org/apache/uima/resource/impl/TestResourceInterface_impl.java
 (original)
+++ 
uima/uv3/uimaj-v3/trunk/uimaj-core/src/test/java/org/apache/uima/resource/impl/TestResourceInterface_impl.java
 Tue Dec 11 15:45:22 2018
@@ -23,6 +23,7 @@ import java.io.BufferedReader;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.InputStreamReader;
+import java.nio.charset.StandardCharsets;
 import java.util.Map;
 
 import org.apache.uima.resource.DataResource;
@@ -46,7 +47,7 @@ public class TestResourceInterface_impl
     try {
       // try to get an input stream and read from the file
       InputStream inStr = aData.getInputStream();
-      BufferedReader bufRdr = new BufferedReader(new InputStreamReader(inStr, 
"utf-8"));
+      BufferedReader bufRdr = new BufferedReader(new InputStreamReader(inStr, 
StandardCharsets.UTF_8));
       mString = bufRdr.readLine();
       inStr.close();
     } catch (IOException e) {

Modified: 
uima/uv3/uimaj-v3/trunk/uimaj-core/src/test/java/org/apache/uima/util/XMLSerializerTest.java
URL: 
http://svn.apache.org/viewvc/uima/uv3/uimaj-v3/trunk/uimaj-core/src/test/java/org/apache/uima/util/XMLSerializerTest.java?rev=1848693&r1=1848692&r2=1848693&view=diff
==============================================================================
--- 
uima/uv3/uimaj-v3/trunk/uimaj-core/src/test/java/org/apache/uima/util/XMLSerializerTest.java
 (original)
+++ 
uima/uv3/uimaj-v3/trunk/uimaj-core/src/test/java/org/apache/uima/util/XMLSerializerTest.java
 Tue Dec 11 15:45:22 2018
@@ -19,19 +19,18 @@
 package org.apache.uima.util;
 
 import java.io.ByteArrayOutputStream;
+import java.nio.charset.StandardCharsets;
 
-import javax.xml.XMLConstants;
 import javax.xml.transform.OutputKeys;
 import javax.xml.transform.Transformer;
 import javax.xml.transform.TransformerFactory;
 
+import junit.framework.TestCase;
 import org.apache.uima.internal.util.XMLUtils;
 import org.xml.sax.ContentHandler;
 import org.xml.sax.SAXParseException;
 import org.xml.sax.helpers.AttributesImpl;
 
-import junit.framework.TestCase;
-
 public class XMLSerializerTest extends TestCase {
 
   public void testXml10() throws Exception {
@@ -42,7 +41,7 @@ public class XMLSerializerTest extends T
     ch.startElement("","foo","foo", new AttributesImpl());
     ch.endElement("", "foo", "foo");
     ch.endDocument();
-    String xmlStr = new String(baos.toByteArray(), "UTF-8");
+    String xmlStr = new String(baos.toByteArray(), StandardCharsets.UTF_8);
     assertEquals("<?xml version=\"1.0\" encoding=\"UTF-8\"?><foo/>", xmlStr);  
  
   }
   
@@ -55,7 +54,7 @@ public class XMLSerializerTest extends T
     ch.startElement("","foo","foo", new AttributesImpl());
     ch.endElement("", "foo", "foo");
     ch.endDocument();
-    String xmlStr = new String(baos.toByteArray(), "UTF-8");
+    String xmlStr = new String(baos.toByteArray(), StandardCharsets.UTF_8);
 //    if (xmlStr.contains("1.0")) {
     // useful to investigate issues when bad XML output is produced
     //   related to which Java implementation is being used

Modified: 
uima/uv3/uimaj-v3/trunk/uimaj-ep-pear-packager/src/main/java/org/apache/uima/pear/nature/ProjectCustomizer.java
URL: 
http://svn.apache.org/viewvc/uima/uv3/uimaj-v3/trunk/uimaj-ep-pear-packager/src/main/java/org/apache/uima/pear/nature/ProjectCustomizer.java?rev=1848693&r1=1848692&r2=1848693&view=diff
==============================================================================
--- 
uima/uv3/uimaj-v3/trunk/uimaj-ep-pear-packager/src/main/java/org/apache/uima/pear/nature/ProjectCustomizer.java
 (original)
+++ 
uima/uv3/uimaj-v3/trunk/uimaj-ep-pear-packager/src/main/java/org/apache/uima/pear/nature/ProjectCustomizer.java
 Tue Dec 11 15:45:22 2018
@@ -21,6 +21,7 @@ package org.apache.uima.pear.nature;
 
 import java.io.ByteArrayInputStream;
 import java.io.InputStream;
+import java.nio.charset.StandardCharsets;
 
 import org.apache.uima.pear.PearException;
 import org.apache.uima.pear.insd.edit.PearInstallationDescriptor;
@@ -185,7 +186,7 @@ public class ProjectCustomizer {
           boolean overrideContentIfExist) throws PearException {
     InputStream is = null;
     try {
-      is = new ByteArrayInputStream(s.getBytes("UTF-8"));
+      is = new ByteArrayInputStream(s.getBytes(StandardCharsets.UTF_8));
       return createFile(project, fileName, is, overrideContentIfExist);
     } catch (Throwable e) {
       PearException subEx = new PearException(fileName + " could not be 
created/saved properly.", e);

Modified: 
uima/uv3/uimaj-v3/trunk/uimaj-examples/src/main/java/org/apache/uima/examples/cpe/InlineXmlCasConsumer.java
URL: 
http://svn.apache.org/viewvc/uima/uv3/uimaj-v3/trunk/uimaj-examples/src/main/java/org/apache/uima/examples/cpe/InlineXmlCasConsumer.java?rev=1848693&r1=1848692&r2=1848693&view=diff
==============================================================================
--- 
uima/uv3/uimaj-v3/trunk/uimaj-examples/src/main/java/org/apache/uima/examples/cpe/InlineXmlCasConsumer.java
 (original)
+++ 
uima/uv3/uimaj-v3/trunk/uimaj-examples/src/main/java/org/apache/uima/examples/cpe/InlineXmlCasConsumer.java
 Tue Dec 11 15:45:22 2018
@@ -24,6 +24,7 @@ import java.io.FileOutputStream;
 import java.io.IOException;
 import java.net.MalformedURLException;
 import java.net.URL;
+import java.nio.charset.StandardCharsets;
 
 import org.apache.uima.cas.CAS;
 import org.apache.uima.cas.CASException;
@@ -114,7 +115,7 @@ public class InlineXmlCasConsumer extend
     try {
       String xmlAnnotations = cas2xml.generateXML(aCAS);
       FileOutputStream outStream = new FileOutputStream(outFile);
-      outStream.write(xmlAnnotations.getBytes("UTF-8"));
+      outStream.write(xmlAnnotations.getBytes(StandardCharsets.UTF_8));
       outStream.close();
     } catch (CASException e) {
       throw new ResourceProcessException(e);

Modified: 
uima/uv3/uimaj-v3/trunk/uimaj-tools/src/main/java/org/apache/uima/tools/components/InlineXmlCasConsumer.java
URL: 
http://svn.apache.org/viewvc/uima/uv3/uimaj-v3/trunk/uimaj-tools/src/main/java/org/apache/uima/tools/components/InlineXmlCasConsumer.java?rev=1848693&r1=1848692&r2=1848693&view=diff
==============================================================================
--- 
uima/uv3/uimaj-v3/trunk/uimaj-tools/src/main/java/org/apache/uima/tools/components/InlineXmlCasConsumer.java
 (original)
+++ 
uima/uv3/uimaj-v3/trunk/uimaj-tools/src/main/java/org/apache/uima/tools/components/InlineXmlCasConsumer.java
 Tue Dec 11 15:45:22 2018
@@ -25,6 +25,7 @@ import java.io.IOException;
 import java.io.InputStream;
 import java.net.MalformedURLException;
 import java.net.URL;
+import java.nio.charset.StandardCharsets;
 
 import org.apache.uima.UIMAFramework;
 import org.apache.uima.cas.CAS;
@@ -155,7 +156,7 @@ public class InlineXmlCasConsumer extend
       outStream = new FileOutputStream(outFile);
       if (hasDefaultView) {
         String xmlAnnotations = cas2xml.generateXML(aCAS);
-        outStream.write(xmlAnnotations.getBytes("UTF-8"));
+        outStream.write(xmlAnnotations.getBytes(StandardCharsets.UTF_8));
       } else {
         XMLSerializer xmlSer = new XMLSerializer(outStream, false);
         if (mXCAS.equalsIgnoreCase("xcas")) {

Modified: 
uima/uv3/uimaj-v3/trunk/uimaj-tools/src/main/java/org/apache/uima/tools/docanalyzer/AnnotationViewerDialog.java
URL: 
http://svn.apache.org/viewvc/uima/uv3/uimaj-v3/trunk/uimaj-tools/src/main/java/org/apache/uima/tools/docanalyzer/AnnotationViewerDialog.java?rev=1848693&r1=1848692&r2=1848693&view=diff
==============================================================================
--- 
uima/uv3/uimaj-v3/trunk/uimaj-tools/src/main/java/org/apache/uima/tools/docanalyzer/AnnotationViewerDialog.java
 (original)
+++ 
uima/uv3/uimaj-v3/trunk/uimaj-tools/src/main/java/org/apache/uima/tools/docanalyzer/AnnotationViewerDialog.java
 Tue Dec 11 15:45:22 2018
@@ -36,6 +36,7 @@ import java.io.FileOutputStream;
 import java.io.FileWriter;
 import java.io.FilenameFilter;
 import java.io.IOException;
+import java.nio.charset.StandardCharsets;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
@@ -542,7 +543,7 @@ public class AnnotationViewerDialog exte
         casToInlineXml.setFormattedOutput(false);
         String xmlAnnotations = casToInlineXml.generateXML(defaultView);
         FileOutputStream outStream = new FileOutputStream(inlineXmlFile);
-        outStream.write(xmlAnnotations.getBytes("UTF-8"));
+        outStream.write(xmlAnnotations.getBytes(StandardCharsets.UTF_8));
         outStream.close();
 
         if (xmlRBisSelected) // JMP passed in


Reply via email to