jena-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a...@apache.org
Subject [09/16] jena git commit: Use StandardCharsets where possible.
Date Wed, 13 May 2015 21:16:15 GMT
Use StandardCharsets where possible.


Project: http://git-wip-us.apache.org/repos/asf/jena/repo
Commit: http://git-wip-us.apache.org/repos/asf/jena/commit/f138e29d
Tree: http://git-wip-us.apache.org/repos/asf/jena/tree/f138e29d
Diff: http://git-wip-us.apache.org/repos/asf/jena/diff/f138e29d

Branch: refs/heads/master
Commit: f138e29d1e18d3b7699e52eb0b924e7ff5277ce0
Parents: 4c1d85d
Author: Andy Seaborne <andy@apache.org>
Authored: Mon May 4 10:12:15 2015 +0100
Committer: Andy Seaborne <andy@apache.org>
Committed: Mon May 4 18:04:42 2015 +0100

----------------------------------------------------------------------
 .../apache/jena/riot/lang/TestPipedRDFIterators.java  |  3 ++-
 .../org/apache/jena/riot/writer/TestTurtleWriter.java |  1 -
 .../main/java/org/apache/jena/atlas/lib/Chars.java    | 14 +++-----------
 jena-sdb/src/test/java/sdb/test/TestStringBase.java   |  3 ---
 4 files changed, 5 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jena/blob/f138e29d/jena-arq/src/test/java/org/apache/jena/riot/lang/TestPipedRDFIterators.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/test/java/org/apache/jena/riot/lang/TestPipedRDFIterators.java b/jena-arq/src/test/java/org/apache/jena/riot/lang/TestPipedRDFIterators.java
index d94fd9e..aaff63d 100644
--- a/jena-arq/src/test/java/org/apache/jena/riot/lang/TestPipedRDFIterators.java
+++ b/jena-arq/src/test/java/org/apache/jena/riot/lang/TestPipedRDFIterators.java
@@ -20,6 +20,7 @@ package org.apache.jena.riot.lang;
 
 import java.io.ByteArrayInputStream ;
 import java.nio.charset.Charset ;
+import java.nio.charset.StandardCharsets ;
 import java.util.concurrent.* ;
 
 import org.apache.jena.graph.Triple ;
@@ -392,7 +393,7 @@ public class TestPipedRDFIterators {
 
             @Override
             public void run() {
-                Charset utf8 = Charset.forName("utf8");
+                Charset utf8 = StandardCharsets.UTF_8 ;
                 ByteArrayInputStream input = new ByteArrayInputStream(data.getBytes(utf8));
                 try {
                     RDFDataMgr.parse(out, input, null, RDFLanguages.TURTLE, null);

http://git-wip-us.apache.org/repos/asf/jena/blob/f138e29d/jena-arq/src/test/java/org/apache/jena/riot/writer/TestTurtleWriter.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/test/java/org/apache/jena/riot/writer/TestTurtleWriter.java b/jena-arq/src/test/java/org/apache/jena/riot/writer/TestTurtleWriter.java
index 3d2c65f..1bb0567 100644
--- a/jena-arq/src/test/java/org/apache/jena/riot/writer/TestTurtleWriter.java
+++ b/jena-arq/src/test/java/org/apache/jena/riot/writer/TestTurtleWriter.java
@@ -94,7 +94,6 @@ public class TestTurtleWriter {
         RDFDataMgr.write(output, m, Lang.TURTLE);
         
         ByteArrayInputStream input = new ByteArrayInputStream(output.toByteArray());
-        //System.out.println(new String(output.toByteArray(), Charset.forName("utf-8")));
         Model m2 = ModelFactory.createDefaultModel();
         RDFDataMgr.read(m2, input, Lang.TURTLE);
         Assert.assertTrue(m2.size() > 0);

http://git-wip-us.apache.org/repos/asf/jena/blob/f138e29d/jena-base/src/main/java/org/apache/jena/atlas/lib/Chars.java
----------------------------------------------------------------------
diff --git a/jena-base/src/main/java/org/apache/jena/atlas/lib/Chars.java b/jena-base/src/main/java/org/apache/jena/atlas/lib/Chars.java
index e9d4f55..d8a6dbc 100644
--- a/jena-base/src/main/java/org/apache/jena/atlas/lib/Chars.java
+++ b/jena-base/src/main/java/org/apache/jena/atlas/lib/Chars.java
@@ -18,10 +18,7 @@
 
 package org.apache.jena.atlas.lib;
 
-import java.nio.charset.Charset ;
-import java.nio.charset.CharsetDecoder ;
-import java.nio.charset.CharsetEncoder ;
-import java.nio.charset.CodingErrorAction ;
+import java.nio.charset.* ;
 
 public class Chars
 {
@@ -48,13 +45,8 @@ public class Chars
 //        'o' , 'p' , 'q' , 'r' , 's' , 't' ,
 //        'u' , 'v' , 'w' , 'x' , 'y' , 'z'
     
-    /** Java name for UTF-8 encoding */
-    private static final String encodingUTF8     = "utf-8" ;
-    /** Java name for ASCII encoding */
-    private static final String encodingASCII    = "ascii" ;
-    
-    public static final Charset charsetUTF8 = Charset.forName(encodingUTF8) ;
-    public static final Charset charsetASCII = Charset.forName(encodingASCII) ;
+    public static final Charset charsetUTF8 = StandardCharsets.UTF_8 ;
+    public static final Charset charsetASCII = StandardCharsets.US_ASCII ;
     
     // Pools for encoders/decoder.
     // Better? use a ThreadLocal.

http://git-wip-us.apache.org/repos/asf/jena/blob/f138e29d/jena-sdb/src/test/java/sdb/test/TestStringBase.java
----------------------------------------------------------------------
diff --git a/jena-sdb/src/test/java/sdb/test/TestStringBase.java b/jena-sdb/src/test/java/sdb/test/TestStringBase.java
index 2cb693e..acd5f12 100644
--- a/jena-sdb/src/test/java/sdb/test/TestStringBase.java
+++ b/jena-sdb/src/test/java/sdb/test/TestStringBase.java
@@ -39,9 +39,6 @@ public class TestStringBase extends TestDB
     private String baseString ; 
     
 
-    //static Charset csUTF8 = Charset.forName("UTF-8") ;
-
-
     public TestStringBase(String testLabel, String baseString, 
                     Connection jdbc, Params params, boolean verbose)
     {


Mime
View raw message