hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sra...@apache.org
Subject svn commit: r1344959 - in /hadoop/common/branches/branch-1-win: CHANGES.txt src/core/org/apache/hadoop/fs/HarFileSystem.java
Date Fri, 01 Jun 2012 01:20:24 GMT
Author: sradia
Date: Fri Jun  1 01:20:23 2012
New Revision: 1344959

URL: http://svn.apache.org/viewvc?rev=1344959&view=rev
Log:
    HADOOP-8440 HarFileSystem.decodeHarURI fails for URIs whose host contains numbers  (Ivan
Mitic via Sanjay Radia)

Modified:
    hadoop/common/branches/branch-1-win/CHANGES.txt
    hadoop/common/branches/branch-1-win/src/core/org/apache/hadoop/fs/HarFileSystem.java

Modified: hadoop/common/branches/branch-1-win/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-1-win/CHANGES.txt?rev=1344959&r1=1344958&r2=1344959&view=diff
==============================================================================
--- hadoop/common/branches/branch-1-win/CHANGES.txt (original)
+++ hadoop/common/branches/branch-1-win/CHANGES.txt Fri Jun  1 01:20:23 2012
@@ -23,6 +23,8 @@ branch-hadoop-1-win - unreleased
     HADOOP-8411 TestStorageDirecotyFailure, TestTaskLogsTruncater, TestWebHdfsUrl and TestSecurityUtil
                 fail on Windows  (Ivan Mitic via Sanjay Radia)
 
+    HADOOP-8440 HarFileSystem.decodeHarURI fails for URIs whose host contains numbers  (Ivan
Mitic via Sanjay Radia)
+
 Release 1.1.0 - unreleased
 
   NEW FEATURES

Modified: hadoop/common/branches/branch-1-win/src/core/org/apache/hadoop/fs/HarFileSystem.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-1-win/src/core/org/apache/hadoop/fs/HarFileSystem.java?rev=1344959&r1=1344958&r2=1344959&view=diff
==============================================================================
--- hadoop/common/branches/branch-1-win/src/core/org/apache/hadoop/fs/HarFileSystem.java (original)
+++ hadoop/common/branches/branch-1-win/src/core/org/apache/hadoop/fs/HarFileSystem.java Fri
Jun  1 01:20:23 2012
@@ -185,32 +185,33 @@ public class HarFileSystem extends Filte
       //create a path 
       return FileSystem.getDefaultUri(conf);
     }
-    String host = rawURI.getHost();
-    if (host == null) {
+    String authority = rawURI.getAuthority();
+    if (authority == null) {
       throw new IOException("URI: " + rawURI
-          + " is an invalid Har URI since host==null."
+          + " is an invalid Har URI since authority==null."
           + "  Expecting har://<scheme>-<host>/<path>.");
     }
-    int i = host.indexOf('-');
+
+    int i = authority.indexOf('-');
     if (i < 0) {
       throw new IOException("URI: " + rawURI
           + " is an invalid Har URI since '-' not found."
           + "  Expecting har://<scheme>-<host>/<path>.");
     }
-    final String underLyingScheme = host.substring(0, i);
-    i++;
-    final String underLyingHost = i == host.length()? null: host.substring(i);
-    int underLyingPort = rawURI.getPort();
-    String auth = (underLyingHost == null && underLyingPort == -1)?
-                  null:(underLyingHost+":"+underLyingPort);
-    URI tmp = null;
+
     if (rawURI.getQuery() != null) {
       // query component not allowed
       throw new IOException("query component in Path not supported  " + rawURI);
     }
+
+    URI tmp = null;
+
     try {
-      tmp = new URI(underLyingScheme, auth, rawURI.getPath(), 
-            rawURI.getQuery(), rawURI.getFragment());
+      // convert <scheme>-<host> to <scheme>://<host>
+      URI baseUri = new URI(authority.replaceFirst("-", "://"));
+
+      tmp = new URI(baseUri.getScheme(), baseUri.getAuthority(),
+            rawURI.getPath(), rawURI.getQuery(), rawURI.getFragment());
     } catch (URISyntaxException e) {
         // do nothing should not happen
     }



Mime
View raw message