hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bor...@apache.org
Subject svn commit: r1084415 - in /hadoop/common/trunk: CHANGES.txt src/java/org/apache/hadoop/fs/FsShell.java src/java/org/apache/hadoop/fs/FsShellPermissions.java src/test/core/org/apache/hadoop/fs/TestFsShellReturnCode.java
Date Tue, 22 Mar 2011 23:54:30 GMT
Author: boryas
Date: Tue Mar 22 23:54:29 2011
New Revision: 1084415

URL: http://svn.apache.org/viewvc?rev=1084415&view=rev
Log:
HADOOP-7204. remove local unused fs variable from CmdHandler and FsShellPermissions.changePermissions

Modified:
    hadoop/common/trunk/CHANGES.txt
    hadoop/common/trunk/src/java/org/apache/hadoop/fs/FsShell.java
    hadoop/common/trunk/src/java/org/apache/hadoop/fs/FsShellPermissions.java
    hadoop/common/trunk/src/test/core/org/apache/hadoop/fs/TestFsShellReturnCode.java

Modified: hadoop/common/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/CHANGES.txt?rev=1084415&r1=1084414&r2=1084415&view=diff
==============================================================================
--- hadoop/common/trunk/CHANGES.txt (original)
+++ hadoop/common/trunk/CHANGES.txt Tue Mar 22 23:54:29 2011
@@ -121,6 +121,9 @@ Trunk (unreleased changes)
     HADOOP-6912. Guard against NPE when calling UGI.isLoginKeytabBased().
     (Kan Zhang via jitendra)
 
+    HADOOP-7204. remove local unused fs variable from CmdHandler 
+    and FsShellPermissions.changePermissions (boryas)
+
 Release 0.22.0 - Unreleased
 
   INCOMPATIBLE CHANGES

Modified: hadoop/common/trunk/src/java/org/apache/hadoop/fs/FsShell.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/src/java/org/apache/hadoop/fs/FsShell.java?rev=1084415&r1=1084414&r2=1084415&view=diff
==============================================================================
--- hadoop/common/trunk/src/java/org/apache/hadoop/fs/FsShell.java (original)
+++ hadoop/common/trunk/src/java/org/apache/hadoop/fs/FsShell.java Tue Mar 22 23:54:29 2011
@@ -1263,7 +1263,7 @@ public class FsShell extends Configured 
     boolean okToContinue() { return okToContinue; }
     String getName() { return cmdName; }
     
-    protected CmdHandler(String cmdName, FileSystem fs) {
+    protected CmdHandler(String cmdName) {
       this.cmdName = cmdName;
     }
     
@@ -1911,7 +1911,7 @@ public class FsShell extends Configured 
       } else if ("-chmod".equals(cmd) || 
                  "-chown".equals(cmd) ||
                  "-chgrp".equals(cmd)) {
-        exitCode = FsShellPermissions.changePermissions(fs, cmd, argv, i, this);
+        exitCode = FsShellPermissions.changePermissions(cmd, argv, i, this);
       } else if ("-ls".equals(cmd)) {
         if (i < argv.length) {
           exitCode = doall(cmd, argv, i);

Modified: hadoop/common/trunk/src/java/org/apache/hadoop/fs/FsShellPermissions.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/src/java/org/apache/hadoop/fs/FsShellPermissions.java?rev=1084415&r1=1084414&r2=1084415&view=diff
==============================================================================
--- hadoop/common/trunk/src/java/org/apache/hadoop/fs/FsShellPermissions.java (original)
+++ hadoop/common/trunk/src/java/org/apache/hadoop/fs/FsShellPermissions.java Tue Mar 22 23:54:29
2011
@@ -55,8 +55,8 @@ class FsShellPermissions {
   
   private static class ChmodHandler extends CmdHandler {
 
-    ChmodHandler(FileSystem fs, String modeStr) throws IOException {
-      super("chmod", fs);
+    ChmodHandler(String modeStr) throws IOException {
+      super("chmod");
       try {
         pp = new ChmodParser(modeStr);
       } catch(IllegalArgumentException iea) {
@@ -103,12 +103,14 @@ class FsShellPermissions {
     protected String owner = null;
     protected String group = null;
 
-    protected ChownHandler(String cmd, FileSystem fs) { //for chgrp
-      super(cmd, fs);
+    protected ChownHandler(String cmd) { //for chgrp
+      super(cmd);
     }
 
-    ChownHandler(FileSystem fs, String ownerStr) throws IOException {
-      super("chown", fs);
+    ChownHandler(String cmd, String ownerStr) throws IOException {
+      super(cmd);
+      if(!cmd.equals("chown"))
+        return;
       Matcher matcher = chownPattern.matcher(ownerStr);
       if (!matcher.matches()) {
         throw new IOException("'" + ownerStr + "' does not match " +
@@ -149,8 +151,8 @@ class FsShellPermissions {
   /*========== chgrp ==========*/    
   
   private static class ChgrpHandler extends ChownHandler {
-    ChgrpHandler(FileSystem fs, String groupStr) throws IOException {
-      super("chgrp", fs);
+    ChgrpHandler(String groupStr) throws IOException {
+      super("chgrp");
 
       Matcher matcher = chgrpPattern.matcher(groupStr);
       if (!matcher.matches()) {
@@ -161,7 +163,7 @@ class FsShellPermissions {
     }
   }
 
-  static int changePermissions(FileSystem fs, String cmd, 
+  static int changePermissions(String cmd, 
                                 String argv[], int startIndex, FsShell shell)
                                 throws IOException {
     CmdHandler handler = null;
@@ -178,11 +180,11 @@ class FsShellPermissions {
     }
 
     if (cmd.equals("-chmod")) {
-      handler = new ChmodHandler(fs, argv[startIndex++]);
+      handler = new ChmodHandler(argv[startIndex++]);
     } else if (cmd.equals("-chown")) {
-      handler = new ChownHandler(fs, argv[startIndex++]);
+      handler = new ChownHandler(argv[startIndex++]);
     } else if (cmd.equals("-chgrp")) {
-      handler = new ChgrpHandler(fs, argv[startIndex++]);
+      handler = new ChgrpHandler(argv[startIndex++]);
     }
 
     return shell.runCmdHandler(handler, argv, startIndex, recursive);

Modified: hadoop/common/trunk/src/test/core/org/apache/hadoop/fs/TestFsShellReturnCode.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/src/test/core/org/apache/hadoop/fs/TestFsShellReturnCode.java?rev=1084415&r1=1084414&r2=1084415&view=diff
==============================================================================
--- hadoop/common/trunk/src/test/core/org/apache/hadoop/fs/TestFsShellReturnCode.java (original)
+++ hadoop/common/trunk/src/test/core/org/apache/hadoop/fs/TestFsShellReturnCode.java Tue
Mar 22 23:54:29 2011
@@ -51,7 +51,7 @@ public class TestFsShellReturnCode {
   public void verify(FileSystem fs, String cmd, String argv[], int cmdIndex,
       FsShell fsShell, int exitCode) throws Exception {
     int ec;
-    ec = FsShellPermissions.changePermissions(fs, cmd, argv, cmdIndex, fsShell);
+    ec = FsShellPermissions.changePermissions(cmd, argv, cmdIndex, fsShell);
     Assert.assertEquals(ec, exitCode);
   }
 



Mime
View raw message