}
return; // *** EARLY RETURN ***
}
ContextualizationContext contextRP;
try {
while (true) {
try {
contextRP = this.rpQuery.query();
if (this.analyzeResult(contextRP)) {
break;
}
Thread.sleep(this.pollDelayMs);
} catch (InterruptedException e) {
// ignore
}
}
final String msg = "Querying ended via analyzeResult";
if (this.pr.useThis()) {
this.pr.debugln(msg);
} else {
logger.debug(msg);
}
} catch (BaseFaultType e) {
final String err =
CommonStrings.faultStringOrCommonCause(e, "context");
throw new ExecutionProblem(err, e);
}
if (contextRP.isErrorPresent()) {
if (this.pr.enabled()) {
final String msg =
"Problem with " + this.nameToPrint + " context";
if (this.pr.useThis()) {
this.pr.infoln(PrCodes.CTXMONITOR__ONE_ERROR, msg);
} else if (this.pr.useLogging()) {
logger.info(msg);
}
}
} else if (contextRP.isAllOK()) {
if (this.pr.enabled()) {
final String msg = this.nameToPrint + ": contextualized";
if (this.pr.useThis()) {
this.pr.infoln(PrCodes.CTXMONITOR__ALL_OK, " - " + msg);
} else if (this.pr.useLogging()) {
logger.info(msg);
}
}
} else {
throw new ExecutionProblem("Incorrect analysis of ctx query?");
}
// both oneErrorExists and allOK trigger report(s) if path is configured
if (this.args.reportDir != null) {
try {
this.writeSummary(contextRP);
} catch (Exception e) {
final String err = CommonUtil.genericExceptionMessageWrapper(e);
throw new ExecutionProblem(
"Problem writing ctx summary: " + err, e);
}
}
// in all cases get the full node report
Node_Type[] nodes = null;
try {
this.identitiesQuery.setQueryAll(true);
nodes = this.identitiesQuery.identities();
} catch (NimbusContextualizationFault e) {
final String err = CommonUtil.genericExceptionMessageWrapper(e);
if (this.pr.enabled()) {
final String errMsg = "Problem querying ctx nodes: " + err;
if (this.pr.useThis()) {
this.pr.errln(errMsg);
} else if (this.pr.useLogging()) {
logger.error(errMsg);
}
}
}
// both oneErrorExists and allOK trigger report(s) if path is configured
if (nodes != null && this.args.reportDir != null) {
try {
this.writeReports(nodes);
} catch (Exception e) {
final String err = CommonUtil.genericExceptionMessageWrapper(e);
throw new ExecutionProblem(
"Problem writing ctx summary: " + err, e);
}
}
if (contextRP.isErrorPresent()) {
throw new ExitNow(1);
}
if (nodes != null && this.adjustSshKnownHosts) {
try {