Revision: 1406
http://svn.sourceforge.net/cogkit/?rev=1406&view=rev
Author: hategan
Date: 2006-11-22 12:31:40 -0800 (Wed, 22 Nov 2006)
Log Message:
-----------
enable dotall mode so that . would match newline characters
Modified Paths:
--------------
trunk/current/src/cog/modules/karajan/src/org/globus/cog/karajan/workflow/nodes/RestartOnErrorNode.java
Modified: trunk/current/src/cog/modules/karajan/src/org/globus/cog/karajan/workflow/nodes/RestartOnErrorNode.java
===================================================================
--- trunk/current/src/cog/modules/karajan/src/org/globus/cog/karajan/workflow/nodes/RestartOnErrorNode.java 2006-11-22 20:30:55 UTC (rev 1405)
+++ trunk/current/src/cog/modules/karajan/src/org/globus/cog/karajan/workflow/nodes/RestartOnErrorNode.java 2006-11-22 20:31:40 UTC (rev 1406)
@@ -11,6 +11,7 @@
import java.util.Iterator;
import java.util.List;
+import java.util.regex.Pattern;
import org.apache.log4j.Logger;
import org.globus.cog.karajan.arguments.Arg;
@@ -23,7 +24,7 @@
public class RestartOnErrorNode extends PartialArgumentsContainer {
public static final Logger logger = Logger.getLogger(RestartOnErrorNode.class);
-
+
public static final Arg A_MATCH = new Arg.Positional("match", 0);
public static final Arg A_TIMES = new Arg.Positional("times", 1);
@@ -67,7 +68,7 @@
}
super.notificationEvent(e);
}
-
+
protected boolean matches(VariableStack stack, FailureNotificationEvent e) {
if (!stack.currentFrame().isDefined(MATCH)) {
return false;
@@ -77,7 +78,7 @@
if (match instanceof List) {
Iterator i = ((List) match).iterator();
while (i.hasNext()) {
- if (matches(TypeUtil.toString(i.next()), e)){
+ if (matches(TypeUtil.toString(i.next()), e)) {
return true;
}
}
@@ -88,8 +89,16 @@
}
}
}
-
+
protected boolean matches(String str, FailureNotificationEvent e) {
- return e.getMessage().matches(str);
+ String msg = e.getMessage();
+ if (msg == null) {
+ msg = "";
+ }
+ boolean matches = Pattern.compile(str, Pattern.DOTALL).matcher(msg).matches();
+ if (!matches && logger.isDebugEnabled()) {
+ logger.debug("Failure does not match: \"" + msg + "\" vs. " + str);
+ }
+ return matches;
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|