Skip to content

Commit

Permalink
Ignore help-text rules which fail to load for some reason
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexRukhlin committed Jun 27, 2017
1 parent a7b017d commit 78436d6
Showing 1 changed file with 18 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -919,17 +919,26 @@ private void runSuggestionRule(final Rule rule) {
}

private void runHelpTextRule(final Rule rule) {
final int fieldId = rule.getThenFldID();
final int constId = rule.getThenConstID();
final String helpText = witContext.getMetadata().getConstantsTable().getConstantByID(constId);
try {
final int fieldId = rule.getThenFldID();
final int constId = rule.getThenConstID();
final String helpText = witContext.getMetadata().getConstantsTable().getConstantByID(constId);

log.trace(MessageFormat.format(
"applying HelpText rule [{0}] to field [{1}]", //$NON-NLS-1$
Integer.toString(rule.getRuleID()),
getFieldNameForTrace(fieldId)));
log.trace(MessageFormat.format(
"applying HelpText rule [{0}] to field [{1}]", //$NON-NLS-1$
Integer.toString(rule.getRuleID()),
getFieldNameForTrace(fieldId)));

final IRuleTargetField field = target.getRuleTargetField(fieldId);
field.setHelpText(helpText);
final IRuleTargetField field = target.getRuleTargetField(fieldId);
field.setHelpText(helpText);
} catch (final Exception e) {
/*
* WIT team recommends: evaluate possibility of hardening client
* code to ignore help-text rules which fail to load for some
* reason.
*/
log.error("Exception running help-text rule", e); //$NON-NLS-1$
}
}

private boolean isRuleInScope(final Rule rule) {
Expand Down

0 comments on commit 78436d6

Please sign in to comment.