diff --git a/.checkstyle b/.checkstyle
new file mode 100644
index 000000000..5783bc0d7
--- /dev/null
+++ b/.checkstyle
@@ -0,0 +1,7 @@
+
+
+
@@ -213,16 +213,16 @@ protected void process(final MapString
.
*/
public String format(final Object value, final Locale locale, final TimeZone timeZone) {
- return format(value, (String)null, locale, timeZone);
+ return format(value, (String) null, locale, timeZone);
}
/**
@@ -270,7 +270,7 @@ public String format(final Object value, final Locale locale, final TimeZone tim
*/
@Override
public String format(final Object value, final String pattern, final Locale locale) {
- return format(value, pattern, locale, (TimeZone)null);
+ return format(value, pattern, locale, (TimeZone) null);
}
/**
@@ -285,11 +285,11 @@ public String format(final Object value, final String pattern, final Locale loca
* @return The value formatted as a String
.
*/
public String format(final Object value, final String pattern, final Locale locale, final TimeZone timeZone) {
- final DateFormat formatter = (DateFormat)getFormat(pattern, locale);
+ final DateFormat formatter = (DateFormat) getFormat(pattern, locale);
if (timeZone != null) {
formatter.setTimeZone(timeZone);
} else if (value instanceof Calendar) {
- formatter.setTimeZone(((Calendar)value).getTimeZone());
+ formatter.setTimeZone(((Calendar) value).getTimeZone());
}
return format(value, formatter);
}
@@ -305,7 +305,7 @@ public String format(final Object value, final String pattern, final Locale loca
* @return The value formatted as a String
.
*/
public String format(final Object value, final String pattern, final TimeZone timeZone) {
- return format(value, pattern, (Locale)null, timeZone);
+ return format(value, pattern, (Locale) null, timeZone);
}
/**
@@ -318,7 +318,7 @@ public String format(final Object value, final String pattern, final TimeZone ti
* @return The value formatted as a String
.
*/
public String format(final Object value, final TimeZone timeZone) {
- return format(value, (String)null, (Locale)null, timeZone);
+ return format(value, (String) null, (Locale) null, timeZone);
}
/**
@@ -329,7 +329,6 @@ public String format(final Object value, final TimeZone timeZone) {
* @return The DateFormat
to created.
*/
protected Format getFormat(final Locale locale) {
-
DateFormat formatter;
if (dateStyle >= 0 && timeStyle >= 0) {
if (locale == null) {
@@ -370,7 +369,7 @@ protected Format getFormat(final String pattern, final Locale locale) {
DateFormat formatter;
final boolean usePattern = pattern != null && !pattern.isEmpty();
if (!usePattern) {
- formatter = (DateFormat)getFormat(locale);
+ formatter = (DateFormat) getFormat(locale);
} else if (locale == null) {
formatter = new SimpleDateFormat(pattern);
} else {
@@ -391,7 +390,7 @@ protected Format getFormat(final String pattern, final Locale locale) {
*/
@Override
public boolean isValid(final String value, final String pattern, final Locale locale) {
- final Object parsedValue = parse(value, pattern, locale, (TimeZone)null);
+ final Object parsedValue = parse(value, pattern, locale, (TimeZone) null);
return parsedValue == null ? false : true;
}
@@ -411,7 +410,7 @@ protected Object parse(String value, final String pattern, final Locale locale,
if (value == null || value.isEmpty()) {
return null;
}
- final DateFormat formatter = (DateFormat)getFormat(pattern, locale);
+ final DateFormat formatter = (DateFormat) getFormat(pattern, locale);
if (timeZone != null) {
formatter.setTimeZone(timeZone);
}
diff --git a/src/main/java/org/apache/commons/validator/routines/AbstractFormatValidator.java b/src/main/java/org/apache/commons/validator/routines/AbstractFormatValidator.java
index 6797a345c..661c90f20 100644
--- a/src/main/java/org/apache/commons/validator/routines/AbstractFormatValidator.java
+++ b/src/main/java/org/apache/commons/validator/routines/AbstractFormatValidator.java
@@ -56,7 +56,7 @@ public AbstractFormatValidator(final boolean strict) {
* @return The value formatted as a String
.
*/
public String format(final Object value) {
- return format(value, (String)null, (Locale)null);
+ return format(value, (String) null, (Locale) null);
}
/**
@@ -79,7 +79,7 @@ protected String format(final Object value, final Format formatter) {
* @return The value formatted as a String
.
*/
public String format(final Object value, final Locale locale) {
- return format(value, (String)null, locale);
+ return format(value, (String) null, locale);
}
/**
@@ -91,7 +91,7 @@ public String format(final Object value, final Locale locale) {
* @return The value formatted as a String
.
*/
public String format(final Object value, final String pattern) {
- return format(value, pattern, (Locale)null);
+ return format(value, pattern, (Locale) null);
}
/**
@@ -147,7 +147,7 @@ public boolean isStrict() {
* @return {@code true} if the value is valid.
*/
public boolean isValid(final String value) {
- return isValid(value, (String)null, (Locale)null);
+ return isValid(value, (String) null, (Locale) null);
}
/**
@@ -158,7 +158,7 @@ public boolean isValid(final String value) {
* @return {@code true} if the value is valid.
*/
public boolean isValid(final String value, final Locale locale) {
- return isValid(value, (String)null, locale);
+ return isValid(value, (String) null, locale);
}
/**
@@ -169,7 +169,7 @@ public boolean isValid(final String value, final Locale locale) {
* @return {@code true} if the value is valid.
*/
public boolean isValid(final String value, final String pattern) {
- return isValid(value, pattern, (Locale)null);
+ return isValid(value, pattern, (Locale) null);
}
/**
@@ -190,21 +190,17 @@ public boolean isValid(final String value, final String pattern) {
* @return The parsed value if valid or {@code null} if invalid.
*/
protected Object parse(final String value, final Format formatter) {
-
final ParsePosition pos = new ParsePosition(0);
Object parsedValue = formatter.parseObject(value, pos);
if (pos.getErrorIndex() > -1) {
return null;
}
-
if (isStrict() && pos.getIndex() < value.length()) {
return null;
}
-
if (parsedValue != null) {
parsedValue = processParsedValue(parsedValue, formatter);
}
-
return parsedValue;
}
diff --git a/src/main/java/org/apache/commons/validator/routines/BigDecimalValidator.java b/src/main/java/org/apache/commons/validator/routines/BigDecimalValidator.java
index 9a1db6323..c766b791b 100644
--- a/src/main/java/org/apache/commons/validator/routines/BigDecimalValidator.java
+++ b/src/main/java/org/apache/commons/validator/routines/BigDecimalValidator.java
@@ -173,12 +173,12 @@ public boolean minValue(final BigDecimal value, final double min) {
protected Object processParsedValue(final Object value, final Format formatter) {
BigDecimal decimal;
if (value instanceof Long) {
- decimal = BigDecimal.valueOf(((Long)value).longValue());
+ decimal = BigDecimal.valueOf(((Long) value).longValue());
} else {
decimal = new BigDecimal(value.toString());
}
- final int scale = determineScale((NumberFormat)formatter);
+ final int scale = determineScale((NumberFormat) formatter);
if (scale >= 0) {
decimal = decimal.setScale(scale, BigDecimal.ROUND_DOWN);
}
@@ -195,7 +195,7 @@ protected Object processParsedValue(final Object value, final Format formatter)
* if invalid.
*/
public BigDecimal validate(final String value) {
- return (BigDecimal)parse(value, (String)null, (Locale)null);
+ return (BigDecimal) parse(value, (String) null, (Locale) null);
}
/**
@@ -207,7 +207,7 @@ public BigDecimal validate(final String value) {
* @return The parsed BigDecimal
if valid or {@code null} if invalid.
*/
public BigDecimal validate(final String value, final Locale locale) {
- return (BigDecimal)parse(value, (String)null, locale);
+ return (BigDecimal) parse(value, (String) null, locale);
}
/**
@@ -220,7 +220,7 @@ public BigDecimal validate(final String value, final Locale locale) {
* @return The parsed BigDecimal
if valid or {@code null} if invalid.
*/
public BigDecimal validate(final String value, final String pattern) {
- return (BigDecimal)parse(value, pattern, (Locale)null);
+ return (BigDecimal) parse(value, pattern, (Locale) null);
}
/**
@@ -234,6 +234,6 @@ public BigDecimal validate(final String value, final String pattern) {
* @return The parsed BigDecimal
if valid or {@code null} if invalid.
*/
public BigDecimal validate(final String value, final String pattern, final Locale locale) {
- return (BigDecimal)parse(value, pattern, locale);
+ return (BigDecimal) parse(value, pattern, locale);
}
}
diff --git a/src/main/java/org/apache/commons/validator/routines/BigIntegerValidator.java b/src/main/java/org/apache/commons/validator/routines/BigIntegerValidator.java
index 7a2d30852..7ec0fccae 100644
--- a/src/main/java/org/apache/commons/validator/routines/BigIntegerValidator.java
+++ b/src/main/java/org/apache/commons/validator/routines/BigIntegerValidator.java
@@ -155,7 +155,7 @@ public boolean minValue(final BigInteger value, final long min) {
*/
@Override
protected Object processParsedValue(final Object value, final Format formatter) {
- return BigInteger.valueOf(((Number)value).longValue());
+ return BigInteger.valueOf(((Number) value).longValue());
}
/**
@@ -167,7 +167,7 @@ protected Object processParsedValue(final Object value, final Format formatter)
* if invalid.
*/
public BigInteger validate(final String value) {
- return (BigInteger)parse(value, (String)null, (Locale)null);
+ return (BigInteger) parse(value, (String) null, (Locale) null);
}
/**
@@ -179,7 +179,7 @@ public BigInteger validate(final String value) {
* @return The parsed BigInteger
if valid or {@code null} if invalid.
*/
public BigInteger validate(final String value, final Locale locale) {
- return (BigInteger)parse(value, (String)null, locale);
+ return (BigInteger) parse(value, (String) null, locale);
}
/**
@@ -191,7 +191,7 @@ public BigInteger validate(final String value, final Locale locale) {
* @return The parsed BigInteger
if valid or {@code null} if invalid.
*/
public BigInteger validate(final String value, final String pattern) {
- return (BigInteger)parse(value, pattern, (Locale)null);
+ return (BigInteger) parse(value, pattern, (Locale) null);
}
/**
@@ -205,6 +205,6 @@ public BigInteger validate(final String value, final String pattern) {
* @return The parsed BigInteger
if valid or {@code null} if invalid.
*/
public BigInteger validate(final String value, final String pattern, final Locale locale) {
- return (BigInteger)parse(value, pattern, locale);
+ return (BigInteger) parse(value, pattern, locale);
}
}
diff --git a/src/main/java/org/apache/commons/validator/routines/ByteValidator.java b/src/main/java/org/apache/commons/validator/routines/ByteValidator.java
index ad26fc494..a21cbfbc0 100644
--- a/src/main/java/org/apache/commons/validator/routines/ByteValidator.java
+++ b/src/main/java/org/apache/commons/validator/routines/ByteValidator.java
@@ -195,10 +195,10 @@ protected Object processParsedValue(final Object value, final Format formatter)
// Parsed value will be Long if it fits in a long and is not fractional
if (value instanceof Long) {
- final long longValue = ((Long)value).longValue();
+ final long longValue = ((Long) value).longValue();
if (longValue >= Byte.MIN_VALUE &&
longValue <= Byte.MAX_VALUE) {
- return Byte.valueOf((byte)longValue);
+ return Byte.valueOf((byte) longValue);
}
}
return null;
@@ -213,7 +213,7 @@ protected Object processParsedValue(final Object value, final Format formatter)
* if invalid.
*/
public Byte validate(final String value) {
- return (Byte)parse(value, (String)null, (Locale)null);
+ return (Byte) parse(value, (String) null, (Locale) null);
}
/**
@@ -225,7 +225,7 @@ public Byte validate(final String value) {
* @return The parsed Byte
if valid or {@code null} if invalid.
*/
public Byte validate(final String value, final Locale locale) {
- return (Byte)parse(value, (String)null, locale);
+ return (Byte) parse(value, (String) null, locale);
}
/**
@@ -237,7 +237,7 @@ public Byte validate(final String value, final Locale locale) {
* @return The parsed Byte
if valid or {@code null} if invalid.
*/
public Byte validate(final String value, final String pattern) {
- return (Byte)parse(value, pattern, (Locale)null);
+ return (Byte) parse(value, pattern, (Locale) null);
}
/**
@@ -251,7 +251,7 @@ public Byte validate(final String value, final String pattern) {
* @return The parsed Byte
if valid or {@code null} if invalid.
*/
public Byte validate(final String value, final String pattern, final Locale locale) {
- return (Byte)parse(value, pattern, locale);
+ return (Byte) parse(value, pattern, locale);
}
}
diff --git a/src/main/java/org/apache/commons/validator/routines/CalendarValidator.java b/src/main/java/org/apache/commons/validator/routines/CalendarValidator.java
index 4428b7c53..47a77b5d3 100644
--- a/src/main/java/org/apache/commons/validator/routines/CalendarValidator.java
+++ b/src/main/java/org/apache/commons/validator/routines/CalendarValidator.java
@@ -227,7 +227,7 @@ public int compareYears(final Calendar value, final Calendar compare) {
*/
@Override
protected Object processParsedValue(final Object value, final Format formatter) {
- return ((DateFormat)formatter).getCalendar();
+ return ((DateFormat) formatter).getCalendar();
}
/**
@@ -239,7 +239,7 @@ protected Object processParsedValue(final Object value, final Format formatter)
* if invalid.
*/
public Calendar validate(final String value) {
- return (Calendar)parse(value, (String)null, (Locale)null, (TimeZone)null);
+ return (Calendar) parse(value, (String) null, (Locale) null, (TimeZone) null);
}
/**
@@ -251,7 +251,7 @@ public Calendar validate(final String value) {
* @return The parsed Calendar
if valid or {@code null} if invalid.
*/
public Calendar validate(final String value, final Locale locale) {
- return (Calendar)parse(value, (String)null, locale, (TimeZone)null);
+ return (Calendar) parse(value, (String) null, locale, (TimeZone) null);
}
/**
@@ -264,7 +264,7 @@ public Calendar validate(final String value, final Locale locale) {
* @return The parsed Calendar
if valid or {@code null} if invalid.
*/
public Calendar validate(final String value, final Locale locale, final TimeZone timeZone) {
- return (Calendar)parse(value, (String)null, locale, timeZone);
+ return (Calendar) parse(value, (String) null, locale, timeZone);
}
/**
@@ -276,7 +276,7 @@ public Calendar validate(final String value, final Locale locale, final TimeZone
* @return The parsed Calendar
if valid or {@code null} if invalid.
*/
public Calendar validate(final String value, final String pattern) {
- return (Calendar)parse(value, pattern, (Locale)null, (TimeZone)null);
+ return (Calendar) parse(value, pattern, (Locale) null, (TimeZone) null);
}
/**
@@ -290,7 +290,7 @@ public Calendar validate(final String value, final String pattern) {
* @return The parsed Calendar
if valid or {@code null} if invalid.
*/
public Calendar validate(final String value, final String pattern, final Locale locale) {
- return (Calendar)parse(value, pattern, locale, (TimeZone)null);
+ return (Calendar) parse(value, pattern, locale, (TimeZone) null);
}
/**
@@ -305,7 +305,7 @@ public Calendar validate(final String value, final String pattern, final Locale
* @return The parsed Calendar
if valid or {@code null} if invalid.
*/
public Calendar validate(final String value, final String pattern, final Locale locale, final TimeZone timeZone) {
- return (Calendar)parse(value, pattern, locale, timeZone);
+ return (Calendar) parse(value, pattern, locale, timeZone);
}
/**
@@ -318,7 +318,7 @@ public Calendar validate(final String value, final String pattern, final Locale
* @return The parsed Calendar
if valid or {@code null} if invalid.
*/
public Calendar validate(final String value, final String pattern, final TimeZone timeZone) {
- return (Calendar)parse(value, pattern, (Locale)null, timeZone);
+ return (Calendar) parse(value, pattern, (Locale) null, timeZone);
}
/**
@@ -331,7 +331,7 @@ public Calendar validate(final String value, final String pattern, final TimeZon
* if invalid.
*/
public Calendar validate(final String value, final TimeZone timeZone) {
- return (Calendar)parse(value, (String)null, (Locale)null, timeZone);
+ return (Calendar) parse(value, (String) null, (Locale) null, timeZone);
}
}
diff --git a/src/main/java/org/apache/commons/validator/routines/CreditCardValidator.java b/src/main/java/org/apache/commons/validator/routines/CreditCardValidator.java
index 98868e5ae..49474d996 100644
--- a/src/main/java/org/apache/commons/validator/routines/CreditCardValidator.java
+++ b/src/main/java/org/apache/commons/validator/routines/CreditCardValidator.java
@@ -248,14 +248,14 @@ public CreditCardRange(final String low, final String high, final int [] lengths
*
*/
private static final RegexValidator MASTERCARD_REGEX = new RegexValidator(
- "^(5[1-5]\\d{14})$", // 51 - 55 (pre Oct 2016)
+ "^(5[1-5]\\d{14})$", // 51 - 55 (pre Oct 2016)
// valid from October 2016
- "^(2221\\d{12})$", // 222100 - 222199
- "^(222[2-9]\\d{12})$",// 222200 - 222999
- "^(22[3-9]\\d{13})$", // 223000 - 229999
- "^(2[3-6]\\d{14})$", // 230000 - 269999
- "^(27[01]\\d{13})$", // 270000 - 271999
- "^(2720\\d{12})$" // 272000 - 272099
+ "^(2221\\d{12})$", // 222100 - 222199
+ "^(222[2-9]\\d{12})$", // 222200 - 222999
+ "^(22[3-9]\\d{13})$", // 223000 - 229999
+ "^(2[3-6]\\d{14})$", // 230000 - 269999
+ "^(27[01]\\d{13})$", // 270000 - 271999
+ "^(2720\\d{12})$" // 272000 - 272099
);
/** Mastercard Card Validator */
diff --git a/src/main/java/org/apache/commons/validator/routines/CurrencyValidator.java b/src/main/java/org/apache/commons/validator/routines/CurrencyValidator.java
index 5afba19f6..4a57520c5 100644
--- a/src/main/java/org/apache/commons/validator/routines/CurrencyValidator.java
+++ b/src/main/java/org/apache/commons/validator/routines/CurrencyValidator.java
@@ -100,7 +100,7 @@ protected Object parse(final String value, final Format formatter) {
}
// Re-parse using a pattern without the currency symbol
- final DecimalFormat decimalFormat = (DecimalFormat)formatter;
+ final DecimalFormat decimalFormat = (DecimalFormat) formatter;
final String pattern = decimalFormat.toPattern();
if (pattern.indexOf(CURRENCY_SYMBOL) >= 0) {
final StringBuilder buffer = new StringBuilder(pattern.length());
diff --git a/src/main/java/org/apache/commons/validator/routines/DateValidator.java b/src/main/java/org/apache/commons/validator/routines/DateValidator.java
index ceeef158a..d00ad34e0 100644
--- a/src/main/java/org/apache/commons/validator/routines/DateValidator.java
+++ b/src/main/java/org/apache/commons/validator/routines/DateValidator.java
@@ -250,7 +250,7 @@ protected Object processParsedValue(final Object value, final Format formatter)
* if invalid.
*/
public Date validate(final String value) {
- return (Date)parse(value, (String)null, (Locale)null, (TimeZone)null);
+ return (Date) parse(value, (String) null, (Locale) null, (TimeZone) null);
}
/**
@@ -262,7 +262,7 @@ public Date validate(final String value) {
* @return The parsed Date
if valid or {@code null} if invalid.
*/
public Date validate(final String value, final Locale locale) {
- return (Date)parse(value, (String)null, locale, (TimeZone)null);
+ return (Date) parse(value, (String) null, locale, (TimeZone) null);
}
/**
@@ -275,7 +275,7 @@ public Date validate(final String value, final Locale locale) {
* @return The parsed Date
if valid or {@code null} if invalid.
*/
public Date validate(final String value, final Locale locale, final TimeZone timeZone) {
- return (Date)parse(value, (String)null, locale, timeZone);
+ return (Date) parse(value, (String) null, locale, timeZone);
}
/**
@@ -288,7 +288,7 @@ public Date validate(final String value, final Locale locale, final TimeZone tim
* @return The parsed Date
if valid or {@code null} if invalid.
*/
public Date validate(final String value, final String pattern) {
- return (Date)parse(value, pattern, (Locale)null, (TimeZone)null);
+ return (Date) parse(value, pattern, (Locale) null, (TimeZone) null);
}
/**
@@ -302,7 +302,7 @@ public Date validate(final String value, final String pattern) {
* @return The parsed Date
if valid or {@code null} if invalid.
*/
public Date validate(final String value, final String pattern, final Locale locale) {
- return (Date)parse(value, pattern, locale, (TimeZone)null);
+ return (Date) parse(value, pattern, locale, (TimeZone) null);
}
/**
@@ -317,7 +317,7 @@ public Date validate(final String value, final String pattern, final Locale loca
* @return The parsed Date
if valid or {@code null} if invalid.
*/
public Date validate(final String value, final String pattern, final Locale locale, final TimeZone timeZone) {
- return (Date)parse(value, pattern, locale, timeZone);
+ return (Date) parse(value, pattern, locale, timeZone);
}
/**
@@ -331,7 +331,7 @@ public Date validate(final String value, final String pattern, final Locale loca
* @return The parsed Date
if valid or {@code null} if invalid.
*/
public Date validate(final String value, final String pattern, final TimeZone timeZone) {
- return (Date)parse(value, pattern, (Locale)null, timeZone);
+ return (Date) parse(value, pattern, (Locale) null, timeZone);
}
/**
@@ -343,7 +343,7 @@ public Date validate(final String value, final String pattern, final TimeZone ti
* @return The parsed Date
if valid or {@code null} if invalid.
*/
public Date validate(final String value, final TimeZone timeZone) {
- return (Date)parse(value, (String)null, (Locale)null, timeZone);
+ return (Date) parse(value, (String) null, (Locale) null, timeZone);
}
}
diff --git a/src/main/java/org/apache/commons/validator/routines/DomainValidator.java b/src/main/java/org/apache/commons/validator/routines/DomainValidator.java
index ef2fab15f..f7f7845bf 100644
--- a/src/main/java/org/apache/commons/validator/routines/DomainValidator.java
+++ b/src/main/java/org/apache/commons/validator/routines/DomainValidator.java
@@ -1942,7 +1942,7 @@ static String unicodeToASCII(final String input) {
// characters MUST be recognized as dots: U+002E (full stop), U+3002
// (ideographic full stop), U+FF0E (fullwidth full stop), U+FF61
// (halfwidth ideographic full stop).
- final char lastChar = input.charAt(length - 1);// fetch original last char
+ final char lastChar = input.charAt(length - 1); // fetch original last char
switch (lastChar) {
case '\u002E': // "." full stop
case '\u3002': // ideographic full stop
diff --git a/src/main/java/org/apache/commons/validator/routines/DoubleValidator.java b/src/main/java/org/apache/commons/validator/routines/DoubleValidator.java
index f7ef52e63..46d1abaa0 100644
--- a/src/main/java/org/apache/commons/validator/routines/DoubleValidator.java
+++ b/src/main/java/org/apache/commons/validator/routines/DoubleValidator.java
@@ -195,7 +195,7 @@ protected Object processParsedValue(final Object value, final Format formatter)
if (value instanceof Double) {
return value;
}
- return Double.valueOf(((Number)value).doubleValue());
+ return Double.valueOf(((Number) value).doubleValue());
}
@@ -208,7 +208,7 @@ protected Object processParsedValue(final Object value, final Format formatter)
* if invalid.
*/
public Double validate(final String value) {
- return (Double)parse(value, (String)null, (Locale)null);
+ return (Double) parse(value, (String) null, (Locale) null);
}
/**
@@ -220,7 +220,7 @@ public Double validate(final String value) {
* @return The parsed Double
if valid or {@code null} if invalid.
*/
public Double validate(final String value, final Locale locale) {
- return (Double)parse(value, (String)null, locale);
+ return (Double) parse(value, (String) null, locale);
}
/**
@@ -232,7 +232,7 @@ public Double validate(final String value, final Locale locale) {
* @return The parsed BigDecimal
if valid or {@code null} if invalid.
*/
public Double validate(final String value, final String pattern) {
- return (Double)parse(value, pattern, (Locale)null);
+ return (Double) parse(value, pattern, (Locale) null);
}
/**
@@ -246,6 +246,6 @@ public Double validate(final String value, final String pattern) {
* @return The parsed Double
if valid or {@code null} if invalid.
*/
public Double validate(final String value, final String pattern, final Locale locale) {
- return (Double)parse(value, pattern, locale);
+ return (Double) parse(value, pattern, locale);
}
}
diff --git a/src/main/java/org/apache/commons/validator/routines/FloatValidator.java b/src/main/java/org/apache/commons/validator/routines/FloatValidator.java
index ede839122..180f976a2 100644
--- a/src/main/java/org/apache/commons/validator/routines/FloatValidator.java
+++ b/src/main/java/org/apache/commons/validator/routines/FloatValidator.java
@@ -225,7 +225,7 @@ protected Object processParsedValue(final Object value, final Format formatter)
* if invalid.
*/
public Float validate(final String value) {
- return (Float)parse(value, (String)null, (Locale)null);
+ return (Float) parse(value, (String) null, (Locale) null);
}
/**
@@ -237,7 +237,7 @@ public Float validate(final String value) {
* @return The parsed Float
if valid or {@code null} if invalid.
*/
public Float validate(final String value, final Locale locale) {
- return (Float)parse(value, (String)null, locale);
+ return (Float) parse(value, (String) null, locale);
}
/**
@@ -249,7 +249,7 @@ public Float validate(final String value, final Locale locale) {
* @return The parsed Float
if valid or {@code null} if invalid.
*/
public Float validate(final String value, final String pattern) {
- return (Float)parse(value, pattern, (Locale)null);
+ return (Float) parse(value, pattern, (Locale) null);
}
/**
@@ -263,7 +263,7 @@ public Float validate(final String value, final String pattern) {
* @return The parsed Float
if valid or {@code null} if invalid.
*/
public Float validate(final String value, final String pattern, final Locale locale) {
- return (Float)parse(value, pattern, locale);
+ return (Float) parse(value, pattern, locale);
}
}
diff --git a/src/main/java/org/apache/commons/validator/routines/ISINValidator.java b/src/main/java/org/apache/commons/validator/routines/ISINValidator.java
index 3ff30c3c1..df83bae09 100644
--- a/src/main/java/org/apache/commons/validator/routines/ISINValidator.java
+++ b/src/main/java/org/apache/commons/validator/routines/ISINValidator.java
@@ -462,7 +462,7 @@ private boolean checkCode(final String code) {
public boolean isValid(final String code) {
final boolean valid = VALIDATOR.isValid(code);
if (valid && checkCountryCode) {
- return checkCode(code.substring(0,2));
+ return checkCode(code.substring(0, 2));
}
return valid;
}
@@ -476,7 +476,7 @@ public boolean isValid(final String code) {
public Object validate(final String code) {
final Object validate = VALIDATOR.validate(code);
if (validate != null && checkCountryCode) {
- return checkCode(code.substring(0,2)) ? validate : null;
+ return checkCode(code.substring(0, 2)) ? validate : null;
}
return validate;
}
diff --git a/src/main/java/org/apache/commons/validator/routines/IntegerValidator.java b/src/main/java/org/apache/commons/validator/routines/IntegerValidator.java
index 0882bac13..267fc0f34 100644
--- a/src/main/java/org/apache/commons/validator/routines/IntegerValidator.java
+++ b/src/main/java/org/apache/commons/validator/routines/IntegerValidator.java
@@ -195,10 +195,10 @@ protected Object processParsedValue(final Object value, final Format formatter)
// Parsed value will be Long if it fits in a long and is not fractional
if (value instanceof Long) {
- final long longValue = ((Long)value).longValue();
+ final long longValue = ((Long) value).longValue();
if (longValue >= Integer.MIN_VALUE &&
longValue <= Integer.MAX_VALUE) {
- return Integer.valueOf((int)longValue);
+ return Integer.valueOf((int) longValue);
}
}
return null;
@@ -213,7 +213,7 @@ protected Object processParsedValue(final Object value, final Format formatter)
* if invalid.
*/
public Integer validate(final String value) {
- return (Integer)parse(value, (String)null, (Locale)null);
+ return (Integer) parse(value, (String) null, (Locale) null);
}
/**
@@ -225,7 +225,7 @@ public Integer validate(final String value) {
* @return The parsed Integer
if valid or {@code null} if invalid.
*/
public Integer validate(final String value, final Locale locale) {
- return (Integer)parse(value, (String)null, locale);
+ return (Integer) parse(value, (String) null, locale);
}
/**
@@ -237,7 +237,7 @@ public Integer validate(final String value, final Locale locale) {
* @return The parsed Integer
if valid or {@code null} if invalid.
*/
public Integer validate(final String value, final String pattern) {
- return (Integer)parse(value, pattern, (Locale)null);
+ return (Integer) parse(value, pattern, (Locale) null);
}
/**
@@ -251,6 +251,6 @@ public Integer validate(final String value, final String pattern) {
* @return The parsed Integer
if valid or {@code null} if invalid.
*/
public Integer validate(final String value, final String pattern, final Locale locale) {
- return (Integer)parse(value, pattern, locale);
+ return (Integer) parse(value, pattern, locale);
}
}
diff --git a/src/main/java/org/apache/commons/validator/routines/LongValidator.java b/src/main/java/org/apache/commons/validator/routines/LongValidator.java
index 079a151e2..edd69d5ab 100644
--- a/src/main/java/org/apache/commons/validator/routines/LongValidator.java
+++ b/src/main/java/org/apache/commons/validator/routines/LongValidator.java
@@ -208,7 +208,7 @@ protected Object processParsedValue(final Object value, final Format formatter)
* if invalid.
*/
public Long validate(final String value) {
- return (Long)parse(value, (String)null, (Locale)null);
+ return (Long) parse(value, (String) null, (Locale) null);
}
/**
@@ -220,7 +220,7 @@ public Long validate(final String value) {
* @return The parsed Long
if valid or {@code null} if invalid.
*/
public Long validate(final String value, final Locale locale) {
- return (Long)parse(value, (String)null, locale);
+ return (Long) parse(value, (String) null, locale);
}
/**
@@ -232,7 +232,7 @@ public Long validate(final String value, final Locale locale) {
* @return The parsed Long
if valid or {@code null} if invalid.
*/
public Long validate(final String value, final String pattern) {
- return (Long)parse(value, pattern, (Locale)null);
+ return (Long) parse(value, pattern, (Locale) null);
}
/**
@@ -246,6 +246,6 @@ public Long validate(final String value, final String pattern) {
* @return The parsed Long
if valid or {@code null} if invalid.
*/
public Long validate(final String value, final String pattern, final Locale locale) {
- return (Long)parse(value, pattern, locale);
+ return (Long) parse(value, pattern, locale);
}
}
diff --git a/src/main/java/org/apache/commons/validator/routines/PercentValidator.java b/src/main/java/org/apache/commons/validator/routines/PercentValidator.java
index 635dbe957..408783d2c 100644
--- a/src/main/java/org/apache/commons/validator/routines/PercentValidator.java
+++ b/src/main/java/org/apache/commons/validator/routines/PercentValidator.java
@@ -97,13 +97,13 @@ public PercentValidator(final boolean strict) {
protected Object parse(final String value, final Format formatter) {
// Initial parse of the value
- BigDecimal parsedValue = (BigDecimal)super.parse(value, formatter);
+ BigDecimal parsedValue = (BigDecimal) super.parse(value, formatter);
if (parsedValue != null || !(formatter instanceof DecimalFormat)) {
return parsedValue;
}
// Re-parse using a pattern without the percent symbol
- final DecimalFormat decimalFormat = (DecimalFormat)formatter;
+ final DecimalFormat decimalFormat = (DecimalFormat) formatter;
final String pattern = decimalFormat.toPattern();
if (pattern.indexOf(PERCENT_SYMBOL) >= 0) {
final StringBuilder buffer = new StringBuilder(pattern.length());
@@ -113,7 +113,7 @@ protected Object parse(final String value, final Format formatter) {
}
}
decimalFormat.applyPattern(buffer.toString());
- parsedValue = (BigDecimal)super.parse(value, decimalFormat);
+ parsedValue = (BigDecimal) super.parse(value, decimalFormat);
// If parsed OK, divide by 100 to get percent
if (parsedValue != null) {
diff --git a/src/main/java/org/apache/commons/validator/routines/ShortValidator.java b/src/main/java/org/apache/commons/validator/routines/ShortValidator.java
index f23d6762e..c1c8ae7b3 100644
--- a/src/main/java/org/apache/commons/validator/routines/ShortValidator.java
+++ b/src/main/java/org/apache/commons/validator/routines/ShortValidator.java
@@ -193,13 +193,13 @@ public boolean minValue(final Short value, final short min) {
@Override
protected Object processParsedValue(final Object value, final Format formatter) {
- final long longValue = ((Number)value).longValue();
+ final long longValue = ((Number) value).longValue();
if (longValue < Short.MIN_VALUE ||
longValue > Short.MAX_VALUE) {
return null;
}
- return Short.valueOf((short)longValue);
+ return Short.valueOf((short) longValue);
}
/**
@@ -211,7 +211,7 @@ protected Object processParsedValue(final Object value, final Format formatter)
* if invalid.
*/
public Short validate(final String value) {
- return (Short)parse(value, (String)null, (Locale)null);
+ return (Short) parse(value, (String) null, (Locale) null);
}
/**
@@ -223,7 +223,7 @@ public Short validate(final String value) {
* @return The parsed Short
if valid or {@code null} if invalid.
*/
public Short validate(final String value, final Locale locale) {
- return (Short)parse(value, (String)null, locale);
+ return (Short) parse(value, (String) null, locale);
}
/**
@@ -235,7 +235,7 @@ public Short validate(final String value, final Locale locale) {
* @return The parsed Short
if valid or {@code null} if invalid.
*/
public Short validate(final String value, final String pattern) {
- return (Short)parse(value, pattern, (Locale)null);
+ return (Short) parse(value, pattern, (Locale) null);
}
/**
@@ -249,6 +249,6 @@ public Short validate(final String value, final String pattern) {
* @return The parsed Short
if valid or {@code null} if invalid.
*/
public Short validate(final String value, final String pattern, final Locale locale) {
- return (Short)parse(value, pattern, locale);
+ return (Short) parse(value, pattern, locale);
}
}
diff --git a/src/main/java/org/apache/commons/validator/routines/TimeValidator.java b/src/main/java/org/apache/commons/validator/routines/TimeValidator.java
index eee7ad425..f7b35c350 100644
--- a/src/main/java/org/apache/commons/validator/routines/TimeValidator.java
+++ b/src/main/java/org/apache/commons/validator/routines/TimeValidator.java
@@ -176,7 +176,7 @@ public int compareTime(final Calendar value, final Calendar compare) {
*/
@Override
protected Object processParsedValue(final Object value, final Format formatter) {
- return ((DateFormat)formatter).getCalendar();
+ return ((DateFormat) formatter).getCalendar();
}
/**
@@ -188,7 +188,7 @@ protected Object processParsedValue(final Object value, final Format formatter)
* if invalid.
*/
public Calendar validate(final String value) {
- return (Calendar)parse(value, (String)null, (Locale)null, (TimeZone)null);
+ return (Calendar) parse(value, (String) null, (Locale) null, (TimeZone) null);
}
/**
@@ -200,7 +200,7 @@ public Calendar validate(final String value) {
* @return The parsed Calendar
if valid or {@code null} if invalid.
*/
public Calendar validate(final String value, final Locale locale) {
- return (Calendar)parse(value, (String)null, locale, (TimeZone)null);
+ return (Calendar) parse(value, (String) null, locale, (TimeZone) null);
}
/**
@@ -213,7 +213,7 @@ public Calendar validate(final String value, final Locale locale) {
* @return The parsed Calendar
if valid or {@code null} if invalid.
*/
public Calendar validate(final String value, final Locale locale, final TimeZone timeZone) {
- return (Calendar)parse(value, (String)null, locale, timeZone);
+ return (Calendar) parse(value, (String) null, locale, timeZone);
}
/**
@@ -225,7 +225,7 @@ public Calendar validate(final String value, final Locale locale, final TimeZone
* @return The parsed Calendar
if valid or {@code null} if invalid.
*/
public Calendar validate(final String value, final String pattern) {
- return (Calendar)parse(value, pattern, (Locale)null, (TimeZone)null);
+ return (Calendar) parse(value, pattern, (Locale) null, (TimeZone) null);
}
/**
@@ -239,7 +239,7 @@ public Calendar validate(final String value, final String pattern) {
* @return The parsed Calendar
if valid or {@code null} if invalid.
*/
public Calendar validate(final String value, final String pattern, final Locale locale) {
- return (Calendar)parse(value, pattern, locale, (TimeZone)null);
+ return (Calendar) parse(value, pattern, locale, (TimeZone) null);
}
/**
@@ -254,7 +254,7 @@ public Calendar validate(final String value, final String pattern, final Locale
* @return The parsed Calendar
if valid or {@code null} if invalid.
*/
public Calendar validate(final String value, final String pattern, final Locale locale, final TimeZone timeZone) {
- return (Calendar)parse(value, pattern, locale, timeZone);
+ return (Calendar) parse(value, pattern, locale, timeZone);
}
/**
@@ -267,7 +267,7 @@ public Calendar validate(final String value, final String pattern, final Locale
* @return The parsed Calendar
if valid or {@code null} if invalid.
*/
public Calendar validate(final String value, final String pattern, final TimeZone timeZone) {
- return (Calendar)parse(value, pattern, (Locale)null, timeZone);
+ return (Calendar) parse(value, pattern, (Locale) null, timeZone);
}
/**
@@ -279,6 +279,6 @@ public Calendar validate(final String value, final String pattern, final TimeZon
* @return The parsed Calendar
if valid or {@code null} if invalid.
*/
public Calendar validate(final String value, final TimeZone timeZone) {
- return (Calendar)parse(value, (String)null, (Locale)null, timeZone);
+ return (Calendar) parse(value, (String) null, (Locale) null, timeZone);
}
}
diff --git a/src/main/java/org/apache/commons/validator/routines/UrlValidator.java b/src/main/java/org/apache/commons/validator/routines/UrlValidator.java
index 62fb1697d..1312b64e8 100644
--- a/src/main/java/org/apache/commons/validator/routines/UrlValidator.java
+++ b/src/main/java/org/apache/commons/validator/routines/UrlValidator.java
@@ -494,10 +494,10 @@ protected boolean isValidPath(final String path) {
try {
// Don't omit host otherwise leading path may be taken as host if it starts with //
- final URI uri = new URI(null,"localhost",path,null);
+ final URI uri = new URI(null, "localhost", path, null);
final String norm = uri.normalize().getPath();
if (norm.startsWith("/../") // Trying to go via the parent dir
- || norm.equals("/..")) { // Trying to go to the parent dir
+ || norm.equals("/..")) { // Trying to go to the parent dir
return false;
}
} catch (final URISyntaxException e) {
@@ -521,7 +521,6 @@ protected boolean isValidQuery(final String query) {
if (query == null) {
return true;
}
-
return QUERY_PATTERN.matcher(query).matches();
}
diff --git a/src/main/java/org/apache/commons/validator/routines/checkdigit/VerhoeffCheckDigit.java b/src/main/java/org/apache/commons/validator/routines/checkdigit/VerhoeffCheckDigit.java
index 42fe5417e..4e8e0bef6 100644
--- a/src/main/java/org/apache/commons/validator/routines/checkdigit/VerhoeffCheckDigit.java
+++ b/src/main/java/org/apache/commons/validator/routines/checkdigit/VerhoeffCheckDigit.java
@@ -96,7 +96,7 @@ private int calculateChecksum(final String code, final boolean includesCheckDigi
final int num = Character.getNumericValue(code.charAt(idx));
if (num < 0 || num > 9) { // CHECKSTYLE IGNORE MagicNumber
throw new CheckDigitException("Invalid Character[" +
- i + "] = '" + (int)code.charAt(idx) + "'");
+ i + "] = '" + (int) code.charAt(idx) + "'");
}
final int pos = includesCheckDigit ? i : i + 1;
checksum = D_TABLE[checksum][P_TABLE[pos % 8][num]]; // CHECKSTYLE IGNORE MagicNumber
diff --git a/src/test/java/org/apache/commons/validator/EmailTest.java b/src/test/java/org/apache/commons/validator/EmailTest.java
index 63f1ef9be..cd9b4b9e8 100644
--- a/src/test/java/org/apache/commons/validator/EmailTest.java
+++ b/src/test/java/org/apache/commons/validator/EmailTest.java
@@ -58,13 +58,13 @@ public class EmailTest extends AbstractCommonTest {
new ResultPair("\"Abigail \"