Program: 128086
Project: 128086
Buggy source:
/** 
 * test string value as a date (with right pattern)
 * @param stringDate (A <code>String</code> whose beginning should be parsed)
 * @param pattern (the pattern to format, like: "yyyy-MM-dd HH:mm:ss")
 * @return the result wheather the stringDate is a date string that with a right pattern{talendTypes} Boolean {Category} TalendDate {param} String(mydate) stringDate : the date to judge {param} String("yyyy-MM-dd HH:mm:ss") pattern : the specified pattern {examples} ->> isDate("2008-11-24 12:15:25", "yyyy-MM-dd HH:mm:ss") return true ->> isDate("2008-11-24 12:15:25", "yyyy-MM-dd HH:mm") return false ->> isDate("2008-11-32 12:15:25", "yyyy-MM-dd HH:mm:ss") return false #
 */
public static boolean isDate(String stringDate,String pattern){
  if (stringDate == null) {
    return false;
  }
  boolean hasZone=false;
  if (pattern == null) {
    pattern="String_Node_Str";
  }
 else {
    boolean inQuote=false;
    char[] ps=pattern.toCharArray();
    for (    char p : ps) {
      if (p == '\'') {
        inQuote=!inQuote;
      }
 else       if (!inQuote && (p == 'Z' || p == 'z')) {
        hasZone=true;
        break;
      }
    }
  }
  java.util.Date testDate=null;
  if (hasZone) {
    testDate=parseDate(pattern,stringDate);
    if (!formatDate(pattern,testDate).equalsIgnoreCase(stringDate)) {
      return false;
    }
  }
 else {
    java.text.SimpleDateFormat sdf=new java.text.SimpleDateFormat(pattern);
    sdf.setTimeZone(new java.util.SimpleTimeZone(0,sdf.getTimeZone().getID()));
    try {
      testDate=sdf.parse(stringDate);
      if (!sdf.format(testDate).equalsIgnoreCase(stringDate)) {
        return false;
      }
    }
 catch (    ParseException e) {
      return false;
    }
  }
  return true;
}

Fixed version (ground truth):
/** 
 * test string value as a date with right pattern. </br>examples: </br>TimeZone:+0100 </br>2011/03/27 02:00:00 begin to carry out the daylight saving time. So parse dateString "20110327 021711" with TimeZone is wrong </br> <code>isDate("20110327 021711", "yyyyMMdd HHmmss",false)</code> return <code>false</code> </br> <code>isDate("20110327 021711", "yyyyMMdd HHmmss",true)</code> return <code>true</code> </br> <code>isDate("2008-11-32 12:15:25", "yyyy-MM-dd HH:mm:ss",true)</code> return <code>false</code> </br> <code>isDate("2008-11-32 12:15:25", "yyyy-MM-dd HH:mm:ss",false)</code> return <code>false</code>
 * @param stringDate (A <code>String</code> whose beginning should be parsed)
 * @param pattern (the pattern to format, like: "yyyy-MM-dd HH:mm:ss")
 * @param ignoreTimeZone (if true ignore TimeZone when pare date with pattern)
 * @return the result whether the stringDate is a date string that with a right pattern
 */
public static boolean isDate(String stringDate,String pattern,boolean ignoreTimeZone){
  TimeZone tz=TimeZone.getDefault();
  if (ignoreTimeZone) {
    tz=TimeZone.getTimeZone("String_Node_Str");
  }
  if (stringDate == null) {
    return false;
  }
  if (pattern == null) {
    pattern="String_Node_Str";
  }
  java.text.SimpleDateFormat sdf=new java.text.SimpleDateFormat(pattern);
  sdf.setTimeZone(tz);
  sdf.setLenient(false);
  java.util.Date testDate=null;
  ParsePosition pos=new ParsePosition(0);
  testDate=sdf.parse(stringDate,pos);
  if (testDate == null) {
    return false;
  }
  String formatDate=sdf.format(testDate);
  if (formatDate.equalsIgnoreCase(stringDate) || pos.getIndex() == stringDate.length()) {
    return true;
  }
  return false;
}