You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@uima.apache.org by sc...@apache.org on 2018/12/11 15:50:45 UTC

svn commit: r1848695 - /uima/uv3/uimaj-v3/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/CASImpl.java

Author: schor
Date: Tue Dec 11 15:50:44 2018
New Revision: 1848695

URL: http://svn.apache.org/viewvc?rev=1848695&view=rev
Log:
[UIMA-5390] StandardCharsets.UTF_8, plus use local var 

Modified:
    uima/uv3/uimaj-v3/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/CASImpl.java

Modified: uima/uv3/uimaj-v3/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/CASImpl.java
URL: http://svn.apache.org/viewvc/uima/uv3/uimaj-v3/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/CASImpl.java?rev=1848695&r1=1848694&r2=1848695&view=diff
==============================================================================
--- uima/uv3/uimaj-v3/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/CASImpl.java (original)
+++ uima/uv3/uimaj-v3/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/CASImpl.java Tue Dec 11 15:50:44 2018
@@ -34,6 +34,7 @@ import java.lang.invoke.MethodType;
 import java.lang.invoke.MutableCallSite;
 import java.net.URL;
 import java.nio.ByteBuffer;
+import java.nio.charset.StandardCharsets;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.BitSet;
@@ -1661,11 +1662,7 @@ public class CASImpl extends AbstractCas
 
     if (null != sd) {
       ByteArrayInputStream bis;
-      try {
-        bis = new ByteArrayInputStream(sd.getBytes("UTF-8"));
-      } catch (UnsupportedEncodingException e) {
-        throw new RuntimeException(e);  // never happen 
-      }
+      bis = new ByteArrayInputStream(sd.getBytes(StandardCharsets.UTF_8));
       return bis;
       
     } else if (null != aSofa.getLocalFSData()) {
@@ -1683,11 +1680,7 @@ public class CASImpl extends AbstractCas
           }
           sb.append(theArray[i]);
         }
-        try {
-          return new ByteArrayInputStream(sb.toString().getBytes("UTF-8") );
-        } catch (UnsupportedEncodingException e) {
-          throw new RuntimeException(e);  // never happen 
-        }
+        return new ByteArrayInputStream(sb.toString().getBytes(StandardCharsets.UTF_8) );
       }
       case intArrayTypeCode: {
         final int[] theArray = ((IntegerArray) fs)._getTheArray();
@@ -1765,7 +1758,7 @@ public class CASImpl extends AbstractCas
 //      System.out.format("debug committing ts %s classLoader %s%n", ts.hashCode(), cl);
       if (!ts.isCommitted()) {
         ts.set_skip_loading_user_jcas(skip_loading_user_jcas);
-        TypeSystemImpl tsc = ts.commit(getJCasClassLoader());
+        TypeSystemImpl tsc = ts.commit(cl);
         if (tsc != ts) {
           installTypeSystemInAllViews(tsc);
           ts = tsc;