Buggy code:
public class DateMatcher { static Pattern monthDayYearPattern = Pattern . compile ( ( "([Oo]n<seq2seq4repair_space>)?(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)(\\.?|\\w*)<seq2seq4repair_space>" + "([0123]?\\d)(st|nd|th)?<seq2seq4repair_space>?,<seq2seq4repair_space>(\\d\\d\\d\\d)" ) ) ; static Pattern dayMonthYearPattern = Pattern . compile ( ( "([Oo]n<seq2seq4repair_space>)?([0123]?\\d)(st|nd|th)?<seq2seq4repair_space>" + ( "(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)(\\.?|\\w*)<seq2seq4repair_space>" + "<seq2seq4repair_space>(\\d\\d\\d\\d)" ) ) ) ; static Pattern yearPattern = Pattern . compile ( "([Ii]n<seq2seq4repair_space>|[Ii]n<seq2seq4repair_space>the<seq2seq4repair_space>year)?((17|18|19|20)\\d\\d)" ) ; static Pattern monthYearPattern = Pattern . compile ( ( "([Ii]n<seq2seq4repair_space>)?(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)(\\.?|\\w*)<seq2seq4repair_space>" + "<seq2seq4repair_space>(\\d\\d\\d\\d)" ) ) ; static Pattern monthDayPattern = Pattern . compile ( ( "([Oo]n<seq2seq4repair_space>)?(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)(\\.?|\\w*)<seq2seq4repair_space>" + "([0123]?\\d)(st|nd|th)?" ) ) ; static Pattern dayMonthPattern = Pattern . compile ( ( "([Oo]n<seq2seq4repair_space>)?([0123]?\\d)(st|nd|th)?<seq2seq4repair_space>" + "(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)(\\.?|\\w*)" ) ) ; static Pattern monthPattern = Pattern . compile ( "(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)(\\.?|\\w*)" ) ; static Pattern canonicalPattern_TIMEX2 = Pattern . compile ( "(\\d\\d|XX)(\\d\\d|XX)-(\\d\\d|XX)-(\\d\\d|XX)" ) ; static Pattern canonicalFreebasePattern = Pattern . compile ( "(\\d\\d\\d\\d)(-(\\d\\d)(-(\\d\\d))?)?" ) ; static String [ ] months = new String [ ] { "Jan" , "Feb" , "Mar" , "Apr" , "May" , "Jun" , "Jul" , "Aug" , "Sep" , "Oct" , "Nov" , "Dec" } ; static String [ ] monthsLong = new String [ ] { "January" , "February" , "March" , "April" , "May" , "June" , "July" , "August" , "September" , "October" , "November" , "December" } ; public static String normalize_TIMEX2 ( String candidate ) { String day = null ; String year = null ; String month = null ; Matcher m ; m = DateMatcher . monthPattern . matcher ( candidate ) ; if ( m . matches ( ) ) { month = m . group ( 1 ) ; } m = DateMatcher . canonicalFreebasePattern . matcher ( candidate ) ; if ( m . matches ( ) ) { year = m . group ( 1 ) ; month = m . group ( 3 ) ; day = m . group ( 5 ) ; } m = DateMatcher . monthDayYearPattern . matcher ( candidate ) ; if ( m . matches ( ) ) { month = m . group ( 2 ) ; day = m . group ( 4 ) ; year = m . group ( 6 ) ; } m = DateMatcher . dayMonthYearPattern . matcher ( candidate ) ; if ( m . matches ( ) ) { day = m . group ( 2 ) ; month = m . group ( 4 ) ; year = m . group ( 6 ) ; } m = DateMatcher . yearPattern . matcher ( candidate ) ; if ( m . matches ( ) ) { year = m . group ( 2 ) ; } m = DateMatcher . monthYearPattern . matcher ( candidate ) ; if ( m . matches ( ) ) { month = m . group ( 2 ) ; year = m . group ( 4 ) ; } m = DateMatcher . monthDayPattern . matcher ( candidate ) ; if ( m . matches ( ) ) { month = m . group ( 2 ) ; day = m . group ( 4 ) ; } m = DateMatcher . dayMonthPattern . matcher ( candidate ) ; if ( m . matches ( ) ) { day = m . group ( 2 ) ; month = m . group ( 5 ) ; } m = DateMatcher . canonicalPattern_TIMEX2 . matcher ( candidate ) ; if ( m . matches ( ) ) { String yearCentury = m . group ( 1 ) ; String yearDecimal = m . group ( 2 ) ; year = yearCentury + yearDecimal ; month = m . group ( 3 ) ; <START_BUG> day = m . group ( 5 ) ; <END_BUG> } if ( month != null ) { for ( int i = 0 ; i < ( DateMatcher . months . length ) ; ++ i ) { if ( month . startsWith ( DateMatcher . months [ i ] ) ) { month = Integer . toString ( ( i + 1 ) ) ; break ; } } } if ( ( null == year ) || ( ( year . length ( ) ) > 4 ) ) { year = "XXXX" ; } if ( ( year . length ( ) ) < 4 ) { year = ( "XXXX" . substring ( 0 , ( 4 - ( year . length ( ) ) ) ) ) + year ; } if ( ( ( null == month ) || ( ( month . length ( ) ) > 2 ) ) || ( ( month . length ( ) ) == 0 ) ) { month = "XX" ; } else if ( ( month . length ( ) ) == 1 ) { month = "0" + month ; } if ( ( ( null == day ) || ( ( day . length ( ) ) > 2 ) ) || ( ( day . length ( ) ) == 0 ) ) { day = "XX" ; } else if ( ( day . length ( ) ) == 1 ) { day = "0" + day ; } return ( ( ( year + "-" ) + month ) + "-" ) + day ; } public static Set < String > alternatives ( String matchString ) { } }

Fix:
day = m . group ( 4 ) ;