Program: 4877
Project: 4877
Buggy source:
/** 
 * Creates a new <tt>Date</tt> instance from the date specified in the alternate location header.
 * @param dateTimeString the extracted date-time string from thealternate location header
 * @return a new <tt>Date</tt> instance for the date specified inthe header, or a new <tt>Date</tt> instance of the oldest possible date (according to the <tt>Date</tt> class) in the case  where no timestamp data could be successfully created
 */
private static Date createDateInstance(final String dateTimeString){
  int dateTimeSepIndex=dateTimeString.indexOf("String_Node_Str");
  if ((dateTimeSepIndex == -1) || ((dateTimeSepIndex + 1) >= dateTimeString.length())) {
    return new Date(0);
  }
  String YYYYMMDD=dateTimeString.substring(0,dateTimeSepIndex);
  String hhmmss=dateTimeString.substring(dateTimeSepIndex + 1,dateTimeString.length() - 1);
  StringTokenizer stdate=new StringTokenizer(YYYYMMDD,"String_Node_Str");
  if (stdate.countTokens() != 3) {
    return null;
  }
  String YYYYStr=stdate.nextToken();
  String MMStr=stdate.nextToken();
  String DDStr=stdate.nextToken();
  int YYYY=Integer.parseInt(YYYYStr);
  int MM=Integer.parseInt(MMStr) - 1;
  int DD=Integer.parseInt(DDStr);
  StringTokenizer sttime=new StringTokenizer(hhmmss,"String_Node_Str");
  if (sttime.countTokens() != 3) {
    return new Date(0);
  }
  String hhStr=sttime.nextToken();
  String mmStr=sttime.nextToken();
  String ssStr=sttime.nextToken();
  int hh=Integer.parseInt(hhStr);
  int mm=Integer.parseInt(mmStr);
  int ss=Integer.parseInt(ssStr);
  Calendar cal=Calendar.getInstance(TimeZone.getTimeZone("String_Node_Str"));
  cal.set(YYYY,MM,DD,hh,mm,ss);
  return cal.getTime();
}

Fixed version (ground truth):
/** 
 * Creates a new <tt>Date</tt> instance from the date specified in the alternate location header.
 * @param dateTimeString the extracted date-time string from thealternate location header
 * @return a new <tt>Date</tt> instance for the date specified inthe header, or a new <tt>Date</tt> instance of the oldest possible date (according to the <tt>Date</tt> class) in the case  where no timestamp data could be successfully created
 */
private static Date createDateInstance(final String dateTimeString){
  StringTokenizer st=new StringTokenizer(dateTimeString,"String_Node_Str");
  int tokens=st.countTokens();
  if (tokens < 1 || tokens > 2) {
    return new Date(0);
  }
  String YYYYMMDD=st.nextToken();
  StringTokenizer stdate=new StringTokenizer(YYYYMMDD,"String_Node_Str");
  if (stdate.countTokens() != 3) {
    return new Date(0);
  }
  String YYYYStr=stdate.nextToken();
  String MMStr=stdate.nextToken();
  String DDStr=stdate.nextToken();
  int YYYY=Integer.parseInt(YYYYStr);
  try {
    int MM=Integer.parseInt(MMStr) - 1;
    int DD=Integer.parseInt(DDStr);
    if (!st.hasMoreTokens()) {
      Calendar cal=Calendar.getInstance(TimeZone.getTimeZone("String_Node_Str"));
      cal.set(YYYY,MM,DD);
      return cal.getTime();
    }
    String hhmmss=st.nextToken();
    if (!hhmmss.endsWith("String_Node_Str")) {
      return new Date(0);
    }
    hhmmss=hhmmss.substring(0,hhmmss.length() - 1);
    StringTokenizer sttime=new StringTokenizer(hhmmss,"String_Node_Str");
    int numToks=sttime.countTokens();
    if (numToks < 2 || numToks > 3) {
      return new Date(0);
    }
    String hhStr=sttime.nextToken();
    String mmStr=sttime.nextToken();
    int hh=Integer.parseInt(hhStr);
    int mm=Integer.parseInt(mmStr);
    Calendar cal=Calendar.getInstance(TimeZone.getTimeZone("String_Node_Str"));
    if (sttime.hasMoreTokens()) {
      String ssStr=sttime.nextToken().substring(0,2);
      int ss=Integer.parseInt(ssStr);
      cal.set(YYYY,MM,DD,hh,mm,ss);
    }
 else {
      cal.set(YYYY,MM,DD,hh,mm);
    }
    return cal.getTime();
  }
 catch (  NumberFormatException e) {
    return new Date(0);
  }
}