Program: 145019
Project: 145019
Buggy source:
/** 
 * convert the data object returned by the xpath expression into an IAnswerData suitable for storage in the FormInstance
 */
private static IAnswerData wrapData(Object val,int dataType){
  if ((val instanceof String && ((String)val).length() == 0) || (val instanceof Double && ((Double)val).isNaN())) {
    return null;
  }
  if (Constants.DATATYPE_BOOLEAN == dataType || val instanceof Boolean) {
    boolean b;
    if (val instanceof Boolean) {
      b=((Boolean)val).booleanValue();
    }
 else     if (val instanceof Double) {
      Double d=(Double)val;
      b=Math.abs(d.doubleValue()) > 1.0e-12 && !Double.isNaN(d);
    }
 else     if (val instanceof String) {
      String s=(String)val;
      b=s.length() > 0;
    }
 else {
      throw new RuntimeException("String_Node_Str");
    }
    return new BooleanData(b);
  }
 else   if (val instanceof Double) {
    double d=((Double)val).doubleValue();
    long l=(long)d;
    boolean isIntegral=Math.abs(d - l) < 1.0e-9;
    if (Constants.DATATYPE_INTEGER == dataType || (isIntegral && (Integer.MAX_VALUE >= l) && (Integer.MIN_VALUE <= l))) {
      return new IntegerData((int)d);
    }
 else     if (Constants.DATATYPE_LONG == dataType || isIntegral) {
      return new LongData((long)d);
    }
 else {
      return new DecimalData(d);
    }
  }
 else   if (val instanceof String) {
    return new StringData((String)val);
  }
 else   if (val instanceof Date) {
    return (dataType == Constants.DATATYPE_DATE_TIME ? new DateTimeData((Date)val) : new DateData((Date)val));
  }
 else {
    throw new RuntimeException("String_Node_Str" + val.getClass().getName());
  }
}

Fixed version (ground truth):
/** 
 * convert the data object returned by the xpath expression into an IAnswerData suitable for storage in the FormInstance
 */
private static IAnswerData wrapData(Object val,int dataType){
  if ((val instanceof String && ((String)val).length() == 0) || (val instanceof Double && ((Double)val).isNaN())) {
    return null;
  }
  if (Constants.DATATYPE_BOOLEAN == dataType || val instanceof Boolean) {
    boolean b;
    if (val instanceof Boolean) {
      b=((Boolean)val).booleanValue();
    }
 else     if (val instanceof Double) {
      Double d=(Double)val;
      b=Math.abs(d.doubleValue()) > 1.0e-12 && !Double.isNaN(d);
    }
 else     if (val instanceof String) {
      String s=(String)val;
      b=s.length() > 0;
    }
 else {
      throw new RuntimeException("String_Node_Str");
    }
    return new BooleanData(b);
  }
 else   if (val instanceof Double) {
    double d=((Double)val).doubleValue();
    long l=(long)d;
    boolean isIntegral=Math.abs(d - l) < 1.0e-9;
    if (Constants.DATATYPE_INTEGER == dataType || (isIntegral && (Integer.MAX_VALUE >= l) && (Integer.MIN_VALUE <= l))) {
      return new IntegerData((int)d);
    }
 else     if (Constants.DATATYPE_LONG == dataType || isIntegral) {
      return new LongData((long)d);
    }
 else {
      return new DecimalData(d);
    }
  }
 else   if (val instanceof String) {
    return new StringData((String)val);
  }
 else   if (val instanceof Date) {
    if (dataType == Constants.DATATYPE_DATE_TIME) {
      return new DateTimeData((Date)val);
    }
 else     if (dataType == Constants.DATATYPE_TIME) {
      return new TimeData((Date)val);
    }
 else {
      return new DateData((Date)val);
    }
  }
 else {
    throw new RuntimeException("String_Node_Str" + val.getClass().getName());
  }
}