Program: 180615
Project: 180615
Buggy source:
/** 
 * Attempts to parse the given string as a number, and wraps it in a new <code>Literal</code> instance that is returned. If unable to parse the  given string as a number, then this method will return <code>null</code>. <p>The string will be parsed as follows: <ul> <li>If the string contains a numeric value (with or without decimal)  followed by a 'd' or 'D' character, then the literal will have a Double value.</li> <li>If the string contains a numeric value (with or without decimal)  followed by an 'f' or 'F' character, then the literal will have a Float value.</li> <li>If the string contains a numeric value followed by an 'l' or 'L'  character, or if the value is an integer value out of range of the Java int type, then the literal will have a Long value.</li> <li>If the string contains an integer value in range of the Java int type then the literal will have an Integer value.</li> </ul>
 * @param numericStr a string containing a numeric value to be parsed as a <code>Literal</code>.
 * @return a new <code>Literal</code> with a numeric value. Or <code>null</code> if the given <code>numericStr</code> could not be  parsed as a numeric value.
 */
protected Literal parseNumericLiteral(String numericStr){
  Literal literal=null;
  final Number n=NumberFormat.getInstance().parse(numericStr,new ParsePosition(0));
  if (n instanceof Long) {
    if (numericStr.endsWith("String_Node_Str") || numericStr.endsWith("String_Node_Str")) {
      literal=new Literal(n.doubleValue());
    }
 else     if (numericStr.endsWith("String_Node_Str") || numericStr.endsWith("String_Node_Str")) {
      literal=new Literal(n.floatValue());
    }
 else     if (!numericStr.endsWith("String_Node_Str") && !numericStr.endsWith("String_Node_Str")) {
      long longValue=n.longValue();
      if ((longValue <= Integer.MAX_VALUE) && (longValue >= Integer.MIN_VALUE)) {
        literal=new Literal(n.intValue());
      }
    }
  }
 else   if (n instanceof Double) {
    if (numericStr.endsWith("String_Node_Str") || numericStr.endsWith("String_Node_Str")) {
      literal=new Literal(n.floatValue());
    }
  }
  if ((literal == null) && (n != null)) {
    literal=new Literal(n);
  }
  return literal;
}

Fixed version (ground truth):
/** 
 * Attempts to parse the given string as a number, and wraps it in a new <code>Literal</code> instance that is returned. If unable to parse the  given string as a number, then this method will return <code>null</code>. <p>The string will be parsed as follows: <ul> <li>If the string contains a numeric value (with or without decimal)  followed by a 'd' or 'D' character, then the literal will have a Double value.</li> <li>If the string contains a numeric value (with or without decimal)  followed by an 'f' or 'F' character, then the literal will have a Float value.</li> <li>If the string contains a numeric value followed by an 'l' or 'L'  character, or if the value is an integer value out of range of the Java int type, then the literal will have a Long value.</li> <li>If the string contains an integer value in range of the Java int type then the literal will have an Integer value.</li> </ul>
 * @param numericStr a string containing a numeric value to be parsed as a <code>Literal</code>.
 * @return a new <code>Literal</code> with a numeric value. Or <code>null</code> if the given <code>numericStr</code> could not be  parsed as a numeric value.
 */
protected Literal parseNumericLiteral(String numericStr){
  Literal literal=null;
  final Number n=NumberFormat.getInstance().parse(numericStr,new ParsePosition(0));
  if (n instanceof Long) {
    if (numericStr.endsWith("String_Node_Str") || numericStr.endsWith("String_Node_Str")) {
      literal=new Literal(n.floatValue());
    }
 else     if (numericStr.endsWith("String_Node_Str") || numericStr.endsWith("String_Node_Str") || numericStr.contains("String_Node_Str")) {
      literal=new Literal(n.doubleValue());
    }
 else     if (!numericStr.endsWith("String_Node_Str") && !numericStr.endsWith("String_Node_Str")) {
      long longValue=n.longValue();
      if ((longValue <= Integer.MAX_VALUE) && (longValue >= Integer.MIN_VALUE)) {
        literal=new Literal(n.intValue());
      }
    }
  }
 else   if (n instanceof Double) {
    if (numericStr.endsWith("String_Node_Str") || numericStr.endsWith("String_Node_Str")) {
      literal=new Literal(n.floatValue());
    }
  }
  if ((literal == null) && (n != null)) {
    literal=new Literal(n);
  }
  return literal;
}