jena-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a...@apache.org
Subject [07/10] jena git commit: JENA-1463: Fix for file://host/path
Date Mon, 15 Jan 2018 11:48:12 GMT
JENA-1463: Fix for file://host/path

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

Branch: refs/heads/master
Commit: 1d037e80dfd8a91e9c4042f65695cadec4b17097
Parents: aecfaac
Author: Andy Seaborne <andy@apache.org>
Authored: Sat Jan 13 17:24:29 2018 +0000
Committer: Andy Seaborne <andy@apache.org>
Committed: Sat Jan 13 17:24:29 2018 +0000

----------------------------------------------------------------------
 jena-base/src/main/java/org/apache/jena/atlas/lib/IRILib.java | 6 +++---
 .../org/apache/jena/atlas/lib/TestFilenameProcessing.java     | 7 +++++--
 2 files changed, 8 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jena/blob/1d037e80/jena-base/src/main/java/org/apache/jena/atlas/lib/IRILib.java
----------------------------------------------------------------------
diff --git a/jena-base/src/main/java/org/apache/jena/atlas/lib/IRILib.java b/jena-base/src/main/java/org/apache/jena/atlas/lib/IRILib.java
index 18f3b94..ffe05de 100644
--- a/jena-base/src/main/java/org/apache/jena/atlas/lib/IRILib.java
+++ b/jena-base/src/main/java/org/apache/jena/atlas/lib/IRILib.java
@@ -192,14 +192,14 @@ public class IRILib
             return plainFilenameToURL(fn2) ;
         }
         
-        // Starts file:///
+        // Starts file:// or file:/// 
         if ( fn.startsWith("file:///") )
             // Assume it's good and return as-is.
             return fn ;
 
         if ( fn.startsWith("file://") ) {
-            String fn2 = fn.substring("file:/".length()) ;  // Leave one "/"
-            return plainFilenameToURL(fn2) ;
+            // file: URL with host name (maybe!)
+            return fn ;
         }
 
         // Must be file:/

http://git-wip-us.apache.org/repos/asf/jena/blob/1d037e80/jena-base/src/test/java/org/apache/jena/atlas/lib/TestFilenameProcessing.java
----------------------------------------------------------------------
diff --git a/jena-base/src/test/java/org/apache/jena/atlas/lib/TestFilenameProcessing.java
b/jena-base/src/test/java/org/apache/jena/atlas/lib/TestFilenameProcessing.java
index e34fe3e..84d08c4 100644
--- a/jena-base/src/test/java/org/apache/jena/atlas/lib/TestFilenameProcessing.java
+++ b/jena-base/src/test/java/org/apache/jena/atlas/lib/TestFilenameProcessing.java
@@ -65,8 +65,11 @@ public class TestFilenameProcessing extends BaseTest
 
     @Test
     public void fileIRI_3() {
-        String uri = testFileIRI("file://D.ttl") ;
-        assertTrue(uri.endsWith("D.ttl")) ;
+        String fn = "file://some.host/D.ttl" ;
+        String uri1 = IRILib.filenameToIRI(fn) ;
+        assertEquals(fn, uri1);
+        String uri2 = IRILib.filenameToIRI(uri1) ;
+        assertEquals(uri1, uri2) ;
     }
 
     @Test


Mime
View raw message