Program: 146116
Project: 146116
Buggy source:
/** 
 * Check that a rule actually matches a document
 * @param itemPOJO
 * @param exp
 * @return true if it matches
 * @throws XtentisException
 */
private boolean ruleExpressionMatches(ItemPOJO itemPOJO,RoutingRuleExpressionPOJO exp) throws XtentisException {
  String content=null;
  int contentInt, expInt;
  try {
    content=Util.getFirstTextNode(itemPOJO.getProjection(),exp.getXpath());
  }
 catch (  TransformerException e) {
    String err="String_Node_Str" + exp.getXpath() + "String_Node_Str"+ itemPOJO.getItemPOJOPK().getUniqueID()+ "String_Node_Str"+ e.getLocalizedMessage();
    org.apache.log4j.Logger.getLogger(this.getClass()).error(err,e);
    throw new XtentisException(err);
  }
switch (exp.getOperator()) {
case RoutingRuleExpressionPOJO.CONTAINS:
    if (content != null)     return (content.indexOf(exp.getValue()) > -1);
  return false;
case RoutingRuleExpressionPOJO.EQUALS:
if (content != null) return (content.equals(exp.getValue()));
return false;
case RoutingRuleExpressionPOJO.GREATER_THAN:
try {
expInt=Integer.parseInt(exp.getValue());
}
 catch (Exception e) {
return false;
}
try {
contentInt=Integer.parseInt(content);
}
 catch (Exception e) {
return false;
}
if (content != null) return (expInt > contentInt);
return false;
case RoutingRuleExpressionPOJO.GREATER_THAN_OR_EQUAL:
try {
expInt=Integer.parseInt(exp.getValue());
}
 catch (Exception e) {
return false;
}
try {
contentInt=Integer.parseInt(content);
}
 catch (Exception e) {
return false;
}
if (content != null) return (expInt >= contentInt);
return false;
case RoutingRuleExpressionPOJO.IS_NOT_NULL:
return (content != null);
case RoutingRuleExpressionPOJO.IS_NULL:
return (content == null);
case RoutingRuleExpressionPOJO.LOWER_THAN:
try {
expInt=Integer.parseInt(exp.getValue());
}
 catch (Exception e) {
return false;
}
try {
contentInt=Integer.parseInt(content);
}
 catch (Exception e) {
return false;
}
if (content != null) return (expInt < contentInt);
return false;
case RoutingRuleExpressionPOJO.LOWER_THAN_OR_EQUAL:
try {
expInt=Integer.parseInt(exp.getValue());
}
 catch (Exception e) {
return false;
}
try {
contentInt=Integer.parseInt(content);
}
 catch (Exception e) {
return false;
}
if (content != null) return (expInt <= contentInt);
return false;
case RoutingRuleExpressionPOJO.MATCHES:
if (exp.getValue() == null) return false;
if (content != null) return (content.matches(exp.getValue()));
return false;
case RoutingRuleExpressionPOJO.NOT_EQUALS:
if (content != null) return (!content.equals(exp.getValue()));
return false;
case RoutingRuleExpressionPOJO.STARTSWITH:
if (exp.getValue() == null) return false;
if (content != null) return (content.startsWith(exp.getValue()));
return false;
default :
return false;
}
}

Fixed version (ground truth):
/** 
 * Check that a rule actually matches a document
 * @param itemPOJO
 * @param exp
 * @return true if it matches
 * @throws XtentisException
 */
private boolean ruleExpressionMatches(ItemPOJO itemPOJO,RoutingRuleExpressionPOJO exp) throws XtentisException {
  String content=null;
  int contentInt, expInt;
  String expXpath=exp.getXpath();
  if (!expXpath.startsWith("String_Node_Str"))   expXpath="String_Node_Str" + expXpath;
  try {
    content=Util.getFirstTextNode(itemPOJO.getProjection(),expXpath);
  }
 catch (  TransformerException e) {
    String err="String_Node_Str" + exp.getXpath() + "String_Node_Str"+ itemPOJO.getItemPOJOPK().getUniqueID()+ "String_Node_Str"+ e.getLocalizedMessage();
    org.apache.log4j.Logger.getLogger(this.getClass()).error(err,e);
    throw new XtentisException(err);
  }
switch (exp.getOperator()) {
case RoutingRuleExpressionPOJO.CONTAINS:
    if (content != null)     return (content.indexOf(exp.getValue()) > -1);
  return false;
case RoutingRuleExpressionPOJO.EQUALS:
if (content != null) return (content.equals(exp.getValue()));
return false;
case RoutingRuleExpressionPOJO.GREATER_THAN:
try {
expInt=Integer.parseInt(exp.getValue());
}
 catch (Exception e) {
return false;
}
try {
contentInt=Integer.parseInt(content);
}
 catch (Exception e) {
return false;
}
if (content != null) return (expInt > contentInt);
return false;
case RoutingRuleExpressionPOJO.GREATER_THAN_OR_EQUAL:
try {
expInt=Integer.parseInt(exp.getValue());
}
 catch (Exception e) {
return false;
}
try {
contentInt=Integer.parseInt(content);
}
 catch (Exception e) {
return false;
}
if (content != null) return (expInt >= contentInt);
return false;
case RoutingRuleExpressionPOJO.IS_NOT_NULL:
return (content != null);
case RoutingRuleExpressionPOJO.IS_NULL:
return (content == null);
case RoutingRuleExpressionPOJO.LOWER_THAN:
try {
expInt=Integer.parseInt(exp.getValue());
}
 catch (Exception e) {
return false;
}
try {
contentInt=Integer.parseInt(content);
}
 catch (Exception e) {
return false;
}
if (content != null) return (expInt < contentInt);
return false;
case RoutingRuleExpressionPOJO.LOWER_THAN_OR_EQUAL:
try {
expInt=Integer.parseInt(exp.getValue());
}
 catch (Exception e) {
return false;
}
try {
contentInt=Integer.parseInt(content);
}
 catch (Exception e) {
return false;
}
if (content != null) return (expInt <= contentInt);
return false;
case RoutingRuleExpressionPOJO.MATCHES:
if (exp.getValue() == null) return false;
if (content != null) return (content.matches(exp.getValue()));
return false;
case RoutingRuleExpressionPOJO.NOT_EQUALS:
if (content != null) return (!content.equals(exp.getValue()));
return false;
case RoutingRuleExpressionPOJO.STARTSWITH:
if (exp.getValue() == null) return false;
if (content != null) return (content.startsWith(exp.getValue()));
return false;
default :
return false;
}
}