Program: 124150
Project: 124150
Buggy source:
/** 
 * DOC jliu Comment method "getDate". <br> DB Type ---------> jtds driver return type<br> DATE -------------> nvarchar<br> DATETIME ---------> datetime<br> DATETIME2 --------> nvarchar<br> DTIME ------------> nvarchar<br> SMALLDATETIME ----> smalldatetime<br> DATETIMEOFFSET ---> nvarchar<br> TIMESTAMP --------> timestamp<br>
 * @param rsmd
 * @param rs
 * @param index
 * @return the java.util.Date convert from db
 * @throws SQLException
 */
public java.util.Date getDate(final java.sql.ResultSetMetaData rsmd,final java.sql.ResultSet rs,int index) throws SQLException {
  if (rs.getObject(index) == null) {
    return null;
  }
  if (columnDBTypeMapping.get(index) != null) {
switch (columnDBTypeMapping.get(index)) {
case STRING_TO_JAVA_SQL_DATE:
      return new java.util.Date(java.sql.Date.valueOf(rs.getString(index)).getTime());
case STRING_TO_JAVA_SQL_TIME:
    String tempDateString=rs.getString(index);
  tempDateString=tempDateString.indexOf("String_Node_Str") == -1 ? tempDateString : tempDateString.substring(0,tempDateString.indexOf("String_Node_Str"));
return new java.util.Date(java.sql.Time.valueOf(tempDateString).getTime());
case STRING_TO_JAVA_SQL_TIMESTAMP:
return new java.util.Date(java.sql.Timestamp.valueOf(rs.getString(index)).getTime());
case JAVA_SQL_DATE:
return new java.util.Date(rs.getTimestamp(index).getTime());
default :
return null;
}
}
 else {
if ("String_Node_Str".equals(rsmd.getColumnTypeName(index))) {
String tempDateString=rs.getString(index);
try {
columnDBTypeMapping.put(index,STRING_TO_JAVA_SQL_DATE);
return new java.util.Date(java.sql.Date.valueOf(tempDateString).getTime());
}
 catch (java.lang.IllegalArgumentException iae1) {
try {
tempDateString=tempDateString.indexOf("String_Node_Str") == -1 ? tempDateString : tempDateString.substring(0,tempDateString.indexOf("String_Node_Str"));
columnDBTypeMapping.put(index,STRING_TO_JAVA_SQL_TIME);
return new java.util.Date(java.sql.Time.valueOf(tempDateString).getTime());
}
 catch (java.lang.IllegalArgumentException iae2) {
columnDBTypeMapping.put(index,STRING_TO_JAVA_SQL_TIMESTAMP);
return new java.util.Date(java.sql.Timestamp.valueOf(rs.getString(index)).getTime());
}
}
}
 else if ("String_Node_Str".equals(rsmd.getColumnTypeName(index)) || "String_Node_Str".equals(rsmd.getColumnTypeName(index))) {
columnDBTypeMapping.put(index,JAVA_SQL_DATE);
return new java.util.Date(rs.getTimestamp(index).getTime());
}
}
return null;
}

Fixed version (ground truth):
/** 
 * DOC jliu Comment method "getDate". <br> DB Type ---------> jtds driver return type<br> DATE -------------> nvarchar<br> DATETIME ---------> datetime<br> DATETIME2 --------> nvarchar<br> DTIME ------------> nvarchar<br> SMALLDATETIME ----> smalldatetime<br> DATETIMEOFFSET ---> nvarchar<br> TIMESTAMP --------> timestamp<br>
 * @param rsmd
 * @param rs
 * @param index
 * @return the java.util.Date convert from db
 * @throws SQLException
 */
public java.util.Date getDate(final java.sql.ResultSetMetaData rsmd,final java.sql.ResultSet rs,int index) throws SQLException {
  if (rs.getObject(index) == null) {
    return null;
  }
  if (columnDBTypeMapping.get(index) != null) {
switch (columnDBTypeMapping.get(index)) {
case STRING_TO_JAVA_SQL_DATE:
      return new java.util.Date(java.sql.Date.valueOf(rs.getString(index)).getTime());
case STRING_TO_JAVA_SQL_TIMESTAMP:
    return new java.util.Date(java.sql.Timestamp.valueOf(rs.getString(index)).getTime());
case STRING_TO_JAVA_SQL_TIME:
  return new java.util.Date(java.sql.Timestamp.valueOf(DATE_STRING_FOR_TIME + rs.getString(index)).getTime());
case JAVA_SQL_DATE:
return new java.util.Date(rs.getTimestamp(index).getTime());
case DB_TYPE_DATETIMEOFFSET:
return parseDatetimeOffset(rs.getString(index));
default :
return null;
}
}
 else {
if ("String_Node_Str".equals(rsmd.getColumnTypeName(index))) {
String dateString=rs.getString(index);
try {
columnDBTypeMapping.put(index,STRING_TO_JAVA_SQL_DATE);
return new java.util.Date(java.sql.Date.valueOf(dateString).getTime());
}
 catch (java.lang.IllegalArgumentException iae1) {
try {
columnDBTypeMapping.put(index,STRING_TO_JAVA_SQL_TIMESTAMP);
return new java.util.Date(java.sql.Timestamp.valueOf(dateString).getTime());
}
 catch (java.lang.IllegalArgumentException iae2) {
try {
columnDBTypeMapping.put(index,STRING_TO_JAVA_SQL_TIME);
return new java.util.Date(java.sql.Timestamp.valueOf(DATE_STRING_FOR_TIME + dateString).getTime());
}
 catch (java.lang.IllegalArgumentException iae3) {
columnDBTypeMapping.put(index,DB_TYPE_DATETIMEOFFSET);
return parseDatetimeOffset(dateString);
}
}
}
}
 else if ("String_Node_Str".equals(rsmd.getColumnTypeName(index)) || "String_Node_Str".equals(rsmd.getColumnTypeName(index))) {
columnDBTypeMapping.put(index,JAVA_SQL_DATE);
return new java.util.Date(rs.getTimestamp(index).getTime());
}
}
return null;
}