hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sra...@apache.org
Subject svn commit: r1352350 - in /hadoop/common/branches/branch-1-win: CHANGES.txt src/core/org/apache/hadoop/fs/HarFileSystem.java src/test/org/apache/hadoop/fs/TestHarFileSystem.java
Date Wed, 20 Jun 2012 21:45:54 GMT
Author: sradia
Date: Wed Jun 20 21:45:54 2012
New Revision: 1352350

URL: http://svn.apache.org/viewvc?rev=1352350&view=rev
Log:
HADOOP-8440 HarFileSystem.decodeHarURI 2nd patch (HADOOP-8440-branch-1-win.2.patch) (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
    hadoop/common/branches/branch-1-win/src/test/org/apache/hadoop/fs/TestHarFileSystem.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=1352350&r1=1352349&r2=1352350&view=diff
==============================================================================
--- hadoop/common/branches/branch-1-win/CHANGES.txt (original)
+++ hadoop/common/branches/branch-1-win/CHANGES.txt Wed Jun 20 21:45:54 2012
@@ -33,6 +33,9 @@ branch-hadoop-1-win - unreleased
 
     MAPREDUCE-4260 Use JobObject to spawn tasks on Windows (Bikas Saha via Sanjay)
 
+    HADOOP-8440 HarFileSystem.decodeHarURI 2nd patch (HADOOP-8440-branch-1-win.2.patch) (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=1352350&r1=1352349&r2=1352350&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 Wed
Jun 20 21:45:54 2012
@@ -213,7 +213,8 @@ public class HarFileSystem extends Filte
       tmp = new URI(baseUri.getScheme(), baseUri.getAuthority(),
             rawURI.getPath(), rawURI.getQuery(), rawURI.getFragment());
     } catch (URISyntaxException e) {
-        // do nothing should not happen
+      throw new IOException("URI: " + rawURI
+          + " is an invalid Har URI. Expecting har://<scheme>-<host>/<path>.");
     }
     return tmp;
   }

Modified: hadoop/common/branches/branch-1-win/src/test/org/apache/hadoop/fs/TestHarFileSystem.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-1-win/src/test/org/apache/hadoop/fs/TestHarFileSystem.java?rev=1352350&r1=1352349&r2=1352350&view=diff
==============================================================================
--- hadoop/common/branches/branch-1-win/src/test/org/apache/hadoop/fs/TestHarFileSystem.java
(original)
+++ hadoop/common/branches/branch-1-win/src/test/org/apache/hadoop/fs/TestHarFileSystem.java
Wed Jun 20 21:45:54 2012
@@ -170,7 +170,29 @@ public class TestHarFileSystem extends T
       assertTrue(status.getBlockSize() == blockSize);
     }
   }
-  
+
+  public void testHarUri() {
+    final Configuration conf = new Configuration();
+    checkInvalidPath("har://hdfs-/foo.har", conf);
+    checkInvalidPath("har://hdfs/foo.har", conf);
+    checkInvalidPath("har://-hdfs/foo.har", conf);
+    checkInvalidPath("har://-/foo.har", conf);
+    checkInvalidPath("har://127.0.0.1-/foo.har", conf);
+    checkInvalidPath("har://127.0.0.1/foo.har", conf);
+  }
+
+  static void checkInvalidPath(String s, Configuration conf) {
+    System.out.println("\ncheckInvalidPath: " + s);
+    final Path p = new Path(s);
+    try {
+      p.getFileSystem(conf);
+      assertTrue(p + " is an invalid path.", false);
+    } catch (IOException e) {
+      System.out.println("GOOD: Got an exception.");
+      e.printStackTrace(System.out);
+    }
+  }
+
   // test archives with a -p option
   public void testRelativeArchives() throws Exception {
     fs.delete(archivePath, true);



Mime
View raw message