hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From t...@apache.org
Subject svn commit: r1176697 - /hadoop/common/branches/branch-0.20-security/src/core/org/apache/hadoop/fs/permission/FsPermission.java
Date Wed, 28 Sep 2011 03:23:39 GMT
Author: todd
Date: Wed Sep 28 03:23:39 2011
New Revision: 1176697

URL: http://svn.apache.org/viewvc?rev=1176697&view=rev
Log:
HADOOP-7629. Allow immutable FsPermission objects to be used as IPC parameters. Contributed
by Todd Lipcon.

Amend previous commit which accidentally only committed the CHANGES entry.

Modified:
    hadoop/common/branches/branch-0.20-security/src/core/org/apache/hadoop/fs/permission/FsPermission.java

Modified: hadoop/common/branches/branch-0.20-security/src/core/org/apache/hadoop/fs/permission/FsPermission.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.20-security/src/core/org/apache/hadoop/fs/permission/FsPermission.java?rev=1176697&r1=1176696&r2=1176697&view=diff
==============================================================================
--- hadoop/common/branches/branch-0.20-security/src/core/org/apache/hadoop/fs/permission/FsPermission.java
(original)
+++ hadoop/common/branches/branch-0.20-security/src/core/org/apache/hadoop/fs/permission/FsPermission.java
Wed Sep 28 03:23:39 2011
@@ -39,18 +39,12 @@ public class FsPermission implements Wri
   };
   static {                                      // register a ctor
     WritableFactories.setFactory(FsPermission.class, FACTORY);
+    WritableFactories.setFactory(ImmutableFsPermission.class, FACTORY);
   }
 
   /** Create an immutable {@link FsPermission} object. */
   public static FsPermission createImmutable(short permission) {
-    return new FsPermission(permission) {
-      public FsPermission applyUMask(FsPermission umask) {
-        throw new UnsupportedOperationException();
-      }
-      public void readFields(DataInput in) throws IOException {
-        throw new UnsupportedOperationException();
-      }
-    };
+    return new ImmutableFsPermission(permission);
   }
 
   //POSIX permission style
@@ -240,4 +234,16 @@ public class FsPermission implements Wri
     }
     return new FsPermission((short)n);
   }
+  
+  private static class ImmutableFsPermission extends FsPermission {
+    public ImmutableFsPermission(short permission) {
+      super(permission);
+    }
+    public FsPermission applyUMask(FsPermission umask) {
+      throw new UnsupportedOperationException();
+    }
+    public void readFields(DataInput in) throws IOException {
+      throw new UnsupportedOperationException();
+    }    
+  }
 }



Mime
View raw message