hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From omal...@apache.org
Subject svn commit: r1077489 - /hadoop/common/branches/branch-0.20-security-patches/src/test/system/aop/org/apache/hadoop/test/system/DaemonProtocolAspect.aj
Date Fri, 04 Mar 2011 04:20:11 GMT
Author: omalley
Date: Fri Mar  4 04:20:11 2011
New Revision: 1077489

URL: http://svn.apache.org/viewvc?rev=1077489&view=rev
Log:
commit d97cbd749de78bd0c8c470142bf943a1ee2abe6d
Author: Vinay Kumar Thota <vinayt@yahoo-inc.com>
Date:   Fri Jun 4 08:50:52 2010 +0000

    HADOOP:6788 from https://issues.apache.org/jira/secure/attachment/12446102/6788-ydist-security.patch

Modified:
    hadoop/common/branches/branch-0.20-security-patches/src/test/system/aop/org/apache/hadoop/test/system/DaemonProtocolAspect.aj

Modified: hadoop/common/branches/branch-0.20-security-patches/src/test/system/aop/org/apache/hadoop/test/system/DaemonProtocolAspect.aj
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.20-security-patches/src/test/system/aop/org/apache/hadoop/test/system/DaemonProtocolAspect.aj?rev=1077489&r1=1077488&r2=1077489&view=diff
==============================================================================
--- hadoop/common/branches/branch-0.20-security-patches/src/test/system/aop/org/apache/hadoop/test/system/DaemonProtocolAspect.aj
(original)
+++ hadoop/common/branches/branch-0.20-security-patches/src/test/system/aop/org/apache/hadoop/test/system/DaemonProtocolAspect.aj
Fri Mar  4 04:20:11 2011
@@ -256,19 +256,31 @@ public aspect DaemonProtocolAspect {
   public int DaemonProtocol.getNumberOfMatchesInLogFile(String pattern,
       String[] list) throws IOException {
     StringBuffer filePattern = new StringBuffer(getFilePattern());    
-    if(list != null){
-      for(int i =0; i < list.length; ++i)
-      {
-        filePattern.append(" | grep -v " + list[i] );
+    String[] cmd = null;
+    if (list != null) {
+      StringBuffer filterExpPattern = new StringBuffer();
+      int index=0;
+      for (String excludeExp : list) {
+        if (index++ < list.length -1) {
+           filterExpPattern.append("grep -v " + excludeExp + " | ");
+        } else {
+           filterExpPattern.append("grep -vc " + excludeExp);
+        }
       }
-    }  
-    String[] cmd =
-        new String[] {
-            "bash",
-            "-c",
-            "grep -c "
+      cmd = new String[] {
+                "bash",
+                "-c",
+                "grep "
+                + pattern + " " + filePattern + " | "
+                + filterExpPattern};
+    } else {
+      cmd = new String[] {
+                "bash",
+                "-c",
+                "grep -c "
                 + pattern + " " + filePattern
                 + " | awk -F: '{s+=$2} END {print s}'" };    
+    }
     ShellCommandExecutor shexec = new ShellCommandExecutor(cmd);
     shexec.execute();
     String output = shexec.getOutput();



Mime
View raw message