comparison flys-artifacts/src/main/java/de/intevation/flys/wsplgen/ProblemObserver.java @ 1648:d1d6fd8cfbb2

Improved regex used to track WSPLGEN errors - will now match critical errors as well. flys-artifacts/trunk@2835 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Tue, 27 Sep 2011 10:53:41 +0000
parents 64b465699a24
children 74142aa5d938
comparison
equal deleted inserted replaced
1647:103205742e02 1648:d1d6fd8cfbb2
13 13
14 private static Logger logger = Logger.getLogger(ProblemObserver.class); 14 private static Logger logger = Logger.getLogger(ProblemObserver.class);
15 15
16 16
17 public static final Pattern WSPLGEN_ERROR_START = Pattern.compile( 17 public static final Pattern WSPLGEN_ERROR_START = Pattern.compile(
18 ".*->Fehler\\s*\\((\\d+)\\).*", 18 ".*->(.*Fehler)(\\s*\\((\\d+)\\).*)*",
19 Pattern.DOTALL); 19 Pattern.DOTALL);
20 20
21 public static final Pattern WSPLGEN_ERROR_END = Pattern.compile( 21 public static final Pattern WSPLGEN_ERROR_END = Pattern.compile(
22 ".*<-Fehler .*", 22 ".*<-(.*Fehler).*",
23 Pattern.DOTALL); 23 Pattern.DOTALL);
24 24
25 public static final Pattern WSPLGEN_WARNING_START = Pattern.compile( 25 public static final Pattern WSPLGEN_WARNING_START = Pattern.compile(
26 ".*->Warnung\\s*\\((\\d+)\\).*", 26 ".*->Warnung\\s*\\((\\d+)\\).*",
27 Pattern.DOTALL); 27 Pattern.DOTALL);
60 60
61 @Override 61 @Override
62 protected void update(String log) { 62 protected void update(String log) {
63 Matcher startError = WSPLGEN_ERROR_START.matcher(log); 63 Matcher startError = WSPLGEN_ERROR_START.matcher(log);
64 if (startError.matches()) { 64 if (startError.matches()) {
65 error = Integer.parseInt(startError.group(1)); 65 if (startError.groupCount() >= 2) {
66 String tmp = startError.group(2);
67
68 if (tmp != null && tmp.length() > 0) {
69 error = Integer.parseInt(tmp);
70 }
71 else error = 1;
72 }
73 else {
74 error = 1;
75 }
76
66 return; 77 return;
67 } 78 }
68 79
69 Matcher endError = WSPLGEN_ERROR_END.matcher(log); 80 Matcher endError = WSPLGEN_ERROR_END.matcher(log);
70 if (endError.matches()) { 81 if (endError.matches()) {

http://dive4elements.wald.intevation.org