hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s..@apache.org
Subject svn commit: r642372 - in /hadoop/core/branches/branch-0.16: CHANGES.txt src/java/org/apache/hadoop/dfs/DistributedFileSystem.java src/test/org/apache/hadoop/security/TestPermission.java
Date Fri, 28 Mar 2008 20:47:05 GMT
Author: shv
Date: Fri Mar 28 13:47:02 2008
New Revision: 642372

URL: http://svn.apache.org/viewvc?rev=642372&view=rev
Log:
HADOOP-3108. Correction to the previous patch. Contributed by Konstantin Shvachko.

Modified:
    hadoop/core/branches/branch-0.16/CHANGES.txt
    hadoop/core/branches/branch-0.16/src/java/org/apache/hadoop/dfs/DistributedFileSystem.java
    hadoop/core/branches/branch-0.16/src/test/org/apache/hadoop/security/TestPermission.java

Modified: hadoop/core/branches/branch-0.16/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/core/branches/branch-0.16/CHANGES.txt?rev=642372&r1=642371&r2=642372&view=diff
==============================================================================
--- hadoop/core/branches/branch-0.16/CHANGES.txt (original)
+++ hadoop/core/branches/branch-0.16/CHANGES.txt Fri Mar 28 13:47:02 2008
@@ -851,6 +851,8 @@
 
     HADOOP-3108. Fix NPE in setPermission and setOwner. (shv)
 
+    HADOOP-3108. Correction to the previous patch. (shv)
+
 Release 0.15.3 - 2008-01-18
 
   BUG FIXES

Modified: hadoop/core/branches/branch-0.16/src/java/org/apache/hadoop/dfs/DistributedFileSystem.java
URL: http://svn.apache.org/viewvc/hadoop/core/branches/branch-0.16/src/java/org/apache/hadoop/dfs/DistributedFileSystem.java?rev=642372&r1=642371&r2=642372&view=diff
==============================================================================
--- hadoop/core/branches/branch-0.16/src/java/org/apache/hadoop/dfs/DistributedFileSystem.java
(original)
+++ hadoop/core/branches/branch-0.16/src/java/org/apache/hadoop/dfs/DistributedFileSystem.java
Fri Mar 28 13:47:02 2008
@@ -352,7 +352,13 @@
   /** {@inheritDoc }*/
   public void setPermission(Path p, FsPermission permission
       ) throws IOException {
-    dfs.namenode.setPermission(getPathName(p), permission);
+    try {
+      dfs.namenode.setPermission(getPathName(p), permission);
+    } catch(RemoteException re) {
+      if(FileNotFoundException.class.getName().equals(re.getClassName())) {
+        throw new FileNotFoundException("File does not exist: " + p);
+      }
+    }
   }
 
   /** {@inheritDoc }*/
@@ -361,6 +367,12 @@
     if (username == null && groupname == null) {
       throw new IOException("username == null && groupname == null");
     }
-    dfs.namenode.setOwner(getPathName(p), username, groupname);
+    try {
+      dfs.namenode.setOwner(getPathName(p), username, groupname);
+    } catch(RemoteException re) {
+      if(FileNotFoundException.class.getName().equals(re.getClassName())) {
+        throw new FileNotFoundException("File does not exist: " + p);
+      }
+    }
   }
 }

Modified: hadoop/core/branches/branch-0.16/src/test/org/apache/hadoop/security/TestPermission.java
URL: http://svn.apache.org/viewvc/hadoop/core/branches/branch-0.16/src/test/org/apache/hadoop/security/TestPermission.java?rev=642372&r1=642371&r2=642372&view=diff
==============================================================================
--- hadoop/core/branches/branch-0.16/src/test/org/apache/hadoop/security/TestPermission.java
(original)
+++ hadoop/core/branches/branch-0.16/src/test/org/apache/hadoop/security/TestPermission.java
Fri Mar 28 13:47:02 2008
@@ -119,22 +119,22 @@
     FileSystem fs = FileSystem.get(conf);
 
     try {
-        // test permissions on files that do not exist
-        assertFalse(fs.exists(CHILD_FILE1));
-        try {
-          fs.setOwner(CHILD_FILE1, "foo", "bar");
-          assertTrue(false);
-        }
-        catch(java.io.FileNotFoundException e) {
-          LOG.info("GOOD: got " + e);
-        }
-        try {
-          fs.setPermission(CHILD_FILE1, new FsPermission((short)0777));
-          assertTrue(false);
-        }
-        catch(java.io.FileNotFoundException e) {
-          LOG.info("GOOD: got " + e);
-        }
+      // test permissions on files that do not exist
+      assertFalse(fs.exists(CHILD_FILE1));
+      try {
+        fs.setOwner(CHILD_FILE1, "foo", "bar");
+        assertTrue(false);
+      }
+      catch(java.io.FileNotFoundException e) {
+        LOG.info("GOOD: got " + e);
+      }
+      try {
+        fs.setPermission(CHILD_FILE1, new FsPermission((short)0777));
+        assertTrue(false);
+      }
+      catch(java.io.FileNotFoundException e) {
+        LOG.info("GOOD: got " + e);
+      }
       // following dir/file creations are legal
       fs.mkdirs(CHILD_DIR1);
       FSDataOutputStream out = fs.create(CHILD_FILE1);



Mime
View raw message