public void execute() {
try {
executeCommand();
} catch (IOException e) {
//noinspection ThrowableInstanceNeverThrown
errors.add(new VcsException(e));
return;
}
// System.out.println("pattern [" + wholeLinePatternString + "]");
Pattern wholeLinePattern = Pattern.compile(wholeLinePatternString);
BufferedReader reader = new BufferedReader(new StringReader(commandOutput));
String line;
try {
while ((line = reader.readLine()) != null) {
Matcher matcher = wholeLinePattern.matcher(line);
if (matcher.matches()) {
String workingRev = matcher.group(WORKING_REV_GROUP_IDX);
String memberRev = matcher.group(MEMBER_REV_GROUP_IDX);
String workingCpid = matcher.group(WORKING_CPID_GROUP_IDX);
String deferred = matcher.group(DEFERRED_GROUP_IDX);
String type = matcher.group(TYPE_GROUP_IDX);
String locker = matcher.group(LOCKER_GROUP_IDX);
String name = matcher.group(NAME_GROUP_IDX);
String lockedSandbox = matcher.group(LOCKED_SANDBOX_GROUP_IDX);
try {
if (isRelevant(type)) {
MksMemberState memberState = createState(workingRev, memberRev, workingCpid, locker,
lockedSandbox, type, deferred);
setState(name, memberState);
} else {
LOGGER.debug("ignoring " + line);
// } else {
// LOGGER.warn("unexpected type " + type + " for " + line);
}
} catch (VcsException e) {
// should not happen, VcsExceptions on ChangePackageId
if (e.getCause() != null) {
LOGGER.error(e);
}
//noinspection ThrowableInstanceNeverThrown
errors.add(new VcsException(name + " " + e.getMessage()));
}
} else {
//noinspection ThrowableInstanceNeverThrown
errors.add(new VcsException(toString() + " : unexpected line [" + line + "]"));
}
}
} catch (IOException e) {
// shouldnt happen :IO exceptions on stringReader.read
//noinspection ThrowableInstanceNeverThrown
errors.add(new VcsException(e));
}
}