code: @GwtIncompatible("incompatible method")
      private static Date parseDateWithLeniency(
              final String str, final Locale locale, final String[] parsePatterns, final boolean lenient) throws ParseException {
          if (str == null || parsePatterns == null) {
              throw new IllegalArgumentException("Date and Patterns must not be null");
          }
  
          final TimeZone tz = TimeZone.getDefault();
          final Locale lcl = locale==null ?Locale.getDefault() : locale;
          final ParsePosition pos = new ParsePosition(0);
          final Calendar calendar = Calendar.getInstance(tz, lcl);
          calendar.setLenient(lenient);
  
          for (final String parsePattern : parsePatterns) {
              final FastDateParser fdp = new FastDateParser(parsePattern, tz, lcl);
              calendar.clear();
              try {
                  if (fdp.parse(str, pos, calendar) && pos.getIndex()==str.length()) {
                      return calendar.getTime();
                  }
              } catch(final IllegalArgumentException ignore) {
                  // leniency is preventing calendar from being set
              }
              pos.setIndex(0);
          }
          throw new ParseException("Unable to parse the date: " + str, -1);
      }
docs: <p>Parses a string representing a date by trying a variety of different parsers.</p>
  
  <p>The parse will try each parse pattern in turn.
  A parse is only deemed successful if it parses the whole of the input string.
  If no parse patterns match, a ParseException is thrown.</p>
  
  @param str  the date to parse, not null
  @param locale the locale to use when interpretting the pattern, can be null in which
  case the default system locale is used
  @param parsePatterns  the date format patterns to use, see SimpleDateFormat, not null
  @param lenient Specify whether or not date/time parsing is to be lenient.
  @return the parsed date
  @throws IllegalArgumentException if the date string or pattern array is null
  @throws ParseException if none of the date patterns were suitable
  @see java.util.Calendar#isLenient()