Author: cos
Date: Fri Jun 4 04:10:17 2010
New Revision: 951259
URL: http://svn.apache.org/viewvc?rev=951259&view=rev
Log:
HADOOP-6788. [Herriot] Exception exclusion functionality is not working
correctly. Contributed by Vinay Kumar Thota.
Modified:
hadoop/common/trunk/CHANGES.txt
hadoop/common/trunk/src/test/system/aop/org/apache/hadoop/test/system/DaemonProtocolAspect.aj
Modified: hadoop/common/trunk/CHANGES.txt
URL:
http://svn.apache.org/viewvc/hadoop/common/trunk/CHANGES.txt?rev=951259&r1=951258&r2=951259&view=diff
==============================================================================
--- hadoop/common/trunk/CHANGES.txt (original)
+++ hadoop/common/trunk/CHANGES.txt Fri Jun 4 04:10:17 2010
@@ -970,6 +970,9 @@ Release 0.21.0 - Unreleased
BUG FIXES
+ HADOOP-6788. [Herriot] Exception exclusion functionality is not working
+ correctly. (Vinay Thota via cos)
+
HADOOP-6773. Ivy folder contains redundant files (cos)
HADOOP-5379. CBZip2InputStream to throw IOException on data crc error.
Modified:
hadoop/common/trunk/src/test/system/aop/org/apache/hadoop/test/system/DaemonProtocolAspect.aj
URL:
http://svn.apache.org/viewvc/hadoop/common/trunk/src/test/system/aop/org/apache/hadoop/test/system/DaemonProtocolAspect.aj?rev=951259&r1=951258&r2=951259&view=diff
==============================================================================
---
hadoop/common/trunk/src/test/system/aop/org/apache/hadoop/test/system/DaemonProtocolAspect.aj
(original)
+++
hadoop/common/trunk/src/test/system/aop/org/apache/hadoop/test/system/DaemonProtocolAspect.aj
Fri Jun 4 04:10:17 2010
@@ -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();