liquibase-core/src/main/java/liquibase/util/NowAndTodayUtil.java
private static void parseNow(String value, String lowerValue, Calendar c) throws DateParseException {
        if (lowerValue.length() > NOW_LENGTH) {
            Matcher matcher = NOW_OFFSET_PATTERN.matcher(lowerValue);
            if (!matcher.find()) {
                throw new DateParseException("Improper value in 'NOW' value: " + value
                        + ". 'NOW' must be followed by + or -, then numeric offset, then units (h{our{s}}, "
                        + "m{inute{s}}, d{ay{s}}, or y{ears}");
            }
            if (matcher.groupCount() != 4) {
                throw new DateParseException("Improper value in 'NOW' value: " + value + ". Pattern match returned "
                        + matcher.groupCount() + " instead of 4");
            }
            char sign = matcher.group(2).charAt(0);
            if (sign != '+' && sign != '-') {
                throw new DateParseException("Improper sign in 'NOW' value '" + lowerValue + "'");
            }
            String offsetStr = matcher.group(3);
            int offset;
            try {
                offset = Integer.parseInt(offsetStr);
            } catch (NumberFormatException e) {
                throw new DateParseException("Improper offset in 'NOW' value '" + value + "'");
            }
            if (sign == '-') {
                offset = -offset;
            }
            int calendarField;
            String units = matcher.group(4);
            if ("years".startsWith(units)) {
                calendarField = Calendar.YEAR;
            } else if ("days".startsWith(units)) {
                calendarField = Calendar.DATE;
            } else if ("hours".startsWith(units)) {
                calendarField = Calendar.HOUR;
            } else if ("minutes".startsWith(units)) {
                calendarField = Calendar.MINUTE;
            } else {
                throw new DateParseException("Improper units in 'NOW' value: '" + units + "', must be y{ear{s}}, "
                        + "d{ay{s}}, h{our{s}}, or m{inute{s}}");
            }
            c.add(calendarField, offset);
        }
    }
private static void parseNow(String value, String lowerValue, Calendar c) throws DateParseException {
        if (lowerValue.length() > NOW_LENGTH) {
            Matcher matcher = NOW_OFFSET_PATTERN.matcher(lowerValue);
            if (!matcher.find()) {
                throw new DateParseException("Improper value in 'NOW' value: " + value
                        + ". 'NOW' must be followed by + or -, then numeric offset, then units (h{our{s}}, "
                        + "m{inute{s}}, d{ay{s}}, or y{ears}");
            }
            if (matcher.groupCount() != 4) {
                throw new DateParseException("Improper value in 'NOW' value: " + value + ". Pattern match returned "
                        + matcher.groupCount() + " instead of 4");
            }
            char sign = matcher.group(2).charAt(0);
            if (sign != '+' && sign != '-') {
                throw new DateParseException("Improper sign in 'NOW' value '" + lowerValue + "'");
            }
            String offsetStr = matcher.group(3);
            int offset;
            try {
                offset = Integer.parseInt(offsetStr);
            } catch (NumberFormatException e) {
                throw new DateParseException("Improper offset in 'NOW' value '" + value + "'");
            }
            if (sign == '-') {
                offset = -offset;
            }
            int calendarField;
            String units = matcher.group(4);
            if ("years".startsWith(units)) {
                calendarField = Calendar.YEAR;
            } else if ("days".startsWith(units)) {
                calendarField = Calendar.DATE;
            } else if ("hours".startsWith(units)) {
                calendarField = Calendar.HOUR;
            } else if ("minutes".startsWith(units)) {
                calendarField = Calendar.MINUTE;
            } else {
                throw new DateParseException("Improper units in 'NOW' value: '" + units + "', must be y{ear{s}}, "
                        + "d{ay{s}}, h{our{s}}, or m{inute{s}}");
            }
            c.add(calendarField, offset);
        }
    }
private static void parseNow ( String value , String lowerValue , Calendar c ) throws DateParseException { if ( lowerValue . length ( ) > NOW_LENGTH ) { Matcher matcher = NOW_OFFSET_PATTERN . matcher ( lowerValue ) ; if ( ! matcher . find ( ) ) { throw new DateParseException ( "Improper value in 'NOW' value: " + value + ". 'NOW' must be followed by + or -, then numeric offset, then units (h{our{s}}, " + "m{inute{s}}, d{ay{s}}, or y{ears}" ) ; } if ( matcher . groupCount ( ) != 4 ) { throw new DateParseException ( "Improper value in 'NOW' value: " + value + ". Pattern match returned " + matcher . groupCount ( ) + " instead of 4" ) ; } char sign = matcher . group ( 2 ) . charAt ( 0 ) ; if ( sign != ' ' && sign != ' ' ) { throw new DateParseException ( "Improper sign in 'NOW' value '" + lowerValue + "'" ) ; } String offsetStr = matcher . group ( 3 ) ; int offset ; try { offset = Integer . parseInt ( offsetStr ) ; } catch ( NumberFormatException e ) { throw new DateParseException ( "Improper offset in 'NOW' value '" + value + "'" ) ; } if ( sign == ' ' ) { offset = - offset ; } int calendarField ; String units = matcher . group ( 4 ) ; if ( "years" . startsWith ( units ) ) { calendarField = Calendar . YEAR ; } else if ( "days" . startsWith ( units ) ) { calendarField = Calendar . DATE ; } else if ( "hours" . startsWith ( units ) ) { calendarField = Calendar . HOUR ; } else if ( "minutes" . startsWith ( units ) ) { calendarField = Calendar . MINUTE ; } else { throw new DateParseException ( "Improper units in 'NOW' value: '" + units + "', must be y{ear{s}}, " + "d{ay{s}}, h{our{s}}, or m{inute{s}}" ) ; } c . add ( calendarField , offset ) ; } }
CHECKSTYLE:OFF Cyclomatic Complexity
CHECKSTYLE : OFF Cyclomatic Complexity