You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jena.apache.org by an...@apache.org on 2017/08/29 12:05:00 UTC

[1/2] jena git commit: Add commons-io to jena-base as dependency.

Repository: jena
Updated Branches:
  refs/heads/master beb39af72 -> bbad94844


Add commons-io to jena-base as dependency.

Use std libraries (JDK, CommonsIO) in FileUtils.




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

Branch: refs/heads/master
Commit: cd39830890379f7a68dc56608583a1900fd586dd
Parents: beb39af
Author: Andy Seaborne <an...@apache.org>
Authored: Sat Aug 26 12:48:31 2017 +0100
Committer: Andy Seaborne <an...@apache.org>
Committed: Sat Aug 26 12:48:31 2017 +0100

----------------------------------------------------------------------
 jena-base/pom.xml                               |  5 +++
 .../java/org/apache/jena/util/FileUtils.java    | 39 +++++---------------
 .../org/apache/jena/test/TestSystemSetup.java   | 13 +++----
 jena-fuseki2/jena-fuseki-core/pom.xml           |  9 -----
 jena-project/pom.xml                            |  8 +++-
 5 files changed, 27 insertions(+), 47 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jena/blob/cd398308/jena-base/pom.xml
----------------------------------------------------------------------
diff --git a/jena-base/pom.xml b/jena-base/pom.xml
index d196762..f50a93d 100644
--- a/jena-base/pom.xml
+++ b/jena-base/pom.xml
@@ -46,6 +46,11 @@
     </dependency> 
 
     <dependency>
+      <groupId>commons-io</groupId>
+      <artifactId>commons-io</artifactId>
+    </dependency> 
+
+    <dependency>
       <groupId>org.apache.commons</groupId>
       <artifactId>commons-lang3</artifactId>
     </dependency>

http://git-wip-us.apache.org/repos/asf/jena/blob/cd398308/jena-core/src/main/java/org/apache/jena/util/FileUtils.java
----------------------------------------------------------------------
diff --git a/jena-core/src/main/java/org/apache/jena/util/FileUtils.java b/jena-core/src/main/java/org/apache/jena/util/FileUtils.java
index 3401939..046d7dc 100644
--- a/jena-core/src/main/java/org/apache/jena/util/FileUtils.java
+++ b/jena-core/src/main/java/org/apache/jena/util/FileUtils.java
@@ -22,7 +22,11 @@ import java.io.* ;
 import java.net.URL ;
 import java.nio.charset.Charset ;
 import java.nio.charset.StandardCharsets ;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
 
+import org.apache.commons.io.IOUtils;
 import org.apache.jena.JenaRuntime ;
 import org.apache.jena.shared.JenaException ;
 import org.apache.jena.shared.WrappedIOException ;
@@ -374,8 +378,9 @@ public class FileUtils
      */
     
     public static String readWholeFileAsUTF8(String filename) throws IOException {
-        InputStream in = new FileInputStream(filename) ;
-        return readWholeFileAsUTF8(in) ;
+        Path path = Paths.get(filename);
+        byte b[] = Files.readAllBytes(path);
+        return new String(b, utf8);
     }
 
     /** Read a whole stream as UTF-8
@@ -384,33 +389,7 @@ public class FileUtils
      * @return      String
      * @throws IOException
      */
-    public static String readWholeFileAsUTF8(InputStream in) throws IOException
-    {
-        try ( Reader r = new BufferedReader(asUTF8(in),1024) ) {
-            return readWholeFileAsUTF8(r) ;
-        }
+    public static String readWholeFileAsUTF8(InputStream in) throws IOException {
+        return IOUtils.toString(in, utf8);
     }
-    
-    /** Read a whole file as UTF-8
-     * 
-     * @param r
-     * @return String The whole file
-     * @throws IOException
-     */
-    
-    // Private worker as we are trying to force UTF-8. 
-    private static String readWholeFileAsUTF8(Reader r) throws IOException
-    {
-        try ( StringWriter sw = new StringWriter(1024) ) {
-            char buff[] = new char[1024];
-            int l ; 
-            while ((l = r.read(buff))!=-1) {         // .ready does not work with HttpClient streams.
-                if (l <= 0)
-                    break;
-                sw.write(buff, 0, l);
-            }
-            return sw.toString();
-        }
-    }
-
 }

http://git-wip-us.apache.org/repos/asf/jena/blob/cd398308/jena-core/src/test/java/org/apache/jena/test/TestSystemSetup.java
----------------------------------------------------------------------
diff --git a/jena-core/src/test/java/org/apache/jena/test/TestSystemSetup.java b/jena-core/src/test/java/org/apache/jena/test/TestSystemSetup.java
index 0b1fccb..b09cbbe 100644
--- a/jena-core/src/test/java/org/apache/jena/test/TestSystemSetup.java
+++ b/jena-core/src/test/java/org/apache/jena/test/TestSystemSetup.java
@@ -18,18 +18,18 @@
 
 package org.apache.jena.test;
 
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.List;
+
 import junit.framework.TestCase ;
 import junit.framework.TestSuite ;
-import org.apache.commons.io.IOUtils;
 import org.apache.commons.lang3.SystemUtils;
 import org.apache.jena.JenaRuntime ;
+import org.apache.jena.util.FileUtils;
 import org.apache.jena.vocabulary.RDFS;
 import org.junit.Assert;
 
-import java.io.IOException;
-import java.util.Arrays;
-import java.util.List;
-
 public class TestSystemSetup extends TestCase {
 
     public static TestSuite suite() {
@@ -61,8 +61,7 @@ public class TestSystemSetup extends TestCase {
 
         Assert.assertEquals(0, child.waitFor());
         Assert.assertEquals(RDFS.subClassOf.toString()+"\n",
-                IOUtils.toString(child.getInputStream()));
+                            FileUtils.readWholeFileAsUTF8(child.getInputStream()));
     }
-
 }
 

http://git-wip-us.apache.org/repos/asf/jena/blob/cd398308/jena-fuseki2/jena-fuseki-core/pom.xml
----------------------------------------------------------------------
diff --git a/jena-fuseki2/jena-fuseki-core/pom.xml b/jena-fuseki2/jena-fuseki-core/pom.xml
index c93ddcd..ba22512 100644
--- a/jena-fuseki2/jena-fuseki-core/pom.xml
+++ b/jena-fuseki2/jena-fuseki-core/pom.xml
@@ -99,15 +99,6 @@
       <groupId>org.apache.jena</groupId>
       <artifactId>jena-text</artifactId>
       <version>3.5.0-SNAPSHOT</version>
-      <exclusions>
-        <!--
-          Get this via commons-fileupload and also via jena-text/sol4j
-        -->
-        <exclusion>
-          <groupId>commons-io</groupId>
-          <artifactId>commons-io</artifactId>
-        </exclusion>
-      </exclusions>
     </dependency>
 
     <dependency>

http://git-wip-us.apache.org/repos/asf/jena/blob/cd398308/jena-project/pom.xml
----------------------------------------------------------------------
diff --git a/jena-project/pom.xml b/jena-project/pom.xml
index 5d83779..eee5842 100644
--- a/jena-project/pom.xml
+++ b/jena-project/pom.xml
@@ -166,6 +166,12 @@
       </dependency>
       
       <dependency>
+        <groupId>commons-io</groupId>
+        <artifactId>commons-io</artifactId>
+        <version>${ver.commonsio}</version>
+      </dependency>
+      
+      <dependency>
         <groupId>org.apache.thrift</groupId>
         <artifactId>libthrift</artifactId>
         <version>${ver.libthrift}</version>
@@ -197,7 +203,7 @@
       <dependency>
         <groupId>commons-fileupload</groupId>
         <artifactId>commons-fileupload</artifactId>
-        <version>1.3.2</version>
+        <version>1.3.3</version>
       </dependency>
 
       <dependency>


[2/2] jena git commit: JENA-1387: Merge commit 'refs/pull/276/head' of github.com:apache/jena

Posted by an...@apache.org.
JENA-1387: Merge commit 'refs/pull/276/head' of github.com:apache/jena

This closes #276.


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

Branch: refs/heads/master
Commit: bbad94844362d06126dc3f171995debb5853b0d9
Parents: beb39af cd39830
Author: Andy Seaborne <an...@apache.org>
Authored: Tue Aug 29 12:37:55 2017 +0100
Committer: Andy Seaborne <an...@apache.org>
Committed: Tue Aug 29 12:37:55 2017 +0100

----------------------------------------------------------------------
 jena-base/pom.xml                               |  5 +++
 .../java/org/apache/jena/util/FileUtils.java    | 39 +++++---------------
 .../org/apache/jena/test/TestSystemSetup.java   | 13 +++----
 jena-fuseki2/jena-fuseki-core/pom.xml           |  9 -----
 jena-project/pom.xml                            |  8 +++-
 5 files changed, 27 insertions(+), 47 deletions(-)
----------------------------------------------------------------------