diff --git a/spring-binding/src/main/java/org/springframework/binding/collection/MapAdaptable.java b/spring-binding/src/main/java/org/springframework/binding/collection/MapAdaptable.java index 9dcaac96..c7e03c6b 100644 --- a/spring-binding/src/main/java/org/springframework/binding/collection/MapAdaptable.java +++ b/spring-binding/src/main/java/org/springframework/binding/collection/MapAdaptable.java @@ -32,6 +32,6 @@ public interface MapAdaptable { * calculated) be cached as appropriate. * @return the object's contents as a map */ - public Map asMap(); + Map asMap(); } diff --git a/spring-binding/src/main/java/org/springframework/binding/collection/SharedMap.java b/spring-binding/src/main/java/org/springframework/binding/collection/SharedMap.java index c50508b4..ea9761ab 100644 --- a/spring-binding/src/main/java/org/springframework/binding/collection/SharedMap.java +++ b/spring-binding/src/main/java/org/springframework/binding/collection/SharedMap.java @@ -41,5 +41,5 @@ public interface SharedMap extends Map { * * @return the mutex */ - public Object getMutex(); -} + Object getMutex(); +} diff --git a/spring-binding/src/main/java/org/springframework/binding/convert/ConversionExecutor.java b/spring-binding/src/main/java/org/springframework/binding/convert/ConversionExecutor.java index a5fd4dfd..bd9fe732 100644 --- a/spring-binding/src/main/java/org/springframework/binding/convert/ConversionExecutor.java +++ b/spring-binding/src/main/java/org/springframework/binding/convert/ConversionExecutor.java @@ -28,18 +28,18 @@ public interface ConversionExecutor { * Returns the source class of conversions performed by this executor. * @return the source class */ - public Class getSourceClass(); + Class getSourceClass(); /** * Returns the target class of conversions performed by this executor. * @return the target class */ - public Class getTargetClass(); + Class getTargetClass(); /** * Execute the conversion for the provided source object. * @param source the source object to convert */ - public Object execute(Object source) throws ConversionExecutionException; + Object execute(Object source) throws ConversionExecutionException; } diff --git a/spring-binding/src/main/java/org/springframework/binding/convert/ConversionService.java b/spring-binding/src/main/java/org/springframework/binding/convert/ConversionService.java index f33b49a1..698d90d2 100644 --- a/spring-binding/src/main/java/org/springframework/binding/convert/ConversionService.java +++ b/spring-binding/src/main/java/org/springframework/binding/convert/ConversionService.java @@ -32,7 +32,7 @@ public interface ConversionService { * @return the converted object, an instance of the targetClass * @throws ConversionException if an exception occurred during the conversion process */ - public Object executeConversion(Object source, Class targetClass) throws ConversionException; + Object executeConversion(Object source, Class targetClass) throws ConversionException; /** * Execute a conversion using the custom converter with the provided id. @@ -43,7 +43,7 @@ public interface ConversionService { * @return the converted object, an instance of the targetClass * @throws ConversionException if an exception occurred during the conversion process */ - public Object executeConversion(String converterId, Object source, Class targetClass); + Object executeConversion(String converterId, Object source, Class targetClass); /** * Return the default conversion executor capable of converting source objects of the specified @@ -55,7 +55,7 @@ public interface ConversionService { * @return the executor that can execute instance type conversion, never null * @throws ConversionExecutorNotFoundException when no suitable conversion executor could be found */ - public ConversionExecutor getConversionExecutor(Class sourceClass, Class targetClass) + ConversionExecutor getConversionExecutor(Class sourceClass, Class targetClass) throws ConversionExecutorNotFoundException; /** @@ -69,7 +69,7 @@ public interface ConversionService { * @return the executor that can execute instance type conversion, never null * @throws ConversionExecutorNotFoundException when no suitable conversion executor could be found */ - public ConversionExecutor getConversionExecutor(String id, Class sourceClass, Class targetClass) + ConversionExecutor getConversionExecutor(String id, Class sourceClass, Class targetClass) throws ConversionExecutorNotFoundException; /** @@ -77,13 +77,13 @@ public interface ConversionService { * @param alias the class alias * @return the class, or null if no alias exists */ - public Class getClassForAlias(String alias); + Class getClassForAlias(String alias); /** * Return the underlying Spring ConversionService. * * @return the conversion service */ - public org.springframework.core.convert.ConversionService getDelegateConversionService(); + org.springframework.core.convert.ConversionService getDelegateConversionService(); } diff --git a/spring-binding/src/main/java/org/springframework/binding/convert/converters/ArrayToArray.java b/spring-binding/src/main/java/org/springframework/binding/convert/converters/ArrayToArray.java index 03d55c9c..0ffe4683 100644 --- a/spring-binding/src/main/java/org/springframework/binding/convert/converters/ArrayToArray.java +++ b/spring-binding/src/main/java/org/springframework/binding/convert/converters/ArrayToArray.java @@ -59,7 +59,7 @@ public class ArrayToArray implements Converter { return Object[].class; } - public Object convertSourceToTargetClass(Object source, Class targetClass) throws Exception { + public Object convertSourceToTargetClass(Object source, Class targetClass) { if (source == null) { return null; } diff --git a/spring-binding/src/main/java/org/springframework/binding/convert/converters/ArrayToCollection.java b/spring-binding/src/main/java/org/springframework/binding/convert/converters/ArrayToCollection.java index e4e5f82c..0cfb03c7 100644 --- a/spring-binding/src/main/java/org/springframework/binding/convert/converters/ArrayToCollection.java +++ b/spring-binding/src/main/java/org/springframework/binding/convert/converters/ArrayToCollection.java @@ -93,7 +93,7 @@ public class ArrayToCollection implements TwoWayConverter { return collection; } - public Object convertTargetToSourceClass(Object target, Class sourceClass) throws Exception { + public Object convertTargetToSourceClass(Object target, Class sourceClass) { if (target == null) { return null; } diff --git a/spring-binding/src/main/java/org/springframework/binding/convert/converters/CollectionToCollection.java b/spring-binding/src/main/java/org/springframework/binding/convert/converters/CollectionToCollection.java index 1e233f1d..31ad3bf5 100644 --- a/spring-binding/src/main/java/org/springframework/binding/convert/converters/CollectionToCollection.java +++ b/spring-binding/src/main/java/org/springframework/binding/convert/converters/CollectionToCollection.java @@ -46,7 +46,7 @@ public class CollectionToCollection implements Converter { } @SuppressWarnings({ "rawtypes", "unchecked" }) - public Object convertSourceToTargetClass(Object source, Class targetClass) throws Exception { + public Object convertSourceToTargetClass(Object source, Class targetClass) { if (source == null) { return null; } diff --git a/spring-binding/src/main/java/org/springframework/binding/convert/converters/Converter.java b/spring-binding/src/main/java/org/springframework/binding/convert/converters/Converter.java index 1a0eef31..07cd72c5 100644 --- a/spring-binding/src/main/java/org/springframework/binding/convert/converters/Converter.java +++ b/spring-binding/src/main/java/org/springframework/binding/convert/converters/Converter.java @@ -31,14 +31,14 @@ public interface Converter { * convert specific subclasses as well. * @return the source type */ - public Class getSourceClass(); + Class getSourceClass(); /** * The target class this converter can convert to. May be an interface or abstract type to allow this converter to * convert specific subclasses as well. * @return the target type */ - public Class getTargetClass(); + Class getTargetClass(); /** * Convert the provided source object argument to an instance of the specified target class. @@ -48,6 +48,6 @@ public interface Converter { * @return the converted object, which must be an instance of the targetClass * @throws Exception an exception occurred performing the conversion */ - public Object convertSourceToTargetClass(Object source, Class targetClass) throws Exception; + Object convertSourceToTargetClass(Object source, Class targetClass) throws Exception; } diff --git a/spring-binding/src/main/java/org/springframework/binding/convert/converters/FormattedStringToNumber.java b/spring-binding/src/main/java/org/springframework/binding/convert/converters/FormattedStringToNumber.java index 50bc364e..04b574a8 100644 --- a/spring-binding/src/main/java/org/springframework/binding/convert/converters/FormattedStringToNumber.java +++ b/spring-binding/src/main/java/org/springframework/binding/convert/converters/FormattedStringToNumber.java @@ -85,7 +85,7 @@ public class FormattedStringToNumber extends StringToObject { } @SuppressWarnings("unchecked") - protected Object toObject(String string, Class targetClass) throws Exception { + protected Object toObject(String string, Class targetClass) { ParsePosition parsePosition = new ParsePosition(0); NumberFormat format = numberFormatFactory.getNumberFormat(); Number number = format.parse(string, parsePosition); @@ -102,7 +102,7 @@ public class FormattedStringToNumber extends StringToObject { return convertToNumberClass(number, (Class) targetClass); } - protected String toString(Object object) throws Exception { + protected String toString(Object object) { Number number = (Number) object; return numberFormatFactory.getNumberFormat().format(number); } diff --git a/spring-binding/src/main/java/org/springframework/binding/convert/converters/NumberToNumber.java b/spring-binding/src/main/java/org/springframework/binding/convert/converters/NumberToNumber.java index 7cd213b1..26697b8e 100644 --- a/spring-binding/src/main/java/org/springframework/binding/convert/converters/NumberToNumber.java +++ b/spring-binding/src/main/java/org/springframework/binding/convert/converters/NumberToNumber.java @@ -31,7 +31,7 @@ public class NumberToNumber implements Converter { } @SuppressWarnings("unchecked") - public Object convertSourceToTargetClass(Object source, Class targetClass) throws Exception { + public Object convertSourceToTargetClass(Object source, Class targetClass) { return NumberUtils.convertNumberToTargetClass((Number) source, (Class) targetClass); } } diff --git a/spring-binding/src/main/java/org/springframework/binding/convert/converters/ObjectToArray.java b/spring-binding/src/main/java/org/springframework/binding/convert/converters/ObjectToArray.java index 343780d9..001aa98f 100644 --- a/spring-binding/src/main/java/org/springframework/binding/convert/converters/ObjectToArray.java +++ b/spring-binding/src/main/java/org/springframework/binding/convert/converters/ObjectToArray.java @@ -57,7 +57,7 @@ public class ObjectToArray implements Converter { return Object[].class; } - public Object convertSourceToTargetClass(Object source, Class targetClass) throws Exception { + public Object convertSourceToTargetClass(Object source, Class targetClass) { if (source == null) { return null; } diff --git a/spring-binding/src/main/java/org/springframework/binding/convert/converters/ObjectToCollection.java b/spring-binding/src/main/java/org/springframework/binding/convert/converters/ObjectToCollection.java index fc1645f0..35f2c732 100644 --- a/spring-binding/src/main/java/org/springframework/binding/convert/converters/ObjectToCollection.java +++ b/spring-binding/src/main/java/org/springframework/binding/convert/converters/ObjectToCollection.java @@ -62,7 +62,7 @@ public class ObjectToCollection implements Converter { } @SuppressWarnings({ "rawtypes", "unchecked" }) - public Object convertSourceToTargetClass(Object source, Class targetClass) throws Exception { + public Object convertSourceToTargetClass(Object source, Class targetClass) { if (source == null) { return null; } diff --git a/spring-binding/src/main/java/org/springframework/binding/convert/converters/PropertyEditorConverter.java b/spring-binding/src/main/java/org/springframework/binding/convert/converters/PropertyEditorConverter.java index 5fdfc8b8..81656d5b 100644 --- a/spring-binding/src/main/java/org/springframework/binding/convert/converters/PropertyEditorConverter.java +++ b/spring-binding/src/main/java/org/springframework/binding/convert/converters/PropertyEditorConverter.java @@ -35,14 +35,14 @@ public class PropertyEditorConverter extends StringToObject { this.propertyEditor = propertyEditor; } - protected Object toObject(String string, Class targetClass) throws Exception { + protected Object toObject(String string, Class targetClass) { synchronized (propertyEditor) { propertyEditor.setAsText(string); return propertyEditor.getValue(); } } - protected String toString(Object object) throws Exception { + protected String toString(Object object) { synchronized (propertyEditor) { propertyEditor.setValue(object); return propertyEditor.getAsText(); diff --git a/spring-binding/src/main/java/org/springframework/binding/convert/converters/SpringConvertingConverterAdapter.java b/spring-binding/src/main/java/org/springframework/binding/convert/converters/SpringConvertingConverterAdapter.java index f8dbd64a..197cf021 100644 --- a/spring-binding/src/main/java/org/springframework/binding/convert/converters/SpringConvertingConverterAdapter.java +++ b/spring-binding/src/main/java/org/springframework/binding/convert/converters/SpringConvertingConverterAdapter.java @@ -50,7 +50,7 @@ public class SpringConvertingConverterAdapter implements Converter { this.conversionService = conversionService; } - public Object convertSourceToTargetClass(Object source, Class targetClass) throws Exception { + public Object convertSourceToTargetClass(Object source, Class targetClass) { return conversionService.convert(source, targetClass); } diff --git a/spring-binding/src/main/java/org/springframework/binding/convert/converters/StringToBigDecimal.java b/spring-binding/src/main/java/org/springframework/binding/convert/converters/StringToBigDecimal.java index f47ea22b..22f20856 100644 --- a/spring-binding/src/main/java/org/springframework/binding/convert/converters/StringToBigDecimal.java +++ b/spring-binding/src/main/java/org/springframework/binding/convert/converters/StringToBigDecimal.java @@ -32,7 +32,7 @@ public class StringToBigDecimal extends StringToObject { return new BigDecimal(string); } - public String toString(Object object) throws Exception { + public String toString(Object object) { BigDecimal number = (BigDecimal) object; return number.toString(); } diff --git a/spring-binding/src/main/java/org/springframework/binding/convert/converters/StringToBigInteger.java b/spring-binding/src/main/java/org/springframework/binding/convert/converters/StringToBigInteger.java index ce43f7f4..aaa1e03c 100644 --- a/spring-binding/src/main/java/org/springframework/binding/convert/converters/StringToBigInteger.java +++ b/spring-binding/src/main/java/org/springframework/binding/convert/converters/StringToBigInteger.java @@ -28,11 +28,11 @@ public class StringToBigInteger extends StringToObject { super(BigInteger.class); } - public Object toObject(String string, Class objectClass) throws Exception { + public Object toObject(String string, Class objectClass) { return new BigInteger(string); } - public String toString(Object object) throws Exception { + public String toString(Object object) { BigInteger number = (BigInteger) object; return number.toString(); } diff --git a/spring-binding/src/main/java/org/springframework/binding/convert/converters/StringToBoolean.java b/spring-binding/src/main/java/org/springframework/binding/convert/converters/StringToBoolean.java index 58a3442c..a5c72e17 100644 --- a/spring-binding/src/main/java/org/springframework/binding/convert/converters/StringToBoolean.java +++ b/spring-binding/src/main/java/org/springframework/binding/convert/converters/StringToBoolean.java @@ -48,7 +48,7 @@ public class StringToBoolean extends StringToObject { this.falseString = falseString; } - protected Object toObject(String string, Class targetClass) throws Exception { + protected Object toObject(String string, Class targetClass) { if (trueString != null && string.equals(trueString)) { return true; } else if (falseString != null && string.equals(falseString)) { @@ -62,7 +62,7 @@ public class StringToBoolean extends StringToObject { } } - protected String toString(Object object) throws Exception { + protected String toString(Object object) { Boolean value = (Boolean) object; if (Boolean.TRUE.equals(value)) { if (trueString != null) { diff --git a/spring-binding/src/main/java/org/springframework/binding/convert/converters/StringToByte.java b/spring-binding/src/main/java/org/springframework/binding/convert/converters/StringToByte.java index 43547999..00cb21b8 100644 --- a/spring-binding/src/main/java/org/springframework/binding/convert/converters/StringToByte.java +++ b/spring-binding/src/main/java/org/springframework/binding/convert/converters/StringToByte.java @@ -26,11 +26,11 @@ public class StringToByte extends StringToObject { super(Byte.class); } - public Object toObject(String string, Class objectClass) throws Exception { + public Object toObject(String string, Class objectClass) { return Byte.valueOf(string); } - public String toString(Object object) throws Exception { + public String toString(Object object) { Byte number = (Byte) object; return number.toString(); } diff --git a/spring-binding/src/main/java/org/springframework/binding/convert/converters/StringToCharacter.java b/spring-binding/src/main/java/org/springframework/binding/convert/converters/StringToCharacter.java index b088ead1..8eb3243c 100644 --- a/spring-binding/src/main/java/org/springframework/binding/convert/converters/StringToCharacter.java +++ b/spring-binding/src/main/java/org/springframework/binding/convert/converters/StringToCharacter.java @@ -21,11 +21,11 @@ public class StringToCharacter extends StringToObject { super(Character.class); } - protected Object toObject(String string, Class targetClass) throws Exception { + protected Object toObject(String string, Class targetClass) { return new Character(string.charAt(0)); } - protected String toString(Object object) throws Exception { + protected String toString(Object object) { Character character = (Character) object; return character.toString(); } diff --git a/spring-binding/src/main/java/org/springframework/binding/convert/converters/StringToClass.java b/spring-binding/src/main/java/org/springframework/binding/convert/converters/StringToClass.java index 7ddda0eb..2a517a26 100644 --- a/spring-binding/src/main/java/org/springframework/binding/convert/converters/StringToClass.java +++ b/spring-binding/src/main/java/org/springframework/binding/convert/converters/StringToClass.java @@ -35,7 +35,7 @@ public class StringToClass extends StringToObject { return ClassUtils.forName(string, classLoader); } - public String toString(Object object) throws Exception { + public String toString(Object object) { Class clazz = (Class) object; return clazz.getName(); } diff --git a/spring-binding/src/main/java/org/springframework/binding/convert/converters/StringToDate.java b/spring-binding/src/main/java/org/springframework/binding/convert/converters/StringToDate.java index 4962bca9..1e2c0aa9 100644 --- a/spring-binding/src/main/java/org/springframework/binding/convert/converters/StringToDate.java +++ b/spring-binding/src/main/java/org/springframework/binding/convert/converters/StringToDate.java @@ -81,7 +81,7 @@ public class StringToDate extends StringToObject { this.locale = locale; } - public Object toObject(String string, Class targetClass) throws Exception { + public Object toObject(String string, Class targetClass) { if (!StringUtils.hasText(string)) { return null; } @@ -93,7 +93,7 @@ public class StringToDate extends StringToObject { } } - public String toString(Object target) throws Exception { + public String toString(Object target) { Date date = (Date) target; if (date == null) { return ""; diff --git a/spring-binding/src/main/java/org/springframework/binding/convert/converters/StringToDouble.java b/spring-binding/src/main/java/org/springframework/binding/convert/converters/StringToDouble.java index a672ebf5..9eab23db 100644 --- a/spring-binding/src/main/java/org/springframework/binding/convert/converters/StringToDouble.java +++ b/spring-binding/src/main/java/org/springframework/binding/convert/converters/StringToDouble.java @@ -26,11 +26,11 @@ public class StringToDouble extends StringToObject { super(Double.class); } - public Object toObject(String string, Class objectClass) throws Exception { + public Object toObject(String string, Class objectClass) { return Double.valueOf(string); } - public String toString(Object object) throws Exception { + public String toString(Object object) { Double number = (Double) object; return number.toString(); } diff --git a/spring-binding/src/main/java/org/springframework/binding/convert/converters/StringToEnum.java b/spring-binding/src/main/java/org/springframework/binding/convert/converters/StringToEnum.java index fa762801..43a29886 100644 --- a/spring-binding/src/main/java/org/springframework/binding/convert/converters/StringToEnum.java +++ b/spring-binding/src/main/java/org/springframework/binding/convert/converters/StringToEnum.java @@ -27,11 +27,11 @@ public class StringToEnum extends StringToObject { } @SuppressWarnings({ "unchecked", "rawtypes" }) - protected Object toObject(String string, Class targetClass) throws Exception { + protected Object toObject(String string, Class targetClass) { return Enum.valueOf((Class) targetClass, string); } - protected String toString(Object object) throws Exception { + protected String toString(Object object) { return object.toString(); } diff --git a/spring-binding/src/main/java/org/springframework/binding/convert/converters/StringToFloat.java b/spring-binding/src/main/java/org/springframework/binding/convert/converters/StringToFloat.java index af4e2128..b6619969 100644 --- a/spring-binding/src/main/java/org/springframework/binding/convert/converters/StringToFloat.java +++ b/spring-binding/src/main/java/org/springframework/binding/convert/converters/StringToFloat.java @@ -26,11 +26,11 @@ public class StringToFloat extends StringToObject { super(Float.class); } - public Object toObject(String string, Class objectClass) throws Exception { + public Object toObject(String string, Class objectClass) { return Float.valueOf(string); } - public String toString(Object object) throws Exception { + public String toString(Object object) { Float number = (Float) object; return number.toString(); } diff --git a/spring-binding/src/main/java/org/springframework/binding/convert/converters/StringToInteger.java b/spring-binding/src/main/java/org/springframework/binding/convert/converters/StringToInteger.java index 8360b2cc..2612fe57 100644 --- a/spring-binding/src/main/java/org/springframework/binding/convert/converters/StringToInteger.java +++ b/spring-binding/src/main/java/org/springframework/binding/convert/converters/StringToInteger.java @@ -26,11 +26,11 @@ public class StringToInteger extends StringToObject { super(Integer.class); } - public Object toObject(String string, Class objectClass) throws Exception { + public Object toObject(String string, Class objectClass) { return Integer.valueOf(string); } - public String toString(Object object) throws Exception { + public String toString(Object object) { Integer number = (Integer) object; return number.toString(); } diff --git a/spring-binding/src/main/java/org/springframework/binding/convert/converters/StringToLocale.java b/spring-binding/src/main/java/org/springframework/binding/convert/converters/StringToLocale.java index 3f5cc05e..e5c35f76 100644 --- a/spring-binding/src/main/java/org/springframework/binding/convert/converters/StringToLocale.java +++ b/spring-binding/src/main/java/org/springframework/binding/convert/converters/StringToLocale.java @@ -30,11 +30,11 @@ public class StringToLocale extends StringToObject { super(Locale.class); } - public Object toObject(String string, Class objectClass) throws Exception { + public Object toObject(String string, Class objectClass) { return StringUtils.parseLocaleString(string); } - public String toString(Object object) throws Exception { + public String toString(Object object) { Locale locale = (Locale) object; return locale.toString(); } diff --git a/spring-binding/src/main/java/org/springframework/binding/convert/converters/StringToLong.java b/spring-binding/src/main/java/org/springframework/binding/convert/converters/StringToLong.java index 2b05701b..4123227e 100644 --- a/spring-binding/src/main/java/org/springframework/binding/convert/converters/StringToLong.java +++ b/spring-binding/src/main/java/org/springframework/binding/convert/converters/StringToLong.java @@ -26,11 +26,11 @@ public class StringToLong extends StringToObject { super(Long.class); } - public Object toObject(String string, Class objectClass) throws Exception { + public Object toObject(String string, Class objectClass) { return Long.valueOf(string); } - public String toString(Object object) throws Exception { + public String toString(Object object) { Long number = (Long) object; return number.toString(); } diff --git a/spring-binding/src/main/java/org/springframework/binding/convert/converters/TwoWayConverter.java b/spring-binding/src/main/java/org/springframework/binding/convert/converters/TwoWayConverter.java index df0f92a3..3f120421 100644 --- a/spring-binding/src/main/java/org/springframework/binding/convert/converters/TwoWayConverter.java +++ b/spring-binding/src/main/java/org/springframework/binding/convert/converters/TwoWayConverter.java @@ -30,6 +30,6 @@ public interface TwoWayConverter extends Converter { * @return the converted object, which must be an instance of the sourceClass * @throws Exception an exception occurred performing the conversion */ - public Object convertTargetToSourceClass(Object target, Class sourceClass) throws Exception; + Object convertTargetToSourceClass(Object target, Class sourceClass) throws Exception; } diff --git a/spring-binding/src/main/java/org/springframework/binding/convert/service/NoOpConverter.java b/spring-binding/src/main/java/org/springframework/binding/convert/service/NoOpConverter.java index 8429557a..90286560 100644 --- a/spring-binding/src/main/java/org/springframework/binding/convert/service/NoOpConverter.java +++ b/spring-binding/src/main/java/org/springframework/binding/convert/service/NoOpConverter.java @@ -44,7 +44,7 @@ class NoOpConverter implements Converter { return targetClass; } - public Object convertSourceToTargetClass(Object source, Class targetClass) throws Exception { + public Object convertSourceToTargetClass(Object source, Class targetClass) { return source; } @@ -52,8 +52,7 @@ class NoOpConverter implements Converter { return true; } - public Object convertTargetToSourceClass(Object target, Class sourceClass) throws Exception, - UnsupportedOperationException { + public Object convertTargetToSourceClass(Object target, Class sourceClass) { return target; } -} +} diff --git a/spring-binding/src/main/java/org/springframework/binding/expression/Expression.java b/spring-binding/src/main/java/org/springframework/binding/expression/Expression.java index 89065c59..3240bc0a 100644 --- a/spring-binding/src/main/java/org/springframework/binding/expression/Expression.java +++ b/spring-binding/src/main/java/org/springframework/binding/expression/Expression.java @@ -30,7 +30,7 @@ public interface Expression { * @return the evaluation result * @throws EvaluationException an exception occurred during expression evaluation */ - public Object getValue(Object context) throws EvaluationException; + Object getValue(Object context) throws EvaluationException; /** * Set this expression in the provided context to the value provided. @@ -38,7 +38,7 @@ public interface Expression { * @param value the new value to set * @throws EvaluationException an exception occurred during expression evaluation */ - public void setValue(Object context, Object value) throws EvaluationException; + void setValue(Object context, Object value) throws EvaluationException; /** * Returns the most general type that can be passed to the {@link #setValue(Object, Object)} method for the given @@ -48,12 +48,12 @@ public interface Expression { * information cannot be determined * @throws EvaluationException an exception occurred during expression evaluation */ - public Class getValueType(Object context) throws EvaluationException; + Class getValueType(Object context) throws EvaluationException; /** * Returns the original string used to create this expression, unmodified. * @return the original expression string */ - public String getExpressionString(); + String getExpressionString(); } diff --git a/spring-binding/src/main/java/org/springframework/binding/expression/ExpressionParser.java b/spring-binding/src/main/java/org/springframework/binding/expression/ExpressionParser.java index 03831d9c..574b552a 100644 --- a/spring-binding/src/main/java/org/springframework/binding/expression/ExpressionParser.java +++ b/spring-binding/src/main/java/org/springframework/binding/expression/ExpressionParser.java @@ -36,6 +36,6 @@ public interface ExpressionParser { * @return an evaluator for the parsed expression * @throws ParserException an exception occurred during parsing */ - public Expression parseExpression(String expressionString, ParserContext context) throws ParserException; + Expression parseExpression(String expressionString, ParserContext context) throws ParserException; } \ No newline at end of file diff --git a/spring-binding/src/main/java/org/springframework/binding/expression/ParserContext.java b/spring-binding/src/main/java/org/springframework/binding/expression/ParserContext.java index 7025cb43..665a6134 100644 --- a/spring-binding/src/main/java/org/springframework/binding/expression/ParserContext.java +++ b/spring-binding/src/main/java/org/springframework/binding/expression/ParserContext.java @@ -26,20 +26,20 @@ public interface ParserContext { * value to install custom variable resolves for that particular type of context. * @return the evaluation context type */ - public Class getEvaluationContextType(); + Class getEvaluationContextType(); /** * Returns the expected type of object returned from evaluating the parsed expression. An expression parser may use * this value to coerce an raw evaluation result before it is returned. * @return the expected evaluation result type */ - public Class getExpectedEvaluationResultType(); + Class getExpectedEvaluationResultType(); /** * Returns additional expression variables or aliases that can be referenced during expression evaluation. An * expression parser will register these variables for reference during evaluation. */ - public ExpressionVariable[] getExpressionVariables(); + ExpressionVariable[] getExpressionVariables(); /** * Whether or not the expression being parsed is a template. A template expression consists of literal text that can @@ -53,6 +53,6 @@ public interface ParserContext { * * @return true if the expression is a template, false otherwise */ - public boolean isTemplate(); + boolean isTemplate(); } diff --git a/spring-binding/src/main/java/org/springframework/binding/expression/el/BindingValueExpression.java b/spring-binding/src/main/java/org/springframework/binding/expression/el/BindingValueExpression.java index e7044cc0..afd7eaba 100644 --- a/spring-binding/src/main/java/org/springframework/binding/expression/el/BindingValueExpression.java +++ b/spring-binding/src/main/java/org/springframework/binding/expression/el/BindingValueExpression.java @@ -3,8 +3,6 @@ package org.springframework.binding.expression.el; import javax.el.ELContext; import javax.el.ELException; import javax.el.ExpressionFactory; -import javax.el.PropertyNotFoundException; -import javax.el.PropertyNotWritableException; import javax.el.ValueExpression; import org.springframework.binding.convert.ConversionException; @@ -45,22 +43,21 @@ class BindingValueExpression extends ValueExpression { return targetExpression.getExpectedType(); } - public Class getType(ELContext context) throws NullPointerException, PropertyNotFoundException, ELException { + public Class getType(ELContext context) throws NullPointerException, ELException { return targetExpression.getType(context); } - public Object getValue(ELContext context) throws NullPointerException, PropertyNotFoundException, ELException, + public Object getValue(ELContext context) throws NullPointerException, ELException, ValueCoercionException { Object value = targetExpression.getValue(context); return convertValueIfNecessary(value, expectedType, context); } - public boolean isReadOnly(ELContext context) throws NullPointerException, PropertyNotFoundException, ELException { + public boolean isReadOnly(ELContext context) throws NullPointerException, ELException { return targetExpression.isReadOnly(context); } - public void setValue(ELContext context, Object value) throws NullPointerException, PropertyNotFoundException, - PropertyNotWritableException, ELException, ValueCoercionException { + public void setValue(ELContext context, Object value) throws NullPointerException, ELException, ValueCoercionException { value = convertValueIfNecessary(value, targetExpression.getType(context), context); targetExpression.setValue(context, value); } diff --git a/spring-binding/src/main/java/org/springframework/binding/expression/el/ELContextFactory.java b/spring-binding/src/main/java/org/springframework/binding/expression/el/ELContextFactory.java index ab554364..7ed338b4 100644 --- a/spring-binding/src/main/java/org/springframework/binding/expression/el/ELContextFactory.java +++ b/spring-binding/src/main/java/org/springframework/binding/expression/el/ELContextFactory.java @@ -37,6 +37,6 @@ public interface ELContextFactory { * @param target The base object for the expression evaluation * @return ELContext The configured ELContext instance for evaluating expressions. */ - public ELContext getELContext(Object target); + ELContext getELContext(Object target); } \ No newline at end of file diff --git a/spring-binding/src/main/java/org/springframework/binding/expression/el/MapAdaptableELResolver.java b/spring-binding/src/main/java/org/springframework/binding/expression/el/MapAdaptableELResolver.java index e4a7541a..9ea75886 100644 --- a/spring-binding/src/main/java/org/springframework/binding/expression/el/MapAdaptableELResolver.java +++ b/spring-binding/src/main/java/org/springframework/binding/expression/el/MapAdaptableELResolver.java @@ -18,11 +18,9 @@ package org.springframework.binding.expression.el; import java.beans.FeatureDescriptor; import java.util.Iterator; import java.util.Map; - import javax.el.ELContext; import javax.el.ELException; import javax.el.ELResolver; -import javax.el.PropertyNotFoundException; import javax.el.PropertyNotWritableException; import org.springframework.binding.collection.MapAdaptable; @@ -45,7 +43,7 @@ public class MapAdaptableELResolver extends ELResolver { } public Class getType(ELContext context, Object base, Object property) throws NullPointerException, - PropertyNotFoundException, ELException { + ELException { if (context == null) { throw new NullPointerException("The ELContext is null."); } @@ -60,7 +58,7 @@ public class MapAdaptableELResolver extends ELResolver { } public Object getValue(ELContext context, Object base, Object property) throws NullPointerException, - PropertyNotFoundException, ELException { + ELException { if (context == null) { throw new NullPointerException("The ELContext is null."); } @@ -74,7 +72,7 @@ public class MapAdaptableELResolver extends ELResolver { } public boolean isReadOnly(ELContext context, Object base, Object property) throws NullPointerException, - PropertyNotFoundException, ELException { + ELException { if (context == null) { throw new NullPointerException("The ELContext is null."); } @@ -87,7 +85,7 @@ public class MapAdaptableELResolver extends ELResolver { } public void setValue(ELContext context, Object base, Object property, Object value) throws NullPointerException, - PropertyNotFoundException, PropertyNotWritableException, ELException { + ELException { if (context == null) { throw new NullPointerException("The ELContext is null."); } diff --git a/spring-binding/src/main/java/org/springframework/binding/format/NumberFormatFactory.java b/spring-binding/src/main/java/org/springframework/binding/format/NumberFormatFactory.java index 1cdea943..e0f4a75e 100644 --- a/spring-binding/src/main/java/org/springframework/binding/format/NumberFormatFactory.java +++ b/spring-binding/src/main/java/org/springframework/binding/format/NumberFormatFactory.java @@ -15,6 +15,6 @@ public interface NumberFormatFactory { * display. * @return the number format */ - public NumberFormat getNumberFormat(); + NumberFormat getNumberFormat(); } \ No newline at end of file diff --git a/spring-binding/src/main/java/org/springframework/binding/mapping/Mapper.java b/spring-binding/src/main/java/org/springframework/binding/mapping/Mapper.java index 8ba8f6ea..b82d4210 100644 --- a/spring-binding/src/main/java/org/springframework/binding/mapping/Mapper.java +++ b/spring-binding/src/main/java/org/springframework/binding/mapping/Mapper.java @@ -28,5 +28,5 @@ public interface Mapper { * @param target the target * @return results of the mapping transaction */ - public MappingResults map(Object source, Object target); + MappingResults map(Object source, Object target); } \ No newline at end of file diff --git a/spring-binding/src/main/java/org/springframework/binding/mapping/Mapping.java b/spring-binding/src/main/java/org/springframework/binding/mapping/Mapping.java index dd46bf18..6bbe729f 100644 --- a/spring-binding/src/main/java/org/springframework/binding/mapping/Mapping.java +++ b/spring-binding/src/main/java/org/springframework/binding/mapping/Mapping.java @@ -27,15 +27,15 @@ public interface Mapping { /** * The source of the mapping. */ - public Expression getSourceExpression(); + Expression getSourceExpression(); /** * The target of the mapping. */ - public Expression getTargetExpression(); + Expression getTargetExpression(); /** * Whether this is a required mapping. */ - public boolean isRequired(); + boolean isRequired(); } \ No newline at end of file diff --git a/spring-binding/src/main/java/org/springframework/binding/mapping/MappingResult.java b/spring-binding/src/main/java/org/springframework/binding/mapping/MappingResult.java index 377214aa..7777cfe2 100644 --- a/spring-binding/src/main/java/org/springframework/binding/mapping/MappingResult.java +++ b/spring-binding/src/main/java/org/springframework/binding/mapping/MappingResult.java @@ -28,33 +28,33 @@ public interface MappingResult extends Serializable { /** * The mapping that executed for which this result pertains to. */ - public Mapping getMapping(); + Mapping getMapping(); /** * The mapping result code; for example, "success" , "typeMismatch", "propertyNotFound", or "evaluationException". */ - public String getCode(); + String getCode(); /** * Indicates if this result is an error result. */ - public boolean isError(); + boolean isError(); /** * Get the cause of the error result * @return the underyling cause, or null if this is not an error or there was no root cause. */ - public Throwable getErrorCause(); + Throwable getErrorCause(); /** * The original value of the source object that was to be mapped. May be null if this result is an error on the * source object. */ - public Object getOriginalValue(); + Object getOriginalValue(); /** * The actual value that was mapped to the target object. Null if this result is an error. */ - public Object getMappedValue(); + Object getMappedValue(); } \ No newline at end of file diff --git a/spring-binding/src/main/java/org/springframework/binding/mapping/MappingResults.java b/spring-binding/src/main/java/org/springframework/binding/mapping/MappingResults.java index 5011bddb..342278fd 100644 --- a/spring-binding/src/main/java/org/springframework/binding/mapping/MappingResults.java +++ b/spring-binding/src/main/java/org/springframework/binding/mapping/MappingResults.java @@ -28,32 +28,32 @@ public interface MappingResults extends Serializable { /** * The source object that was mapped from. */ - public Object getSource(); + Object getSource(); /** * The target object that was mapped to. */ - public Object getTarget(); + Object getTarget(); /** * A list of all the mapping results between the source and target. */ - public List getAllResults(); + List getAllResults(); /** * Whether some results were errors. Returns true if mapping errors occurred. */ - public boolean hasErrorResults(); + boolean hasErrorResults(); /** * A list of all error results that occurred. */ - public List getErrorResults(); + List getErrorResults(); /** * Get all results that meet the given result criteria. * @param criteria the mapping result criteria */ - public List getResults(MappingResultsCriteria criteria); + List getResults(MappingResultsCriteria criteria); } diff --git a/spring-binding/src/main/java/org/springframework/binding/mapping/MappingResultsCriteria.java b/spring-binding/src/main/java/org/springframework/binding/mapping/MappingResultsCriteria.java index dc559e1d..2795958f 100644 --- a/spring-binding/src/main/java/org/springframework/binding/mapping/MappingResultsCriteria.java +++ b/spring-binding/src/main/java/org/springframework/binding/mapping/MappingResultsCriteria.java @@ -27,5 +27,5 @@ public interface MappingResultsCriteria { * @param result the result * @return true if so, false if not */ - public boolean test(MappingResult result); + boolean test(MappingResult result); } diff --git a/spring-binding/src/main/java/org/springframework/binding/message/MessageContext.java b/spring-binding/src/main/java/org/springframework/binding/message/MessageContext.java index 3730d52d..7e24c14b 100644 --- a/spring-binding/src/main/java/org/springframework/binding/message/MessageContext.java +++ b/spring-binding/src/main/java/org/springframework/binding/message/MessageContext.java @@ -24,36 +24,36 @@ public interface MessageContext { * Get all messages in this context. The messages returned should be suitable for display as-is. * @return the messages */ - public Message[] getAllMessages(); + Message[] getAllMessages(); /** * Get all messages in this context for the source provided. * @param source the source associated with messages, or null for global messages * @return the source's messages */ - public Message[] getMessagesBySource(Object source); + Message[] getMessagesBySource(Object source); /** * Get all messages that meet the given result criteria. * @param criteria the message criteria */ - public Message[] getMessagesByCriteria(MessageCriteria criteria); + Message[] getMessagesByCriteria(MessageCriteria criteria); /** * Returns true if there are error messages in this context. * @return error messages */ - public boolean hasErrorMessages(); + boolean hasErrorMessages(); /** * Add a new message to this context. * @param messageResolver the resolver that will resolve the message to be added */ - public void addMessage(MessageResolver messageResolver); + void addMessage(MessageResolver messageResolver); /** * Clear all messages added to this context. */ - public void clearMessages(); + void clearMessages(); } diff --git a/spring-binding/src/main/java/org/springframework/binding/message/MessageContextErrors.java b/spring-binding/src/main/java/org/springframework/binding/message/MessageContextErrors.java index ab30320c..562504fc 100644 --- a/spring-binding/src/main/java/org/springframework/binding/message/MessageContextErrors.java +++ b/spring-binding/src/main/java/org/springframework/binding/message/MessageContextErrors.java @@ -157,23 +157,19 @@ public class MessageContextErrors extends AbstractErrors { return expressionParser.parseExpression(field, new FluentParserContext().evaluate(boundObject.getClass())); } - private static MessageCriteria GLOBAL_ERROR = new MessageCriteria() { - public boolean test(Message message) { - if (message.getSeverity() == Severity.ERROR && message.getSource() == null) { - return true; - } else { - return false; - } + private static MessageCriteria GLOBAL_ERROR = message -> { + if (message.getSeverity() == Severity.ERROR && message.getSource() == null) { + return true; + } else { + return false; } }; - private static MessageCriteria FIELD_ERROR = new MessageCriteria() { - public boolean test(Message message) { - if (message.getSeverity() == Severity.ERROR && message.getSource() instanceof String) { - return true; - } else { - return false; - } + private static MessageCriteria FIELD_ERROR = message -> { + if (message.getSeverity() == Severity.ERROR && message.getSource() instanceof String) { + return true; + } else { + return false; } }; diff --git a/spring-binding/src/main/java/org/springframework/binding/message/MessageCriteria.java b/spring-binding/src/main/java/org/springframework/binding/message/MessageCriteria.java index d7cebf9d..2845409a 100644 --- a/spring-binding/src/main/java/org/springframework/binding/message/MessageCriteria.java +++ b/spring-binding/src/main/java/org/springframework/binding/message/MessageCriteria.java @@ -27,5 +27,5 @@ public interface MessageCriteria { * @param message the message * @return true if this criteria is met for the message, false if not */ - public boolean test(Message message); + boolean test(Message message); } diff --git a/spring-binding/src/main/java/org/springframework/binding/message/MessageResolver.java b/spring-binding/src/main/java/org/springframework/binding/message/MessageResolver.java index 265c551d..30217580 100644 --- a/spring-binding/src/main/java/org/springframework/binding/message/MessageResolver.java +++ b/spring-binding/src/main/java/org/springframework/binding/message/MessageResolver.java @@ -35,5 +35,5 @@ public interface MessageResolver { * @param locale the current locale of this request * @return the resolved message */ - public Message resolveMessage(MessageSource messageSource, Locale locale); + Message resolveMessage(MessageSource messageSource, Locale locale); } diff --git a/spring-binding/src/main/java/org/springframework/binding/message/StateManageableMessageContext.java b/spring-binding/src/main/java/org/springframework/binding/message/StateManageableMessageContext.java index fb0dccac..6927b217 100644 --- a/spring-binding/src/main/java/org/springframework/binding/message/StateManageableMessageContext.java +++ b/spring-binding/src/main/java/org/springframework/binding/message/StateManageableMessageContext.java @@ -32,14 +32,14 @@ public interface StateManageableMessageContext extends MessageContext { * Create a serializable memento, or token representing a snapshot of the internal state of this message context. * @return the messages memento */ - public Serializable createMessagesMemento(); + Serializable createMessagesMemento(); /** * Set the state of this context from the memento provided. After this call, the messages in this context will match * what is encapsulated inside the memento. Any previous state will be overridden. * @param messagesMemento the messages memento */ - public void restoreMessages(Serializable messagesMemento); + void restoreMessages(Serializable messagesMemento); /** * Configure the message source used to resolve messages added to this context. May be set at any time to change how @@ -47,5 +47,5 @@ public interface StateManageableMessageContext extends MessageContext { * @param messageSource the message source * @see MessageContext#addMessage(MessageResolver) */ - public void setMessageSource(MessageSource messageSource); + void setMessageSource(MessageSource messageSource); } diff --git a/spring-binding/src/main/java/org/springframework/binding/method/MethodKey.java b/spring-binding/src/main/java/org/springframework/binding/method/MethodKey.java index a5076b37..dcf119d3 100644 --- a/spring-binding/src/main/java/org/springframework/binding/method/MethodKey.java +++ b/spring-binding/src/main/java/org/springframework/binding/method/MethodKey.java @@ -232,7 +232,7 @@ public class MethodKey implements Serializable { * Map with primitive wrapper type as key and corresponding primitive type as value, for example: Integer.class -> * int.class. */ - private static final Map, Class> PRIMITIVE_WRAPPER_TYPE_MAP = new HashMap, Class>(8); + private static final Map, Class> PRIMITIVE_WRAPPER_TYPE_MAP = new HashMap<>(8); static { PRIMITIVE_WRAPPER_TYPE_MAP.put(Boolean.class, boolean.class); PRIMITIVE_WRAPPER_TYPE_MAP.put(Byte.class, byte.class); diff --git a/spring-binding/src/main/java/org/springframework/binding/validation/ValidationContext.java b/spring-binding/src/main/java/org/springframework/binding/validation/ValidationContext.java index 1f0254cc..fadf2e86 100644 --- a/spring-binding/src/main/java/org/springframework/binding/validation/ValidationContext.java +++ b/spring-binding/src/main/java/org/springframework/binding/validation/ValidationContext.java @@ -31,23 +31,23 @@ public interface ValidationContext { /** * A context for adding failure messages to display to the user directly. */ - public MessageContext getMessageContext(); + MessageContext getMessageContext(); /** * The current user. */ - public Principal getUserPrincipal(); + Principal getUserPrincipal(); /** * The current user event that triggered validation. */ - public String getUserEvent(); + String getUserEvent(); /** * Obtain the value entered by the current user in the UI field bound to the property provided. * @param property the name of a bound property * @return the value the user entered in the field bound to the property */ - public Object getUserValue(String property); + Object getUserValue(String property); } diff --git a/spring-binding/src/test/java/org/springframework/binding/convert/service/DefaultConversionServiceTests.java b/spring-binding/src/test/java/org/springframework/binding/convert/service/DefaultConversionServiceTests.java index 5253c4b8..e61710f8 100644 --- a/spring-binding/src/test/java/org/springframework/binding/convert/service/DefaultConversionServiceTests.java +++ b/spring-binding/src/test/java/org/springframework/binding/convert/service/DefaultConversionServiceTests.java @@ -220,16 +220,8 @@ public class DefaultConversionServiceTests extends TestCase { DefaultConversionService service = new DefaultConversionService(); service.addConverter("princy", new CustomTwoWayConverter()); ConversionExecutor executor = service.getConversionExecutor("princy", Principal[].class, List.class); - final Principal princy1 = new Principal() { - public String getName() { - return "princy1"; - } - }; - final Principal princy2 = new Principal() { - public String getName() { - return "princy2"; - } - }; + final Principal princy1 = () -> "princy1"; + final Principal princy2 = () -> "princy2"; List p = (List) executor.execute(new Principal[] { princy1, princy2 }); assertEquals("princy1", p.get(0)); assertEquals("princy2", p.get(1)); @@ -262,16 +254,8 @@ public class DefaultConversionServiceTests extends TestCase { DefaultConversionService service = new DefaultConversionService(); service.addConverter("princy", new CustomTwoWayConverter()); ConversionExecutor executor = service.getConversionExecutor("princy", List.class, String[].class); - final Principal princy1 = new Principal() { - public String getName() { - return "princy1"; - } - }; - final Principal princy2 = new Principal() { - public String getName() { - return "princy2"; - } - }; + final Principal princy1 = () -> "princy1"; + final Principal princy2 = () -> "princy2"; List princyList = new ArrayList<>(); princyList.add(princy1); princyList.add(princy2); @@ -303,11 +287,7 @@ public class DefaultConversionServiceTests extends TestCase { DefaultConversionService service = new DefaultConversionService(); service.addConverter("princy", new CustomTwoWayConverter()); ConversionExecutor executor = service.getConversionExecutor("princy", Principal.class, String[].class); - final Principal princy1 = new Principal() { - public String getName() { - return "princy1"; - } - }; + final Principal princy1 = () -> "princy1"; String[] p = (String[]) executor.execute(princy1); assertEquals("princy1", p[0]); } @@ -359,11 +339,7 @@ public class DefaultConversionServiceTests extends TestCase { DefaultConversionService service = new DefaultConversionService(); service.addConverter("princy", new CustomTwoWayConverter()); ConversionExecutor executor = service.getConversionExecutor("princy", Principal.class, List.class); - final Principal princy1 = new Principal() { - public String getName() { - return "princy1"; - } - }; + final Principal princy1 = () -> "princy1"; List list = (List) executor.execute(princy1); assertEquals("princy1", list.get(0)); } @@ -386,16 +362,8 @@ public class DefaultConversionServiceTests extends TestCase { DefaultConversionService service = new DefaultConversionService(); service.addConverter("princy", new CustomTwoWayConverter()); ConversionExecutor executor = service.getConversionExecutor("princy", List.class, List.class); - final Principal princy1 = new Principal() { - public String getName() { - return "princy1"; - } - }; - final Principal princy2 = new Principal() { - public String getName() { - return "princy2"; - } - }; + final Principal princy1 = () -> "princy1"; + final Principal princy2 = () -> "princy2"; List princyList = new ArrayList<>(); princyList.add(princy1); princyList.add(princy2); @@ -598,21 +566,17 @@ public class DefaultConversionServiceTests extends TestCase { super(List.class); } - protected Object toObject(String string, Class targetClass) throws Exception { + protected Object toObject(String string, Class targetClass) { List principals = new ArrayList<>(); StringTokenizer tokenizer = new StringTokenizer(string, ","); while (tokenizer.hasMoreTokens()) { final String name = tokenizer.nextToken(); - principals.add(new Principal() { - public String getName() { - return name; - } - }); + principals.add(() -> name); } return principals; } - protected String toString(Object object) throws Exception { + protected String toString(Object object) { throw new UnsupportedOperationException("No implemented"); } diff --git a/spring-binding/src/test/java/org/springframework/binding/convert/service/StaticConversionExecutorImplTests.java b/spring-binding/src/test/java/org/springframework/binding/convert/service/StaticConversionExecutorImplTests.java index 23e279a5..1702057f 100644 --- a/spring-binding/src/test/java/org/springframework/binding/convert/service/StaticConversionExecutorImplTests.java +++ b/spring-binding/src/test/java/org/springframework/binding/convert/service/StaticConversionExecutorImplTests.java @@ -26,7 +26,7 @@ public class StaticConversionExecutorImplTests extends TestCase { private StaticConversionExecutor conversionExecutor; - protected void setUp() throws Exception { + protected void setUp() { StringToDate stringToDate = new StringToDate(); conversionExecutor = new StaticConversionExecutor(String.class, Date.class, stringToDate); } diff --git a/spring-binding/src/test/java/org/springframework/binding/expression/el/ELExpressionParserTests.java b/spring-binding/src/test/java/org/springframework/binding/expression/el/ELExpressionParserTests.java index 9ab0d900..792ab52d 100644 --- a/spring-binding/src/test/java/org/springframework/binding/expression/el/ELExpressionParserTests.java +++ b/spring-binding/src/test/java/org/springframework/binding/expression/el/ELExpressionParserTests.java @@ -29,7 +29,7 @@ public class ELExpressionParserTests extends TestCase { public void testParseSimpleEvalExpressionNoParserContext() { String expressionString = "3 + 4"; Expression exp = parser.parseExpression(expressionString, null); - assertEquals(new Long(7), exp.getValue(null)); + assertEquals(7L, exp.getValue(null)); } public void testParseNullExpressionString() { @@ -61,7 +61,7 @@ public class ELExpressionParserTests extends TestCase { String expressionString = "3 + 4"; Expression exp = parser .parseExpression(expressionString, new FluentParserContext().expectResult(Integer.class)); - assertEquals(new Integer(7), exp.getValue(null)); + assertEquals(7, exp.getValue(null)); } public void testParseBeanEvalExpressionNoParserContext() { @@ -73,7 +73,7 @@ public class ELExpressionParserTests extends TestCase { public void testParseEvalExpressionWithContextTypeCoersion() { String expressionString = "maximum"; Expression exp = parser.parseExpression(expressionString, new FluentParserContext().expectResult(Long.class)); - assertEquals(new Long(2), exp.getValue(new TestBean())); + assertEquals(2L, exp.getValue(new TestBean())); } public void testParseEvalExpressionWithContextCustomELVariableResolver() { @@ -119,7 +119,7 @@ public class ELExpressionParserTests extends TestCase { Expression exp = parser.parseExpression("max", new FluentParserContext().variable(new ExpressionVariable("max", "maximum", new FluentParserContext().expectResult(Long.class)))); TestBean target = new TestBean(); - assertEquals(new Long(2), exp.getValue(target)); + assertEquals(2L, exp.getValue(target)); } public void testTemplateNestedVariables() { diff --git a/spring-binding/src/test/java/org/springframework/binding/expression/spel/ELExpressionParserCompatibilityTests.java b/spring-binding/src/test/java/org/springframework/binding/expression/spel/ELExpressionParserCompatibilityTests.java index 7bc2a4a3..2012a4f0 100644 --- a/spring-binding/src/test/java/org/springframework/binding/expression/spel/ELExpressionParserCompatibilityTests.java +++ b/spring-binding/src/test/java/org/springframework/binding/expression/spel/ELExpressionParserCompatibilityTests.java @@ -44,7 +44,7 @@ public class ELExpressionParserCompatibilityTests extends TestCase { private SpringELExpressionParser parser = new SpringELExpressionParser(new SpelExpressionParser()); - protected void setUp() throws Exception { + protected void setUp() { parser.addPropertyAccessor(new SpecialPropertyAccessor()); } @@ -82,7 +82,7 @@ public class ELExpressionParserCompatibilityTests extends TestCase { public void testParseSimpleEvalExpressionNoEvalContextWithTypeCoersion() { String expressionString = "3 + 4"; Expression exp = parser.parseExpression(expressionString, new FluentParserContext().expectResult(Long.class)); - assertEquals(new Long(7), exp.getValue(null)); + assertEquals(7L, exp.getValue(null)); } public void testParseBeanEvalExpressionNoParserContext() { @@ -95,7 +95,7 @@ public class ELExpressionParserCompatibilityTests extends TestCase { String expressionString = "maximum"; Expression exp = parser .parseExpression(expressionString, new FluentParserContext().expectResult(Integer.class)); - assertEquals(new Integer(2), exp.getValue(new TestBean())); + assertEquals(2, exp.getValue(new TestBean())); } public void testParseEvalExpressionWithContextCustomELVariableResolver() { @@ -198,11 +198,10 @@ public class ELExpressionParserCompatibilityTests extends TestCase { } private final class SpecialPropertyAccessor implements PropertyAccessor { - public void write(EvaluationContext context, Object target, String name, Object newValue) - throws AccessException { + public void write(EvaluationContext context, Object target, String name, Object newValue) { } - public TypedValue read(EvaluationContext context, Object target, String name) throws AccessException { + public TypedValue read(EvaluationContext context, Object target, String name) { return new TypedValue("Custom resolver resolved this special property!", TypeDescriptor.valueOf(String.class)); } @@ -211,11 +210,11 @@ public class ELExpressionParserCompatibilityTests extends TestCase { return null; } - public boolean canWrite(EvaluationContext context, Object target, String name) throws AccessException { + public boolean canWrite(EvaluationContext context, Object target, String name) { return false; } - public boolean canRead(EvaluationContext context, Object target, String name) throws AccessException { + public boolean canRead(EvaluationContext context, Object target, String name) { return "specialProperty".equals(name); } } diff --git a/spring-binding/src/test/java/org/springframework/binding/mapping/DefaultMapperTests.java b/spring-binding/src/test/java/org/springframework/binding/mapping/DefaultMapperTests.java index d3d54f6e..07f5d150 100644 --- a/spring-binding/src/test/java/org/springframework/binding/mapping/DefaultMapperTests.java +++ b/spring-binding/src/test/java/org/springframework/binding/mapping/DefaultMapperTests.java @@ -34,13 +34,11 @@ public class DefaultMapperTests extends TestCase { assertEquals(0, results.getErrorResults().size()); assertEquals("a", bean2.bar); assertEquals("a", bean2.baz); - assertEquals(1, results.getResults(new MappingResultsCriteria() { - public boolean test(MappingResult result) { - if (result.getMapping().getTargetExpression().getExpressionString().equals("baz")) { - return true; - } else { - return false; - } + assertEquals(1, results.getResults(result -> { + if (result.getMapping().getTargetExpression().getExpressionString().equals("baz")) { + return true; + } else { + return false; } }).size()); } diff --git a/spring-binding/src/test/java/org/springframework/binding/message/MessageBuilderTests.java b/spring-binding/src/test/java/org/springframework/binding/message/MessageBuilderTests.java index 88b132e3..79f59251 100644 --- a/spring-binding/src/test/java/org/springframework/binding/message/MessageBuilderTests.java +++ b/spring-binding/src/test/java/org/springframework/binding/message/MessageBuilderTests.java @@ -69,7 +69,7 @@ public class MessageBuilderTests extends TestCase { } public void testBuildCodes() { - MessageResolver resolver = builder.error().codes(new String[] { "foo" }).build(); + MessageResolver resolver = builder.error().codes("foo").build(); Message message = resolver.resolveMessage(messageSource, locale); assertEquals("bar", message.getText()); assertEquals(Severity.ERROR, message.getSeverity()); @@ -85,7 +85,7 @@ public class MessageBuilderTests extends TestCase { } public void testBuildArgs() { - MessageResolver resolver = builder.error().codes(new String[] { "bar" }).args(new Object[] { "baz" }).build(); + MessageResolver resolver = builder.error().codes("bar").args("baz").build(); Message message = resolver.resolveMessage(messageSource, locale); assertEquals("baz", message.getText()); assertEquals(Severity.ERROR, message.getSeverity()); @@ -113,7 +113,7 @@ public class MessageBuilderTests extends TestCase { } public void testBuildArgsWithNullCodes() { - MessageResolver resolver = builder.error().args(new Object[] { "baz" }).build(); + MessageResolver resolver = builder.error().args("baz").build(); try { resolver.resolveMessage(messageSource, locale); fail("Should have failed"); @@ -122,7 +122,7 @@ public class MessageBuilderTests extends TestCase { } public void testBuildArgsWithNullCodesDefaultText() { - MessageResolver resolver = builder.error().args(new Object[] { "baz" }).defaultText("foo").build(); + MessageResolver resolver = builder.error().args("baz").defaultText("foo").build(); Message message = resolver.resolveMessage(messageSource, locale); assertEquals("foo", message.getText()); } @@ -144,7 +144,7 @@ public class MessageBuilderTests extends TestCase { } public void testBuildResolvableArgs() { - MessageResolver resolver = builder.error().codes(new String[] { "bar" }).resolvableArgs(new Object[] { "baz" }) + MessageResolver resolver = builder.error().codes("bar").resolvableArgs("baz") .build(); Message message = resolver.resolveMessage(messageSource, locale); assertEquals("boop", message.getText()); diff --git a/spring-binding/src/test/java/org/springframework/binding/message/MessageContextErrorsMessageCodesTests.java b/spring-binding/src/test/java/org/springframework/binding/message/MessageContextErrorsMessageCodesTests.java index c58ca4d4..5c35a950 100644 --- a/spring-binding/src/test/java/org/springframework/binding/message/MessageContextErrorsMessageCodesTests.java +++ b/spring-binding/src/test/java/org/springframework/binding/message/MessageContextErrorsMessageCodesTests.java @@ -3,8 +3,8 @@ package org.springframework.binding.message; import java.util.Locale; import junit.framework.TestCase; - import org.easymock.EasyMock; + import org.springframework.context.support.StaticMessageSource; import org.springframework.validation.MessageCodesResolver; @@ -19,7 +19,7 @@ public class MessageContextErrorsMessageCodesTests extends TestCase { private MessageCodesResolver resolver; @Override - protected void setUp() throws Exception { + protected void setUp() { StaticMessageSource messageSource = new StaticMessageSource(); messageSource.addMessage(errorCode, Locale.getDefault(), "doesntmatter"); context = new DefaultMessageContext(messageSource); @@ -27,7 +27,7 @@ public class MessageContextErrorsMessageCodesTests extends TestCase { resolver = EasyMock.createMock(MessageCodesResolver.class); } - public void testRejectUsesObjectName() throws Exception { + public void testRejectUsesObjectName() { EasyMock.expect(resolver.resolveMessageCodes(errorCode, objectName)).andReturn(new String[] {}); EasyMock.replay(resolver); @@ -38,7 +38,7 @@ public class MessageContextErrorsMessageCodesTests extends TestCase { EasyMock.verify(resolver); } - public void testRejectValueUsesObjectName() throws Exception { + public void testRejectValueUsesObjectName() { EasyMock.expect(resolver.resolveMessageCodes(errorCode, objectName, "field", null)).andReturn(new String[] {}); EasyMock.replay(resolver); @@ -48,7 +48,7 @@ public class MessageContextErrorsMessageCodesTests extends TestCase { EasyMock.verify(resolver); } - public void testRejectValueEmptyField() throws Exception { + public void testRejectValueEmptyField() { EasyMock.expect(resolver.resolveMessageCodes(errorCode, objectName)).andReturn(new String[] {}); EasyMock.replay(resolver); diff --git a/spring-binding/src/test/java/org/springframework/binding/message/MessageContextErrorsTests.java b/spring-binding/src/test/java/org/springframework/binding/message/MessageContextErrorsTests.java index 197139b4..064fc0e6 100644 --- a/spring-binding/src/test/java/org/springframework/binding/message/MessageContextErrorsTests.java +++ b/spring-binding/src/test/java/org/springframework/binding/message/MessageContextErrorsTests.java @@ -17,7 +17,7 @@ public class MessageContextErrorsTests extends TestCase { private MessageContextErrors errors; @Override - protected void setUp() throws Exception { + protected void setUp() { StaticMessageSource messageSource = new StaticMessageSource(); messageSource.addMessage("foo", Locale.getDefault(), "bar"); messageSource.addMessage("bar", Locale.getDefault(), "{0}"); diff --git a/spring-binding/src/test/java/org/springframework/binding/method/MethodInvokerTests.java b/spring-binding/src/test/java/org/springframework/binding/method/MethodInvokerTests.java index e1d38faa..785501bf 100644 --- a/spring-binding/src/test/java/org/springframework/binding/method/MethodInvokerTests.java +++ b/spring-binding/src/test/java/org/springframework/binding/method/MethodInvokerTests.java @@ -29,7 +29,7 @@ public class MethodInvokerTests extends TestCase { private MethodInvoker methodInvoker; - protected void setUp() throws Exception { + protected void setUp() { this.methodInvoker = new MethodInvoker(); } diff --git a/spring-binding/src/test/java/org/springframework/binding/method/MethodKeyTests.java b/spring-binding/src/test/java/org/springframework/binding/method/MethodKeyTests.java index 1169400f..d9a75a5d 100644 --- a/spring-binding/src/test/java/org/springframework/binding/method/MethodKeyTests.java +++ b/spring-binding/src/test/java/org/springframework/binding/method/MethodKeyTests.java @@ -32,34 +32,34 @@ public class MethodKeyTests extends TestCase { private static final Method LIST_FILENAME_FILTER = safeGetMethod(File.class, "list", new Class[] { FilenameFilter.class }); - public void testGetMethodWithNoArgs() throws Exception { - MethodKey key = new MethodKey(File.class, "list", new Class[0]); + public void testGetMethodWithNoArgs() { + MethodKey key = new MethodKey(File.class, "list"); Method m = key.getMethod(); assertEquals(LIST_NO_ARGS, m); } - public void testGetMoreGenericMethod() throws Exception { - MethodKey key = new MethodKey(Object.class, "equals", new Class[] { Long.class }); + public void testGetMoreGenericMethod() { + MethodKey key = new MethodKey(Object.class, "equals", Long.class); assertEquals(safeGetMethod(Object.class, "equals", new Class[] { Object.class }), key.getMethod()); } - public void testGetMethodWithSingleArg() throws Exception { - MethodKey key = new MethodKey(File.class, "list", new Class[] { FilenameFilter.class }); + public void testGetMethodWithSingleArg() { + MethodKey key = new MethodKey(File.class, "list", FilenameFilter.class); Method m = key.getMethod(); assertEquals(LIST_FILENAME_FILTER, m); } - public void testGetMethodWithSingleNullArgAndValidMatch() throws Exception { + public void testGetMethodWithSingleNullArgAndValidMatch() { MethodKey key = new MethodKey(File.class, "list", new Class[] { null }); Method m = key.getMethod(); assertEquals(LIST_FILENAME_FILTER, m); } - public void testGetMethodWithSingleNullAndUnclearMatch() throws Exception { + public void testGetMethodWithSingleNullAndUnclearMatch() { new MethodKey(File.class, "listFiles", new Class[] { null }); } - private static final Method safeGetMethod(Class type, String name, Class[] argTypes) { + private static Method safeGetMethod(Class type, String name, Class[] argTypes) { try { return type.getMethod(name, argTypes); } catch (NoSuchMethodException e) { diff --git a/spring-faces/src/main/java/org/springframework/faces/model/SelectionAware.java b/spring-faces/src/main/java/org/springframework/faces/model/SelectionAware.java index e3f2dc79..aa384df1 100644 --- a/spring-faces/src/main/java/org/springframework/faces/model/SelectionAware.java +++ b/spring-faces/src/main/java/org/springframework/faces/model/SelectionAware.java @@ -30,34 +30,34 @@ public interface SelectionAware { * Checks whether the row pointed to by the model's current index is selected. * @return true if the current row data object is selected */ - public boolean isCurrentRowSelected(); + boolean isCurrentRowSelected(); /** * Sets whether the row pointed to by the model's current index is selected * @param rowSelected true to select the current row */ - public void setCurrentRowSelected(boolean rowSelected); + void setCurrentRowSelected(boolean rowSelected); /** * Sets the list of selected row data objects for the model. * @param selections the list of selected row data objects */ - public void setSelections(List selections); + void setSelections(List selections); /** * Returns the list of selected row data objects for the model. * @return the list of selected row data objects */ - public List getSelections(); + List getSelections(); /** * Selects all row data objects in the model. */ - public void selectAll(); + void selectAll(); /** * Selects the given row data object in the model. * @param rowData the row data object to select. */ - public void select(T rowData); + void select(T rowData); } diff --git a/spring-faces/src/main/java/org/springframework/faces/model/converter/DataModelConverter.java b/spring-faces/src/main/java/org/springframework/faces/model/converter/DataModelConverter.java index 13e363e7..08cc2669 100644 --- a/spring-faces/src/main/java/org/springframework/faces/model/converter/DataModelConverter.java +++ b/spring-faces/src/main/java/org/springframework/faces/model/converter/DataModelConverter.java @@ -44,7 +44,7 @@ public class DataModelConverter implements Converter { if (targetClass.equals(DataModel.class)) { targetClass = OneSelectionTrackingListDataModel.class; } - Constructor emptyConstructor = ClassUtils.getConstructorIfAvailable(targetClass, new Class[] {}); + Constructor emptyConstructor = ClassUtils.getConstructorIfAvailable(targetClass); DataModel model = (DataModel) emptyConstructor.newInstance(new Object[] {}); model.setWrappedData(source); return model; diff --git a/spring-faces/src/main/java/org/springframework/faces/model/converter/FacesConversionService.java b/spring-faces/src/main/java/org/springframework/faces/model/converter/FacesConversionService.java index ffee6f05..4eef3617 100644 --- a/spring-faces/src/main/java/org/springframework/faces/model/converter/FacesConversionService.java +++ b/spring-faces/src/main/java/org/springframework/faces/model/converter/FacesConversionService.java @@ -1,8 +1,11 @@ /* - * Copyright 2004-2008 the original author or authimport org.springframework.binding.convert.ConversionService; -import org.springframework.binding.convert.support.DefaultConversionService; -import org.springframework.faces.model.OneSelectionTrackingListDataModel; -e.org/licenses/LICENSE-2.0 + * Copyright 2004-2012 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/spring-faces/src/main/java/org/springframework/faces/security/FaceletsAuthorizeTagHandler.java b/spring-faces/src/main/java/org/springframework/faces/security/FaceletsAuthorizeTagHandler.java index e885eb65..9fda2863 100644 --- a/spring-faces/src/main/java/org/springframework/faces/security/FaceletsAuthorizeTagHandler.java +++ b/spring-faces/src/main/java/org/springframework/faces/security/FaceletsAuthorizeTagHandler.java @@ -81,7 +81,7 @@ public class FaceletsAuthorizeTagHandler extends TagHandler { } if (this.var != null) { - faceletContext.setAttribute(this.var.getValue(faceletContext), Boolean.valueOf(isAuthorized)); + faceletContext.setAttribute(this.var.getValue(faceletContext), isAuthorized); } } diff --git a/spring-faces/src/main/java/org/springframework/faces/webflow/JsfAjaxHandler.java b/spring-faces/src/main/java/org/springframework/faces/webflow/JsfAjaxHandler.java index 53aa1c3a..fa20e361 100644 --- a/spring-faces/src/main/java/org/springframework/faces/webflow/JsfAjaxHandler.java +++ b/spring-faces/src/main/java/org/springframework/faces/webflow/JsfAjaxHandler.java @@ -55,7 +55,7 @@ public class JsfAjaxHandler extends AbstractAjaxHandler { } else { String header = request.getHeader("Faces-Request"); String param = request.getParameter("javax.faces.partial.ajax"); - return ("partial/ajax".equals(header) || "true".equals(param)) ? true : false; + return "partial/ajax".equals(header) || "true".equals(param); } } diff --git a/spring-faces/src/main/java/org/springframework/faces/webflow/JsfManagedBeanPropertyAccessor.java b/spring-faces/src/main/java/org/springframework/faces/webflow/JsfManagedBeanPropertyAccessor.java index fd772094..aab6a7e3 100644 --- a/spring-faces/src/main/java/org/springframework/faces/webflow/JsfManagedBeanPropertyAccessor.java +++ b/spring-faces/src/main/java/org/springframework/faces/webflow/JsfManagedBeanPropertyAccessor.java @@ -56,19 +56,19 @@ public class JsfManagedBeanPropertyAccessor implements PropertyAccessor { return null; } - public boolean canRead(EvaluationContext context, Object target, String name) throws AccessException { + public boolean canRead(EvaluationContext context, Object target, String name) { return (getJsfManagedBean(name) != null); } - public TypedValue read(EvaluationContext context, Object target, String name) throws AccessException { + public TypedValue read(EvaluationContext context, Object target, String name) { return new TypedValue(getJsfManagedBean(name)); } - public boolean canWrite(EvaluationContext context, Object target, String name) throws AccessException { + public boolean canWrite(EvaluationContext context, Object target, String name) { return (getScopeForBean(name) != null); } - public void write(EvaluationContext context, Object target, String name, Object newValue) throws AccessException { + public void write(EvaluationContext context, Object target, String name, Object newValue) { MutableAttributeMap map = getScopeForBean(name); if (map != null) { map.put(name, newValue); diff --git a/spring-faces/src/main/java/org/springframework/faces/webflow/JsfResourceRequestHandler.java b/spring-faces/src/main/java/org/springframework/faces/webflow/JsfResourceRequestHandler.java index 6a0cdb5a..de5ef93c 100644 --- a/spring-faces/src/main/java/org/springframework/faces/webflow/JsfResourceRequestHandler.java +++ b/spring-faces/src/main/java/org/springframework/faces/webflow/JsfResourceRequestHandler.java @@ -16,10 +16,8 @@ package org.springframework.faces.webflow; import java.io.IOException; - import javax.faces.application.ResourceHandler; import javax.faces.context.FacesContext; -import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @@ -38,7 +36,7 @@ import org.springframework.web.context.support.WebApplicationObjectSupport; public class JsfResourceRequestHandler extends WebApplicationObjectSupport implements HttpRequestHandler { public void handleRequest(HttpServletRequest request, HttpServletResponse response) - throws ServletException, IOException { + throws IOException { FacesContextHelper helper = new FacesContextHelper(); try { diff --git a/spring-faces/src/main/java/org/springframework/faces/webflow/JsfUtils.java b/spring-faces/src/main/java/org/springframework/faces/webflow/JsfUtils.java index 72edba70..8d679353 100644 --- a/spring-faces/src/main/java/org/springframework/faces/webflow/JsfUtils.java +++ b/spring-faces/src/main/java/org/springframework/faces/webflow/JsfUtils.java @@ -99,7 +99,7 @@ public class JsfUtils { private static final Map, String> FACTORY_NAMES; static { - FACTORY_NAMES = new HashMap, String>(); + FACTORY_NAMES = new HashMap<>(); FACTORY_NAMES.put(ApplicationFactory.class, FactoryFinder.APPLICATION_FACTORY); FACTORY_NAMES.put(ExceptionHandlerFactory.class, FactoryFinder.EXCEPTION_HANDLER_FACTORY); FACTORY_NAMES.put(ExternalContextFactory.class, FactoryFinder.EXTERNAL_CONTEXT_FACTORY); diff --git a/spring-faces/src/test/java/org/springframework/faces/config/AbstractFacesFlowBuilderServicesConfigurationTests.java b/spring-faces/src/test/java/org/springframework/faces/config/AbstractFacesFlowBuilderServicesConfigurationTests.java index fe1c8b3e..c2ef59ef 100644 --- a/spring-faces/src/test/java/org/springframework/faces/config/AbstractFacesFlowBuilderServicesConfigurationTests.java +++ b/spring-faces/src/test/java/org/springframework/faces/config/AbstractFacesFlowBuilderServicesConfigurationTests.java @@ -16,8 +16,6 @@ import org.springframework.faces.webflow.FacesSpringELExpressionParser; import org.springframework.faces.webflow.JSFMockHelper; import org.springframework.faces.webflow.JsfViewFactoryCreator; import org.springframework.validation.Validator; -import org.springframework.faces.config.EmptySpringValidator; -import org.springframework.faces.config.MyBeanValidationHintResolver; import org.springframework.webflow.engine.builder.BinderConfiguration; import org.springframework.webflow.engine.builder.ViewFactoryCreator; import org.springframework.webflow.engine.builder.support.FlowBuilderServices; diff --git a/spring-faces/src/test/java/org/springframework/faces/model/SelectionTrackingActionListenerTests.java b/spring-faces/src/test/java/org/springframework/faces/model/SelectionTrackingActionListenerTests.java index 6b80b728..07ca8885 100644 --- a/spring-faces/src/test/java/org/springframework/faces/model/SelectionTrackingActionListenerTests.java +++ b/spring-faces/src/test/java/org/springframework/faces/model/SelectionTrackingActionListenerTests.java @@ -94,11 +94,11 @@ public class SelectionTrackingActionListenerTests extends TestCase { uiRepeat.getChildren().add(commandButton); this.viewToTest.getChildren().add(uiRepeat); - Method indexMutator = ReflectionUtils.findMethod(UIRepeat.class, "setIndex", new Class[] { FacesContext.class, - int.class }); + Method indexMutator = ReflectionUtils.findMethod(UIRepeat.class, "setIndex", FacesContext.class, + int.class); indexMutator.setAccessible(true); - ReflectionUtils.invokeMethod(indexMutator, uiRepeat, new Object[] { new MockFacesContext(), 1 }); + ReflectionUtils.invokeMethod(indexMutator, uiRepeat, new MockFacesContext(), 1); ActionEvent event = new ActionEvent(commandButton); @@ -108,7 +108,7 @@ public class SelectionTrackingActionListenerTests extends TestCase { assertSame(this.dataModel.getSelectedRow(), this.dataModel.getRowData()); assertTrue(this.delegateListener.processedEvent); - ReflectionUtils.invokeMethod(indexMutator, uiRepeat, new Object[] { new MockFacesContext(), 2 }); + ReflectionUtils.invokeMethod(indexMutator, uiRepeat, new MockFacesContext(), 2); assertFalse(this.dataModel.isCurrentRowSelected()); assertTrue(this.dataModel.getSelectedRow() != this.dataModel.getRowData()); } diff --git a/spring-faces/src/test/java/org/springframework/faces/security/FaceletsAuthorizeTagTests.java b/spring-faces/src/test/java/org/springframework/faces/security/FaceletsAuthorizeTagTests.java index c9cd3ad5..59140eab 100644 --- a/spring-faces/src/test/java/org/springframework/faces/security/FaceletsAuthorizeTagTests.java +++ b/spring-faces/src/test/java/org/springframework/faces/security/FaceletsAuthorizeTagTests.java @@ -23,43 +23,43 @@ import junit.framework.TestCase; */ public class FaceletsAuthorizeTagTests extends TestCase { - public void testIfAllGrantedWithOneRole() throws Exception { + public void testIfAllGrantedWithOneRole() { FaceletsAuthorizeTag tag = new FaceletsAuthorizeTag(); tag.setIfAllGranted("ROLE_A"); assertEquals("hasRole('ROLE_A')", tag.getAccess()); } - public void testIfAllGrantedWithMultipleRoles() throws Exception { + public void testIfAllGrantedWithMultipleRoles() { FaceletsAuthorizeTag tag = new FaceletsAuthorizeTag(); tag.setIfAllGranted("ROLE_A, ROLE_B, ROLE_C"); assertEquals("hasRole('ROLE_A') and hasRole('ROLE_B') and hasRole('ROLE_C')", tag.getAccess()); } - public void testIfAnyGrantedWithOneRole() throws Exception { + public void testIfAnyGrantedWithOneRole() { FaceletsAuthorizeTag tag = new FaceletsAuthorizeTag(); tag.setIfAnyGranted("ROLE_A"); assertEquals("hasAnyRole('ROLE_A')", tag.getAccess()); } - public void testIfAnyGrantedWithMultipleRole() throws Exception { + public void testIfAnyGrantedWithMultipleRole() { FaceletsAuthorizeTag tag = new FaceletsAuthorizeTag(); tag.setIfAnyGranted("ROLE_A, ROLE_B, ROLE_C"); assertEquals("hasAnyRole('ROLE_A','ROLE_B','ROLE_C')", tag.getAccess()); } - public void testIfNoneGrantedWithOneRole() throws Exception { + public void testIfNoneGrantedWithOneRole() { FaceletsAuthorizeTag tag = new FaceletsAuthorizeTag(); tag.setIfNotGranted("ROLE_A"); assertEquals("!hasAnyRole('ROLE_A')", tag.getAccess()); } - public void testIfNoneGrantedWithMultipleRole() throws Exception { + public void testIfNoneGrantedWithMultipleRole() { FaceletsAuthorizeTag tag = new FaceletsAuthorizeTag(); tag.setIfNotGranted("ROLE_A, ROLE_B, ROLE_C"); assertEquals("!hasAnyRole('ROLE_A','ROLE_B','ROLE_C')", tag.getAccess()); } - public void testIfAllAnyNotGranted() throws Exception { + public void testIfAllAnyNotGranted() { FaceletsAuthorizeTag tag = new FaceletsAuthorizeTag(); tag.setIfAllGranted("ROLE_A"); tag.setIfAnyGranted("ROLE_B"); diff --git a/spring-faces/src/test/java/org/springframework/faces/webflow/FlowActionListenerTests.java b/spring-faces/src/test/java/org/springframework/faces/webflow/FlowActionListenerTests.java index c4b72780..bf9fec28 100644 --- a/spring-faces/src/test/java/org/springframework/faces/webflow/FlowActionListenerTests.java +++ b/spring-faces/src/test/java/org/springframework/faces/webflow/FlowActionListenerTests.java @@ -8,15 +8,13 @@ import javax.faces.el.MethodNotFoundException; import javax.faces.event.ActionEvent; import junit.framework.TestCase; - import org.easymock.EasyMock; + import org.springframework.webflow.core.collection.LocalAttributeMap; import org.springframework.webflow.engine.Flow; import org.springframework.webflow.engine.ViewState; import org.springframework.webflow.execution.RequestContext; import org.springframework.webflow.execution.RequestContextHolder; -import org.springframework.webflow.execution.View; -import org.springframework.webflow.execution.ViewFactory; public class FlowActionListenerTests extends TestCase { @@ -85,7 +83,7 @@ public class FlowActionListenerTests extends TestCase { return String.class; } - public Object invoke(FacesContext context, Object... args) throws EvaluationException, MethodNotFoundException { + public Object invoke(FacesContext context, Object... args) throws EvaluationException { return this.result; } @@ -94,11 +92,8 @@ public class FlowActionListenerTests extends TestCase { private class MockViewState extends ViewState { public MockViewState() { - super(new Flow("mockFlow"), "mockView", new ViewFactory() { - - public View getView(RequestContext context) { - throw new UnsupportedOperationException(); - } + super(new Flow("mockFlow"), "mockView", context -> { + throw new UnsupportedOperationException(); }); } } diff --git a/spring-faces/src/test/java/org/springframework/faces/webflow/FlowELResolverTests.java b/spring-faces/src/test/java/org/springframework/faces/webflow/FlowELResolverTests.java index 31bfb86b..aeea9d3e 100644 --- a/spring-faces/src/test/java/org/springframework/faces/webflow/FlowELResolverTests.java +++ b/spring-faces/src/test/java/org/springframework/faces/webflow/FlowELResolverTests.java @@ -3,8 +3,8 @@ package org.springframework.faces.webflow; import javax.el.ELContext; import junit.framework.TestCase; - import org.apache.myfaces.test.el.MockELContext; + import org.springframework.context.ApplicationContext; import org.springframework.web.context.support.StaticWebApplicationContext; import org.springframework.webflow.core.collection.LocalAttributeMap; @@ -26,29 +26,29 @@ public class FlowELResolverTests extends TestCase { private final ELContext elContext = new MockELContext(); - protected void setUp() throws Exception { + protected void setUp() { RequestContextHolder.setRequestContext(this.requestContext); } - protected void tearDown() throws Exception { + protected void tearDown() { RequestContextHolder.setRequestContext(null); } - public void testRequestContextResolve() throws Exception { + public void testRequestContextResolve() { Object actual = this.resolver.getValue(this.elContext, null, "flowRequestContext"); assertTrue(this.elContext.isPropertyResolved()); assertNotNull(actual); assertSame(this.requestContext, actual); } - public void testImplicitFlowResolve() throws Exception { + public void testImplicitFlowResolve() { Object actual = this.resolver.getValue(this.elContext, null, "flowScope"); assertTrue(this.elContext.isPropertyResolved()); assertNotNull(actual); assertSame(this.requestContext.getFlowScope(), actual); } - public void testFlowResourceResolve() throws Exception { + public void testFlowResourceResolve() { ApplicationContext applicationContext = new StaticWebApplicationContext(); ((Flow) this.requestContext.getActiveFlow()).setApplicationContext(applicationContext); Object actual = this.resolver.getValue(this.elContext, null, "resourceBundle"); @@ -57,14 +57,14 @@ public class FlowELResolverTests extends TestCase { assertSame(applicationContext, actual); } - public void testScopeResolve() throws Exception { + public void testScopeResolve() { this.requestContext.getFlowScope().put("test", "test"); Object actual = this.resolver.getValue(this.elContext, null, "test"); assertTrue(this.elContext.isPropertyResolved()); assertEquals("test", actual); } - public void testMapAdaptableResolve() throws Exception { + public void testMapAdaptableResolve() { LocalAttributeMap base = new LocalAttributeMap<>(); base.put("test", "test"); Object actual = this.resolver.getValue(this.elContext, base, "test"); @@ -72,7 +72,7 @@ public class FlowELResolverTests extends TestCase { assertEquals("test", actual); } - public void testBeanResolveWithRequestContext() throws Exception { + public void testBeanResolveWithRequestContext() { StaticWebApplicationContext applicationContext = new StaticWebApplicationContext(); ((Flow) this.requestContext.getActiveFlow()).setApplicationContext(applicationContext); applicationContext.registerSingleton("test", Bean.class); @@ -82,7 +82,7 @@ public class FlowELResolverTests extends TestCase { assertTrue(actual instanceof Bean); } - public void testBeanResolveWithoutRequestContext() throws Exception { + public void testBeanResolveWithoutRequestContext() { RequestContextHolder.setRequestContext(null); Object actual = this.resolver.getValue(this.elContext, null, "test"); assertFalse(this.elContext.isPropertyResolved()); diff --git a/spring-faces/src/test/java/org/springframework/faces/webflow/FlowFacesContextTests.java b/spring-faces/src/test/java/org/springframework/faces/webflow/FlowFacesContextTests.java index ba9242cd..71e0f5ec 100644 --- a/spring-faces/src/test/java/org/springframework/faces/webflow/FlowFacesContextTests.java +++ b/spring-faces/src/test/java/org/springframework/faces/webflow/FlowFacesContextTests.java @@ -54,7 +54,7 @@ public class FlowFacesContextTests extends TestCase { public final void testAddMessage() { this.messageContext = new DefaultMessageContext(); EasyMock.expect(this.requestContext.getMessageContext()).andStubReturn(this.messageContext); - EasyMock.replay(new Object[] { this.requestContext }); + EasyMock.replay(this.requestContext); this.facesContext.addMessage("foo", new FacesMessage(FacesMessage.SEVERITY_INFO, "foo", "bar")); @@ -66,7 +66,7 @@ public class FlowFacesContextTests extends TestCase { public final void testGetGlobalMessagesOnly() { this.messageContext = new DefaultMessageContext(); EasyMock.expect(this.requestContext.getMessageContext()).andStubReturn(this.messageContext); - EasyMock.replay(new Object[] { this.requestContext }); + EasyMock.replay(this.requestContext); this.facesContext.addMessage("foo", new FacesMessage(FacesMessage.SEVERITY_INFO, "foo", "bar")); this.facesContext.addMessage(null, new FacesMessage(FacesMessage.SEVERITY_INFO, "FOO", "BAR")); @@ -84,7 +84,7 @@ public class FlowFacesContextTests extends TestCase { public final void testGetAllMessages() { this.messageContext = new DefaultMessageContext(); EasyMock.expect(this.requestContext.getMessageContext()).andStubReturn(this.messageContext); - EasyMock.replay(new Object[] { this.requestContext }); + EasyMock.replay(this.requestContext); this.facesContext.addMessage("foo", new FacesMessage(FacesMessage.SEVERITY_INFO, "foo", "bar")); this.facesContext.addMessage(null, new FacesMessage(FacesMessage.SEVERITY_INFO, "FOO", "BAR")); @@ -102,7 +102,7 @@ public class FlowFacesContextTests extends TestCase { public final void testAddMessages_MultipleNullIds() { this.messageContext = new DefaultMessageContext(); EasyMock.expect(this.requestContext.getMessageContext()).andStubReturn(this.messageContext); - EasyMock.replay(new Object[] { this.requestContext }); + EasyMock.replay(this.requestContext); this.facesContext.addMessage(null, new FacesMessage(FacesMessage.SEVERITY_INFO, "foo", "bar")); this.facesContext.addMessage(null, new FacesMessage(FacesMessage.SEVERITY_INFO, "zoo", "zar")); @@ -116,7 +116,7 @@ public class FlowFacesContextTests extends TestCase { public final void testGetMessages() { this.messageContext = this.prepopulatedMessageContext; EasyMock.expect(this.requestContext.getMessageContext()).andStubReturn(this.messageContext); - EasyMock.replay(new Object[] { this.requestContext }); + EasyMock.replay(this.requestContext); int iterationCount = 0; Iterator i = this.facesContext.getMessages(); @@ -130,7 +130,7 @@ public class FlowFacesContextTests extends TestCase { public final void testMutableGetMessages() { this.messageContext = this.prepopulatedMessageContext; EasyMock.expect(this.requestContext.getMessageContext()).andStubReturn(this.messageContext); - EasyMock.replay(new Object[] { this.requestContext }); + EasyMock.replay(this.requestContext); this.facesContext.addMessage("TESTID", new FacesMessage("summary1")); FacesMessage soruceMessage = this.facesContext.getMessages("TESTID").next(); @@ -148,7 +148,7 @@ public class FlowFacesContextTests extends TestCase { public final void testGetMessagesByClientId_ForComponent() { this.messageContext = this.prepopulatedMessageContext; EasyMock.expect(this.requestContext.getMessageContext()).andStubReturn(this.messageContext); - EasyMock.replay(new Object[] { this.requestContext }); + EasyMock.replay(this.requestContext); int iterationCount = 0; Iterator i = this.facesContext.getMessages("componentId"); @@ -165,7 +165,7 @@ public class FlowFacesContextTests extends TestCase { public final void testGetMessagesByClientId_ForUserMessage() { this.messageContext = this.prepopulatedMessageContext; EasyMock.expect(this.requestContext.getMessageContext()).andStubReturn(this.messageContext); - EasyMock.replay(new Object[] { this.requestContext }); + EasyMock.replay(this.requestContext); int iterationCount = 0; Iterator i = this.facesContext.getMessages("userMessage"); @@ -182,7 +182,7 @@ public class FlowFacesContextTests extends TestCase { public final void testgetMessagesByClientId_InvalidId() { this.messageContext = this.prepopulatedMessageContext; EasyMock.expect(this.requestContext.getMessageContext()).andStubReturn(this.messageContext); - EasyMock.replay(new Object[] { this.requestContext }); + EasyMock.replay(this.requestContext); Iterator i = this.facesContext.getMessages("unknown"); assertFalse(i.hasNext()); @@ -191,7 +191,7 @@ public class FlowFacesContextTests extends TestCase { public final void testGetClientIdsWithMessages() { this.messageContext = this.prepopulatedMessageContext; EasyMock.expect(this.requestContext.getMessageContext()).andStubReturn(this.messageContext); - EasyMock.replay(new Object[] { this.requestContext }); + EasyMock.replay(this.requestContext); List expectedOrderedIds = new ArrayList<>(); expectedOrderedIds.add(null); @@ -211,7 +211,7 @@ public class FlowFacesContextTests extends TestCase { public final void testMessagesAreSerializable() throws Exception { DefaultMessageContext messageContext = new DefaultMessageContext(); EasyMock.expect(this.requestContext.getMessageContext()).andStubReturn(messageContext); - EasyMock.replay(new Object[] { this.requestContext }); + EasyMock.replay(this.requestContext); this.facesContext.addMessage("TESTID", new FacesMessage("summary1")); FacesMessage sourceMessage = this.facesContext.getMessages("TESTID").next(); @@ -232,9 +232,9 @@ public class FlowFacesContextTests extends TestCase { ois.close(); messageContext.restoreMessages(mementoRead); - EasyMock.reset(new Object[] { this.requestContext }); + EasyMock.reset(this.requestContext); EasyMock.expect(this.requestContext.getMessageContext()).andStubReturn(messageContext); - EasyMock.replay(new Object[] { this.requestContext }); + EasyMock.replay(this.requestContext); FacesContext newFacesContext = new FlowFacesContext(this.requestContext, this.jsf.facesContext()); assertSame(FacesContext.getCurrentInstance(), newFacesContext); @@ -246,7 +246,7 @@ public class FlowFacesContextTests extends TestCase { public final void testGetMaximumSeverity() { this.messageContext = this.prepopulatedMessageContext; EasyMock.expect(this.requestContext.getMessageContext()).andStubReturn(this.messageContext); - EasyMock.replay(new Object[] { this.requestContext }); + EasyMock.replay(this.requestContext); assertEquals(FacesMessage.SEVERITY_FATAL, this.facesContext.getMaximumSeverity()); } @@ -260,7 +260,7 @@ public class FlowFacesContextTests extends TestCase { public final void testValidationFailed() { this.messageContext = new DefaultMessageContext(); EasyMock.expect(this.requestContext.getMessageContext()).andStubReturn(this.messageContext); - EasyMock.replay(new Object[] { this.requestContext }); + EasyMock.replay(this.requestContext); this.facesContext.addMessage("foo", new FacesMessage(FacesMessage.SEVERITY_ERROR, "foo", "bar")); diff --git a/spring-faces/src/test/java/org/springframework/faces/webflow/FlowPartialViewContextTests.java b/spring-faces/src/test/java/org/springframework/faces/webflow/FlowPartialViewContextTests.java index affa0f24..9ea61930 100644 --- a/spring-faces/src/test/java/org/springframework/faces/webflow/FlowPartialViewContextTests.java +++ b/spring-faces/src/test/java/org/springframework/faces/webflow/FlowPartialViewContextTests.java @@ -21,7 +21,7 @@ public class FlowPartialViewContextTests extends TestCase { RequestContextHolder.setRequestContext(null); } - public void testReturnFragmentIds() throws Exception { + public void testReturnFragmentIds() { String[] fragmentIds = new String[] { "foo", "bar" }; RequestContext requestContext = new MockRequestContext(); @@ -31,7 +31,7 @@ public class FlowPartialViewContextTests extends TestCase { assertEquals(Arrays.asList(fragmentIds), new FlowPartialViewContext(null).getRenderIds()); } - public void testNoFragmentIds() throws Exception { + public void testNoFragmentIds() { final List renderIds = Arrays.asList("foo", "bar"); FlowPartialViewContext context = new FlowPartialViewContext(new PartialViewContextWrapper() { public Collection getRenderIds() { @@ -51,7 +51,7 @@ public class FlowPartialViewContextTests extends TestCase { assertEquals(renderIds, context.getRenderIds()); } - public void testReturnFragmentIdsMutable() throws Exception { + public void testReturnFragmentIdsMutable() { String[] fragmentIds = new String[] { "foo", "bar" }; RequestContext requestContext = new MockRequestContext(); diff --git a/spring-faces/src/test/java/org/springframework/faces/webflow/FlowResponseStateManagerTests.java b/spring-faces/src/test/java/org/springframework/faces/webflow/FlowResponseStateManagerTests.java index cc9d55ed..b4cb8467 100644 --- a/spring-faces/src/test/java/org/springframework/faces/webflow/FlowResponseStateManagerTests.java +++ b/spring-faces/src/test/java/org/springframework/faces/webflow/FlowResponseStateManagerTests.java @@ -1,5 +1,7 @@ package org.springframework.faces.webflow; +import java.io.IOException; + import junit.framework.TestCase; import org.easymock.EasyMock; @@ -37,11 +39,11 @@ public class FlowResponseStateManagerTests extends TestCase { RequestContextHolder.setRequestContext(null); } - public void testname() throws Exception { + public void testname() { } - public void testWriteFlowSerializedView() throws Exception { + public void testWriteFlowSerializedView() throws IOException { EasyMock.expect(this.flowExecutionContext.getKey()).andReturn(new MockFlowExecutionKey("e1s1")); LocalAttributeMap viewMap = new LocalAttributeMap<>(); EasyMock.expect(this.requestContext.getViewScope()).andStubReturn(viewMap); @@ -58,7 +60,7 @@ public class FlowResponseStateManagerTests extends TestCase { EasyMock.verify(this.flowExecutionContext, this.requestContext); } - public void testGetState() throws Exception { + public void testGetState() { Object state = new Object(); LocalAttributeMap viewMap = new LocalAttributeMap<>(); diff --git a/spring-faces/src/test/java/org/springframework/faces/webflow/JsfManagedBeanPropertyAccessorTests.java b/spring-faces/src/test/java/org/springframework/faces/webflow/JsfManagedBeanPropertyAccessorTests.java index e8a00cb6..dd98a283 100644 --- a/spring-faces/src/test/java/org/springframework/faces/webflow/JsfManagedBeanPropertyAccessorTests.java +++ b/spring-faces/src/test/java/org/springframework/faces/webflow/JsfManagedBeanPropertyAccessorTests.java @@ -41,18 +41,18 @@ public class JsfManagedBeanPropertyAccessorTests extends TestCase { RequestContextHolder.setRequestContext(null); } - public void testCanRead() throws Exception { + public void testCanRead() { this.jsfMock.externalContext().getRequestMap().put("myJsfBean", new Object()); assertTrue(this.accessor.canRead(null, null, "myJsfBean")); } - public void testRead() throws Exception { + public void testRead() { Object jsfBean = new Object(); this.jsfMock.externalContext().getRequestMap().put("myJsfBean", jsfBean); assertEquals(jsfBean, this.accessor.read(null, null, "myJsfBean").getValue()); } - public void testCanWrite() throws Exception { + public void testCanWrite() { assertFalse(this.accessor.canWrite(null, null, "myJsfBean")); MutableAttributeMap map = this.requestContext.getExternalContext().getRequestMap(); @@ -71,7 +71,7 @@ public class JsfManagedBeanPropertyAccessorTests extends TestCase { map.clear(); } - public void testWrite() throws Exception { + public void testWrite() { Object jsfBean1 = new Object(); Object jsfBean2 = new Object(); diff --git a/spring-faces/src/test/java/org/springframework/faces/webflow/JsfUtilsTests.java b/spring-faces/src/test/java/org/springframework/faces/webflow/JsfUtilsTests.java index 23ee0622..b33a598f 100644 --- a/spring-faces/src/test/java/org/springframework/faces/webflow/JsfUtilsTests.java +++ b/spring-faces/src/test/java/org/springframework/faces/webflow/JsfUtilsTests.java @@ -26,7 +26,7 @@ public class JsfUtilsTests extends AbstractJsfTestCase { super(name); } - public void testBeforeListenersCalledInForwardOrder() throws Exception { + public void testBeforeListenersCalledInForwardOrder() { List list = new ArrayList<>(); MockLifecycle lifecycle = new MockLifecycle(); PhaseListener listener1 = new OrderVerifyingPhaseListener(null, list); @@ -41,7 +41,7 @@ public class JsfUtilsTests extends AbstractJsfTestCase { assertEquals(listener3, list.get(2)); } - public void testAfterListenersCalledInReverseOrder() throws Exception { + public void testAfterListenersCalledInReverseOrder() { List list = new ArrayList<>(); MockLifecycle lifecycle = new MockLifecycle(); PhaseListener listener1 = new OrderVerifyingPhaseListener(list, null); @@ -56,7 +56,7 @@ public class JsfUtilsTests extends AbstractJsfTestCase { assertEquals(listener1, list.get(2)); } - public void testGetFactory() throws Exception { + public void testGetFactory() { // Not testing all but at least test the mocked factories assertTrue(JsfUtils.findFactory(ApplicationFactory.class) instanceof MockApplicationFactory); assertTrue(JsfUtils.findFactory(FacesContextFactory.class) instanceof MockFacesContextFactory); @@ -64,7 +64,7 @@ public class JsfUtilsTests extends AbstractJsfTestCase { assertTrue(JsfUtils.findFactory(RenderKitFactory.class) instanceof MockRenderKitFactory); } - public void testGetUnknowFactory() throws Exception { + public void testGetUnknowFactory() { try { JsfUtils.findFactory(InputStream.class); fail("Did not throw"); diff --git a/spring-faces/src/test/java/org/springframework/faces/webflow/JsfViewFactoryTests.java b/spring-faces/src/test/java/org/springframework/faces/webflow/JsfViewFactoryTests.java index 5f1eaf1d..94c68501 100644 --- a/spring-faces/src/test/java/org/springframework/faces/webflow/JsfViewFactoryTests.java +++ b/spring-faces/src/test/java/org/springframework/faces/webflow/JsfViewFactoryTests.java @@ -380,7 +380,7 @@ public class JsfViewFactoryTests extends TestCase { public void processEvent(ComponentSystemEvent event) throws AbortProcessingException { if (event instanceof PostRestoreStateEvent) { - assertSame("Component did not match", this, ((PostRestoreStateEvent) event).getComponent()); + assertSame("Component did not match", this, event.getComponent()); this.postRestoreStateEventSeen = true; if (this.throwOnPostRestoreStateEvent) { this.abortProcessingException = new AbortProcessingException(); diff --git a/spring-faces/src/test/java/org/springframework/faces/webflow/JsfViewTests.java b/spring-faces/src/test/java/org/springframework/faces/webflow/JsfViewTests.java index 692d229e..331239db 100644 --- a/spring-faces/src/test/java/org/springframework/faces/webflow/JsfViewTests.java +++ b/spring-faces/src/test/java/org/springframework/faces/webflow/JsfViewTests.java @@ -99,7 +99,7 @@ public class JsfViewTests extends TestCase { } public final void testSaveState() { - EasyMock.replay(new Object[] { this.context, this.flowExecutionContext, this.flowMap, this.flashScope }); + EasyMock.replay(this.context, this.flowExecutionContext, this.flowMap, this.flashScope); this.view.saveState(); } @@ -108,17 +108,17 @@ public class JsfViewTests extends TestCase { EasyMock.expect(this.flashScope.put(EasyMock.matches(FlowFacesContext.RENDER_RESPONSE_KEY), EasyMock.anyObject())) .andStubReturn(null); - EasyMock.replay(new Object[] { this.context, this.flowExecutionContext, this.flowMap, this.flashScope }); + EasyMock.replay(this.context, this.flowExecutionContext, this.flowMap, this.flashScope); this.view.render(); } - public final void testRenderException() throws IOException { + public final void testRenderException() { EasyMock.expect(this.flashScope.put(EasyMock.matches(FlowFacesContext.RENDER_RESPONSE_KEY), EasyMock.anyObject())) .andStubReturn(null); - EasyMock.replay(new Object[] { this.context, this.flowExecutionContext, this.flowMap, this.flashScope }); + EasyMock.replay(this.context, this.flowExecutionContext, this.flowMap, this.flashScope); this.jsfMock.application().setViewHandler(new ExceptionalViewHandler()); @@ -143,7 +143,7 @@ public class JsfViewTests extends TestCase { UIViewRoot existingRoot = new UIViewRoot(); existingRoot.setViewId(VIEW_ID); - EasyMock.replay(new Object[] { this.context, this.flowExecutionContext, this.flowMap, this.flashScope }); + EasyMock.replay(this.context, this.flowExecutionContext, this.flowMap, this.flashScope); JsfView restoredView = new JsfView(existingRoot, lifecycle, this.context); @@ -168,7 +168,7 @@ public class JsfViewTests extends TestCase { UIViewRoot existingRoot = new UIViewRoot(); existingRoot.setViewId(VIEW_ID); - EasyMock.replay(new Object[] { this.context, this.flowExecutionContext, this.flowMap, this.flashScope }); + EasyMock.replay(this.context, this.flowExecutionContext, this.flowMap, this.flashScope); JsfView restoredView = new JsfView(existingRoot, lifecycle, this.context); @@ -185,7 +185,7 @@ public class JsfViewTests extends TestCase { requestParameterMap.put("execution", "e1s1"); EasyMock.expect(this.context.getRequestParameters()).andStubReturn(requestParameterMap); - EasyMock.replay(new Object[] { this.context, this.flowExecutionContext, this.flowMap, this.flashScope }); + EasyMock.replay(this.context, this.flowExecutionContext, this.flowMap, this.flashScope); JsfView createdView = new JsfView(new UIViewRoot(), this.jsfMock.lifecycle(), this.context); @@ -197,7 +197,7 @@ public class JsfViewTests extends TestCase { this.jsfMock.request().addParameter("execution", "e1s1"); this.jsfMock.request().addParameter("javax.faces.ViewState", "e1s1"); - EasyMock.replay(new Object[] { this.context, this.flowExecutionContext, this.flowMap, this.flashScope }); + EasyMock.replay(this.context, this.flowExecutionContext, this.flowMap, this.flashScope); JsfView createdView = new JsfView(new UIViewRoot(), this.jsfMock.lifecycle(), this.context); diff --git a/spring-faces/src/test/java/org/springframework/faces/webflow/MockJsfExternalContext.java b/spring-faces/src/test/java/org/springframework/faces/webflow/MockJsfExternalContext.java index 80f8f5fe..0a9efeae 100644 --- a/spring-faces/src/test/java/org/springframework/faces/webflow/MockJsfExternalContext.java +++ b/spring-faces/src/test/java/org/springframework/faces/webflow/MockJsfExternalContext.java @@ -147,7 +147,7 @@ public class MockJsfExternalContext extends ExternalContext { return null; } - public URL getResource(String arg0) throws MalformedURLException { + public URL getResource(String arg0) { return null; } diff --git a/spring-faces/src/test/java/org/springframework/faces/webflow/MockService.java b/spring-faces/src/test/java/org/springframework/faces/webflow/MockService.java index 5b3f9006..8a2183ce 100644 --- a/spring-faces/src/test/java/org/springframework/faces/webflow/MockService.java +++ b/spring-faces/src/test/java/org/springframework/faces/webflow/MockService.java @@ -2,5 +2,5 @@ package org.springframework.faces.webflow; public interface MockService { - public void doSomething(String arg); + void doSomething(String arg); } diff --git a/spring-faces/src/test/java/org/springframework/faces/webflow/MockViewHandler.java b/spring-faces/src/test/java/org/springframework/faces/webflow/MockViewHandler.java index a4cdeca6..b0986337 100644 --- a/spring-faces/src/test/java/org/springframework/faces/webflow/MockViewHandler.java +++ b/spring-faces/src/test/java/org/springframework/faces/webflow/MockViewHandler.java @@ -80,6 +80,6 @@ public class MockViewHandler extends ViewHandler { return this.restoreViewRoot; } - public void writeState(FacesContext context) throws IOException { + public void writeState(FacesContext context) { } } \ No newline at end of file diff --git a/spring-webflow/src/main/java/org/springframework/webflow/action/AbstractAction.java b/spring-webflow/src/main/java/org/springframework/webflow/action/AbstractAction.java index 830d4422..08cd14bf 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/action/AbstractAction.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/action/AbstractAction.java @@ -52,7 +52,7 @@ public abstract class AbstractAction implements Action, InitializingBean { return new EventFactorySupport(); } - public void afterPropertiesSet() throws Exception { + public void afterPropertiesSet() { try { initAction(); } catch (Exception ex) { @@ -66,7 +66,7 @@ public abstract class AbstractAction implements Action, InitializingBean { * Keep in mind that this hook will only be invoked when this action is deployed in a Spring application context * since it uses the Spring {@link InitializingBean} mechanism to trigger action initialisation. */ - protected void initAction() throws Exception { + protected void initAction() { } /** @@ -217,7 +217,7 @@ public abstract class AbstractAction implements Action, InitializingBean { * or null if the doExecute() method should be called to obtain the action result * @throws Exception an unrecoverable exception occured, either checked or unchecked */ - protected Event doPreExecute(RequestContext context) throws Exception { + protected Event doPreExecute(RequestContext context) { return null; } @@ -225,7 +225,7 @@ public abstract class AbstractAction implements Action, InitializingBean { * Template hook method subclasses should override to encapsulate their specific action execution logic. * @param context the action execution context, for accessing and setting data in "flow scope" or "request scope" * @return the action result event - * @throws Exception an unrecoverable exception occured, either checked or unchecked + * @an unrecoverable exception occured, either checked or unchecked */ protected abstract Event doExecute(RequestContext context) throws Exception; @@ -237,6 +237,6 @@ public abstract class AbstractAction implements Action, InitializingBean { * @param context the action execution context, for accessing and setting data in "flow scope" or "request scope" * @throws Exception an unrecoverable exception occured, either checked or unchecked */ - protected void doPostExecute(RequestContext context) throws Exception { + protected void doPostExecute(RequestContext context) { } } diff --git a/spring-webflow/src/main/java/org/springframework/webflow/action/ExternalRedirectAction.java b/spring-webflow/src/main/java/org/springframework/webflow/action/ExternalRedirectAction.java index b09c6a93..a7f1fd06 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/action/ExternalRedirectAction.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/action/ExternalRedirectAction.java @@ -38,7 +38,7 @@ public class ExternalRedirectAction extends AbstractAction { this.resourceUri = resourceUri; } - protected Event doExecute(RequestContext context) throws Exception { + protected Event doExecute(RequestContext context) { String resourceUri = (String) this.resourceUri.getValue(context); context.getExternalContext().requestExternalRedirect(resourceUri); return success(); diff --git a/spring-webflow/src/main/java/org/springframework/webflow/action/FlowDefinitionRedirectAction.java b/spring-webflow/src/main/java/org/springframework/webflow/action/FlowDefinitionRedirectAction.java index d1fcdae7..6a465377 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/action/FlowDefinitionRedirectAction.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/action/FlowDefinitionRedirectAction.java @@ -40,7 +40,7 @@ public class FlowDefinitionRedirectAction extends AbstractAction { this.expression = expression; } - protected Event doExecute(RequestContext context) throws Exception { + protected Event doExecute(RequestContext context) { String encodedRedirect = (String) expression.getValue(context); if (encodedRedirect == null) { throw new IllegalStateException( diff --git a/spring-webflow/src/main/java/org/springframework/webflow/action/FormAction.java b/spring-webflow/src/main/java/org/springframework/webflow/action/FormAction.java index ed4d6d72..8531d6d2 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/action/FormAction.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/action/FormAction.java @@ -426,8 +426,7 @@ public class FormAction extends MultiAction implements InitializingBean { + "] does not support form object class [" + getFormObjectClass() + "]"); } // signature: public void ${validateMethodName}(${formObjectClass}, Errors) - validateMethodInvoker = new DispatchMethodInvoker(getValidator(), new Class[] { getFormObjectClass(), - Errors.class }); + validateMethodInvoker = new DispatchMethodInvoker(getValidator(), getFormObjectClass(), Errors.class); } } @@ -713,7 +712,7 @@ public class FormAction extends MultiAction implements InitializingBean { logger.debug("Invoking piecemeal validator method '" + validatorMethod + "(" + getFormObjectClass() + ", Errors)'"); } - getValidateMethodInvoker().invoke(validatorMethod, new Object[] { formObject, errors }); + getValidateMethodInvoker().invoke(validatorMethod, formObject, errors); } // accessible helpers (subclasses could override if necessary) @@ -775,7 +774,7 @@ public class FormAction extends MultiAction implements InitializingBean { * @see #initBinder(RequestContext, DataBinder) * @see #setMessageCodesResolver(MessageCodesResolver) */ - protected DataBinder createBinder(RequestContext context, Object formObject) throws Exception { + protected DataBinder createBinder(RequestContext context, Object formObject) { DataBinder binder = new WebDataBinder(formObject, getFormObjectName()); if (getMessageCodesResolver() != null) { binder.setMessageCodesResolver(getMessageCodesResolver()); @@ -791,7 +790,7 @@ public class FormAction extends MultiAction implements InitializingBean { * @param binder the data binder to use * @throws Exception when an unrecoverable exception occurs */ - protected void doBind(RequestContext context, DataBinder binder) throws Exception { + protected void doBind(RequestContext context, DataBinder binder) { if (logger.isDebugEnabled()) { logger.debug("Binding allowed request parameters in " + StylerUtils.style(context.getExternalContext().getRequestParameterMap()) diff --git a/spring-webflow/src/main/java/org/springframework/webflow/action/MultiAction.java b/spring-webflow/src/main/java/org/springframework/webflow/action/MultiAction.java index 98bde7cb..c30051e9 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/action/MultiAction.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/action/MultiAction.java @@ -100,7 +100,7 @@ public class MultiAction extends AbstractAction { * @param target the target */ protected final void setTarget(Object target) { - methodInvoker = new DispatchMethodInvoker(target, new Class[] { RequestContext.class }); + methodInvoker = new DispatchMethodInvoker(target, RequestContext.class); } /** @@ -120,7 +120,7 @@ public class MultiAction extends AbstractAction { protected final Event doExecute(RequestContext context) throws Exception { String method = getMethodResolver().resolveMethod(context); - Object obj = methodInvoker.invoke(method, new Object[] { context }); + Object obj = methodInvoker.invoke(method, context); if (obj != null) { Assert.isInstanceOf(Event.class, obj, "The '" + method + "' action execution method on target object '" + methodInvoker.getTarget() + "' did not return an Event object but '" + obj + "' of type " @@ -144,6 +144,6 @@ public class MultiAction extends AbstractAction { * @param context the flow execution request context * @return the name of the method that should handle action execution */ - public String resolveMethod(RequestContext context); + String resolveMethod(RequestContext context); } } \ No newline at end of file diff --git a/spring-webflow/src/main/java/org/springframework/webflow/action/ResultEventFactory.java b/spring-webflow/src/main/java/org/springframework/webflow/action/ResultEventFactory.java index a0f7d2d6..f059fa85 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/action/ResultEventFactory.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/action/ResultEventFactory.java @@ -33,5 +33,5 @@ public interface ResultEventFactory { * @param context a flow execution request context * @return the event */ - public Event createResultEvent(Object source, Object resultObject, RequestContext context); + Event createResultEvent(Object source, Object resultObject, RequestContext context); } \ No newline at end of file diff --git a/spring-webflow/src/main/java/org/springframework/webflow/action/SetAction.java b/spring-webflow/src/main/java/org/springframework/webflow/action/SetAction.java index 295ce308..32cf7c11 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/action/SetAction.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/action/SetAction.java @@ -51,7 +51,7 @@ public class SetAction extends AbstractAction { this.valueExpression = valueExpression; } - protected Event doExecute(RequestContext context) throws Exception { + protected Event doExecute(RequestContext context) { Object value = valueExpression.getValue(context); nameExpression.setValue(context, value); return success(); diff --git a/spring-webflow/src/main/java/org/springframework/webflow/config/FlowDefinitionRegistryBuilder.java b/spring-webflow/src/main/java/org/springframework/webflow/config/FlowDefinitionRegistryBuilder.java index 50c7ae32..ca4c4b9b 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/config/FlowDefinitionRegistryBuilder.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/config/FlowDefinitionRegistryBuilder.java @@ -264,7 +264,7 @@ public class FlowDefinitionRegistryBuilder { } private void registerFlow(FlowDefinitionResource resource, DefaultFlowRegistry flowRegistry) { - FlowModelBuilder flowModelBuilder = null; + FlowModelBuilder flowModelBuilder; if (resource.getPath().getFilename().endsWith(".xml")) { flowModelBuilder = new XmlFlowModelBuilder(resource.getPath(), flowRegistry.getFlowModelRegistry()); } else { diff --git a/spring-webflow/src/main/java/org/springframework/webflow/config/FlowExecutionListenerLoaderBeanDefinitionParser.java b/spring-webflow/src/main/java/org/springframework/webflow/config/FlowExecutionListenerLoaderBeanDefinitionParser.java index 4fbe493e..b1f1576c 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/config/FlowExecutionListenerLoaderBeanDefinitionParser.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/config/FlowExecutionListenerLoaderBeanDefinitionParser.java @@ -33,7 +33,8 @@ import org.w3c.dom.Element; */ class FlowExecutionListenerLoaderBeanDefinitionParser extends AbstractSingleBeanDefinitionParser { - private static final String FLOW_EXECUTION_LISTENER_LOADER_FACTORY_BEAN_CLASS_NAME = "org.springframework.webflow.config.FlowExecutionListenerLoaderFactoryBean"; + private static final String FLOW_EXECUTION_LISTENER_LOADER_FACTORY_BEAN_CLASS_NAME = + "org.springframework.webflow.config.FlowExecutionListenerLoaderFactoryBean"; protected String getBeanClassName(Element element) { return FLOW_EXECUTION_LISTENER_LOADER_FACTORY_BEAN_CLASS_NAME; diff --git a/spring-webflow/src/main/java/org/springframework/webflow/config/FlowRegistryFactoryBean.java b/spring-webflow/src/main/java/org/springframework/webflow/config/FlowRegistryFactoryBean.java index 12bc4419..0f078d3c 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/config/FlowRegistryFactoryBean.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/config/FlowRegistryFactoryBean.java @@ -131,7 +131,7 @@ class FlowRegistryFactoryBean implements FactoryBean, Be this.classLoader = classLoader; } - public void afterPropertiesSet() throws Exception { + public void afterPropertiesSet() { flowResourceFactory = new FlowDefinitionResourceFactory(flowBuilderServices.getApplicationContext()); if (basePath != null) { flowResourceFactory.setBasePath(basePath); @@ -143,7 +143,7 @@ class FlowRegistryFactoryBean implements FactoryBean, Be registerFlowBuilders(); } - public FlowDefinitionRegistry getObject() throws Exception { + public FlowDefinitionRegistry getObject() { return flowRegistry; } @@ -157,7 +157,7 @@ class FlowRegistryFactoryBean implements FactoryBean, Be // implement DisposableBean - public void destroy() throws Exception { + public void destroy() { flowRegistry.destroy(); } @@ -173,7 +173,7 @@ class FlowRegistryFactoryBean implements FactoryBean, Be if (flowLocationPatterns != null) { for (String pattern : flowLocationPatterns) { FlowDefinitionResource[] resources; - AttributeMap attributes = getFlowAttributes(Collections. emptySet()); + AttributeMap attributes = getFlowAttributes(Collections.emptySet()); try { resources = flowResourceFactory.createResources(pattern, attributes); } catch (IOException e) { diff --git a/spring-webflow/src/main/java/org/springframework/webflow/context/ExternalContext.java b/spring-webflow/src/main/java/org/springframework/webflow/context/ExternalContext.java index d99b8474..41d3d707 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/context/ExternalContext.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/context/ExternalContext.java @@ -45,28 +45,28 @@ public interface ExternalContext { * Returns the logical path to the application hosting this external context. * @return the context path */ - public String getContextPath(); + String getContextPath(); /** * Provides access to the parameters associated with the user request that led to SWF being called. This map is * expected to be immutable and cannot be changed. * @return the immutable request parameter map */ - public ParameterMap getRequestParameterMap(); + ParameterMap getRequestParameterMap(); /** * Provides access to the external request attribute map, providing a storage for data local to the current user * request and accessible to both internal and external SWF artifacts. * @return the mutable request attribute map */ - public MutableAttributeMap getRequestMap(); + MutableAttributeMap getRequestMap(); /** * Provides access to the external session map, providing a storage for data local to the current user session and * accessible to both internal and external SWF artifacts. * @return the mutable session attribute map */ - public SharedAttributeMap getSessionMap(); + SharedAttributeMap getSessionMap(); /** * Provides access to the global external session map, providing a storage for data globally accross the user @@ -76,20 +76,20 @@ public interface ExternalContext { * scope and a "global" session scope. Otherwise this method returns the same map as calling {@link #getSessionMap()}. * @return the mutable global session attribute map */ - public SharedAttributeMap getGlobalSessionMap(); + SharedAttributeMap getGlobalSessionMap(); /** * Provides access to the external application map, providing a storage for data local to the current user * application and accessible to both internal and external SWF artifacts. * @return the mutable application attribute map */ - public SharedAttributeMap getApplicationMap(); + SharedAttributeMap getApplicationMap(); /** * Returns true if the current request is an asynchronous Ajax request. * @return true if the current request is an Ajax request */ - public boolean isAjaxRequest(); + boolean isAjaxRequest(); /** * Get a flow execution URL for the execution with the provided key. Typically used by response writers that write @@ -98,51 +98,51 @@ public interface ExternalContext { * @param flowExecutionKey the flow execution key * @return the flow execution URL */ - public String getFlowExecutionUrl(String flowId, String flowExecutionKey); + String getFlowExecutionUrl(String flowId, String flowExecutionKey); /** * Provides access to the user's principal security object. * @return the user principal */ - public Principal getCurrentUser(); + Principal getCurrentUser(); /** * Returns the client locale. * @return the locale */ - public Locale getLocale(); + Locale getLocale(); /** * Provides access to the context object for the current environment. * @return the environment specific context object */ - public Object getNativeContext(); + Object getNativeContext(); /** * Provides access to the request object for the current environment. * @return the environment specific request object. */ - public Object getNativeRequest(); + Object getNativeRequest(); /** * Provides access to the response object for the current environment. * @return the environment specific response object. */ - public Object getNativeResponse(); + Object getNativeResponse(); /** * Get a writer for writing out a response. * @return the writer * @throws IllegalStateException if the response has completed or is not allowed */ - public Writer getResponseWriter() throws IllegalStateException; + Writer getResponseWriter() throws IllegalStateException; /** * Is a render response allowed to be written for this request? Always return false after a response has been * completed. May return false before that to indicate a response is not allowed to be completed. * @return true if yes, false otherwise */ - public boolean isResponseAllowed(); + boolean isResponseAllowed(); /** * Request that a flow execution redirect be performed by the calling environment. Typically called from within a @@ -151,7 +151,7 @@ public interface ExternalContext { * @see #isResponseComplete() * @throws IllegalStateException if the response has completed */ - public void requestFlowExecutionRedirect() throws IllegalStateException; + void requestFlowExecutionRedirect() throws IllegalStateException; /** * Request that a flow definition redirect be performed by the calling environment. Typically called from within a @@ -162,7 +162,7 @@ public interface ExternalContext { * @param input input to pass the flow; this input is generally encoded the url to launch the flow * @throws IllegalStateException if the response has completed */ - public void requestFlowDefinitionRedirect(String flowId, MutableAttributeMap input) throws IllegalStateException; + void requestFlowDefinitionRedirect(String flowId, MutableAttributeMap input) throws IllegalStateException; /** * Request a redirect to an arbitrary resource location. May not be supported in some environments. Calling this @@ -171,7 +171,7 @@ public interface ExternalContext { * @param location the location of the resource to redirect to * @throws IllegalStateException if the response has completed */ - public void requestExternalRedirect(String location) throws IllegalStateException; + void requestExternalRedirect(String location) throws IllegalStateException; /** * Request that the current redirect requested be sent to the client in a manner that causes the client to issue the @@ -181,14 +181,14 @@ public interface ExternalContext { * @see #requestExternalRedirect(String) * @throws IllegalStateException if a redirect has not been requested */ - public void requestRedirectInPopup() throws IllegalStateException; + void requestRedirectInPopup() throws IllegalStateException; /** * Called by flow artifacts such as View states and end states to indicate they handled the response, typically by * writing out content to the response stream. Setting this flag allows this external context to know the response * was handled, and that it not need to take additional response handling action itself. */ - public void recordResponseComplete(); + void recordResponseComplete(); /** * Has the response been completed? Response complete status can be achieved by: @@ -203,7 +203,7 @@ public interface ExternalContext { * @see #requestExternalRedirect(String) * @return true if yes, false otherwise */ - public boolean isResponseComplete(); + boolean isResponseComplete(); /** * Returns true if the response has been completed with flow execution redirect request. @@ -211,6 +211,6 @@ public interface ExternalContext { * @see #isResponseComplete() * @see #requestFlowExecutionRedirect() */ - public boolean isResponseCompleteFlowExecutionRedirect(); + boolean isResponseCompleteFlowExecutionRedirect(); } diff --git a/spring-webflow/src/main/java/org/springframework/webflow/context/servlet/FlowUrlHandler.java b/spring-webflow/src/main/java/org/springframework/webflow/context/servlet/FlowUrlHandler.java index b8dc5722..e08864b2 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/context/servlet/FlowUrlHandler.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/context/servlet/FlowUrlHandler.java @@ -31,14 +31,14 @@ public interface FlowUrlHandler { * @param request the request * @return the flow execution key, or null if no flow execution key is present */ - public String getFlowExecutionKey(HttpServletRequest request); + String getFlowExecutionKey(HttpServletRequest request); /** * Extract the flow id from the request. * @param request the request * @return the flow id, or null if no flow id is present */ - public String getFlowId(HttpServletRequest request); + String getFlowId(HttpServletRequest request); /** * Create a URL that when addressed will launch a new execution of a flow. @@ -47,7 +47,7 @@ public interface FlowUrlHandler { * @param request the current request * @return the flow definition url */ - public String createFlowDefinitionUrl(String flowId, AttributeMap input, HttpServletRequest request); + String createFlowDefinitionUrl(String flowId, AttributeMap input, HttpServletRequest request); /** * Create a URL that when addressed will resume an existing execution of a flow. @@ -55,5 +55,5 @@ public interface FlowUrlHandler { * @param request the current request * @return the flow execution url */ - public String createFlowExecutionUrl(String flowId, String flowExecutionKey, HttpServletRequest request); + String createFlowExecutionUrl(String flowId, String flowExecutionKey, HttpServletRequest request); } diff --git a/spring-webflow/src/main/java/org/springframework/webflow/conversation/Conversation.java b/spring-webflow/src/main/java/org/springframework/webflow/conversation/Conversation.java index 37977302..0c552b03 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/conversation/Conversation.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/conversation/Conversation.java @@ -53,13 +53,13 @@ public interface Conversation { * conversation. This method can be safely called without owning the lock of this conversation. * @return the conversation id */ - public ConversationId getId(); + ConversationId getId(); /** * Lock this conversation. May block until the lock is available, if someone else has acquired the lock. * @throws ConversationLockException if the lock could not be acquired */ - public void lock() throws ConversationLockException; + void lock() throws ConversationLockException; /** * Returns the conversation attribute with the specified name. You need to acquire the lock on this conversation @@ -67,7 +67,7 @@ public interface Conversation { * @param name the attribute name * @return the attribute value */ - public Object getAttribute(Object name); + Object getAttribute(Object name); /** * Puts a conversation attribute into this context. You need to acquire the lock on this conversation before calling @@ -75,23 +75,23 @@ public interface Conversation { * @param name the attribute name * @param value the attribute value */ - public void putAttribute(Object name, Object value); + void putAttribute(Object name, Object value); /** * Removes a conversation attribute. You need to acquire the lock on this conversation before calling this method. * @param name the attribute name */ - public void removeAttribute(Object name); + void removeAttribute(Object name); /** * Ends this conversation. This method should only be called once to terminate the conversation and cleanup any * allocated resources. You need to aquire the lock on this conversation before calling this method. */ - public void end(); + void end(); /** * Unlock this conversation, making it available to others for manipulation. */ - public void unlock(); + void unlock(); } \ No newline at end of file diff --git a/spring-webflow/src/main/java/org/springframework/webflow/conversation/ConversationManager.java b/spring-webflow/src/main/java/org/springframework/webflow/conversation/ConversationManager.java index 7e60bc96..dbda2056 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/conversation/ConversationManager.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/conversation/ConversationManager.java @@ -29,7 +29,7 @@ public interface ConversationManager { * @return a service interface allowing access to the conversation context * @throws ConversationException an exception occured */ - public Conversation beginConversation(ConversationParameters conversationParameters) throws ConversationException; + Conversation beginConversation(ConversationParameters conversationParameters) throws ConversationException; /** * Get the conversation with the provided id. @@ -60,7 +60,7 @@ public interface ConversationManager { * @return the conversation * @throws NoSuchConversationException the id provided was invalid */ - public Conversation getConversation(ConversationId id) throws ConversationException; + Conversation getConversation(ConversationId id) throws ConversationException; /** * Parse the string-encoded conversationId into its object form. Essentially, the reverse of @@ -69,5 +69,5 @@ public interface ConversationManager { * @return the parsed conversation id * @throws ConversationException an exception occured parsing the id */ - public ConversationId parseConversationId(String encodedId) throws ConversationException; + ConversationId parseConversationId(String encodedId) throws ConversationException; } \ No newline at end of file diff --git a/spring-webflow/src/main/java/org/springframework/webflow/conversation/impl/ContainedConversation.java b/spring-webflow/src/main/java/org/springframework/webflow/conversation/impl/ContainedConversation.java index c8bd590e..955935eb 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/conversation/impl/ContainedConversation.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/conversation/impl/ContainedConversation.java @@ -125,10 +125,7 @@ public class ContainedConversation implements Conversation, Serializable { // id based equality public boolean equals(Object obj) { - if (!(obj instanceof ContainedConversation)) { - return false; - } - return this.id.equals(((ContainedConversation) obj).id); + return obj instanceof ContainedConversation && this.id.equals(((ContainedConversation) obj).id); } public int hashCode() { diff --git a/spring-webflow/src/main/java/org/springframework/webflow/conversation/impl/ConversationLock.java b/spring-webflow/src/main/java/org/springframework/webflow/conversation/impl/ConversationLock.java index d6a9511e..eef3ab59 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/conversation/impl/ConversationLock.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/conversation/impl/ConversationLock.java @@ -30,10 +30,10 @@ public interface ConversationLock extends Serializable { * Acquire the conversation lock. * @throws ConversationLockException if an exception is thrown attempting to acquire this lock */ - public void lock() throws ConversationLockException; + void lock() throws ConversationLockException; /** * Release the conversation lock. */ - public void unlock(); + void unlock(); } \ No newline at end of file diff --git a/spring-webflow/src/main/java/org/springframework/webflow/conversation/impl/SimpleConversationId.java b/spring-webflow/src/main/java/org/springframework/webflow/conversation/impl/SimpleConversationId.java index 01af148c..8b195da0 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/conversation/impl/SimpleConversationId.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/conversation/impl/SimpleConversationId.java @@ -41,10 +41,7 @@ public class SimpleConversationId extends ConversationId { } public boolean equals(Object o) { - if (!(o instanceof SimpleConversationId)) { - return false; - } - return id.equals(((SimpleConversationId) o).id); + return o instanceof SimpleConversationId && id.equals(((SimpleConversationId) o).id); } public int hashCode() { diff --git a/spring-webflow/src/main/java/org/springframework/webflow/core/Annotated.java b/spring-webflow/src/main/java/org/springframework/webflow/core/Annotated.java index c577c0ee..bd623a1a 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/core/Annotated.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/core/Annotated.java @@ -29,19 +29,19 @@ public interface Annotated { * Returns a short summary of this object, suitable for display as an icon caption or tool tip. * @return the caption */ - public String getCaption(); + String getCaption(); /** * Returns a longer, more detailed description of this object. * @return the description */ - public String getDescription(); + String getDescription(); /** * Returns a attribute map containing the attributes annotating this object. These attributes provide descriptive * characteristics or properties that may affect object behavior. * @return the attribute map */ - public MutableAttributeMap getAttributes(); + MutableAttributeMap getAttributes(); -} +} diff --git a/spring-webflow/src/main/java/org/springframework/webflow/core/collection/AttributeMap.java b/spring-webflow/src/main/java/org/springframework/webflow/core/collection/AttributeMap.java index 9472cb6c..43655ed5 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/core/collection/AttributeMap.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/core/collection/AttributeMap.java @@ -34,26 +34,26 @@ public interface AttributeMap extends MapAdaptable { * @param attributeName the attribute name * @return the attribute value */ - public V get(String attributeName); + V get(String attributeName); /** * Returns the size of this map. * @return the number of entries in the map */ - public int size(); + int size(); /** * Is this attribute map empty with a size of 0? * @return true if empty, false if not */ - public boolean isEmpty(); + boolean isEmpty(); /** * Does the attribute with the provided name exist in this map? * @param attributeName the attribute name * @return true if so, false otherwise */ - public boolean contains(String attributeName); + boolean contains(String attributeName); /** * Does the attribute with the provided name exist in this map and is its value of the specified required type? @@ -62,7 +62,7 @@ public interface AttributeMap extends MapAdaptable { * @return true if so, false otherwise * @throws IllegalArgumentException when the value is not of the required type */ - public boolean contains(String attributeName, Class requiredType) throws IllegalArgumentException; + boolean contains(String attributeName, Class requiredType) throws IllegalArgumentException; /** * Get an attribute value, returning the default value if no value is found. @@ -70,7 +70,7 @@ public interface AttributeMap extends MapAdaptable { * @param defaultValue the default value * @return the attribute value, falling back to the default if no such attribute exists */ - public V get(String attributeName, V defaultValue); + V get(String attributeName, V defaultValue); /** * Get an attribute value, asserting the value is of the required type. @@ -79,7 +79,7 @@ public interface AttributeMap extends MapAdaptable { * @return the attribute value, or null if not found * @throws IllegalArgumentException when the value is not of the required type */ - public T get(String attributeName, Class requiredType) throws IllegalArgumentException; + T get(String attributeName, Class requiredType) throws IllegalArgumentException; /** * Get an attribute value, asserting the value is of the required type and returning the default value if not found. @@ -89,7 +89,7 @@ public interface AttributeMap extends MapAdaptable { * @return the attribute value, or the default if not found * @throws IllegalArgumentException when the value (if found) is not of the required type */ - public T get(String attributeName, Class requiredType, T defaultValue) + T get(String attributeName, Class requiredType, T defaultValue) throws IllegalStateException; /** @@ -98,7 +98,7 @@ public interface AttributeMap extends MapAdaptable { * @return the attribute value * @throws IllegalArgumentException when the attribute is not found */ - public V getRequired(String attributeName) throws IllegalArgumentException; + V getRequired(String attributeName) throws IllegalArgumentException; /** * Get the value of a required attribute and make sure it is of the required type. @@ -107,7 +107,7 @@ public interface AttributeMap extends MapAdaptable { * @return the attribute value * @throws IllegalArgumentException when the attribute is not found or not of the required type */ - public T getRequired(String attributeName, Class requiredType) throws IllegalArgumentException; + T getRequired(String attributeName, Class requiredType) throws IllegalArgumentException; /** * Returns a string attribute value in the map, returning null if no value was found. @@ -115,7 +115,7 @@ public interface AttributeMap extends MapAdaptable { * @return the string attribute value * @throws IllegalArgumentException if the attribute is present but not a string */ - public String getString(String attributeName) throws IllegalArgumentException; + String getString(String attributeName) throws IllegalArgumentException; /** * Returns a string attribute value in the map, returning the default value if no value was found. @@ -124,7 +124,7 @@ public interface AttributeMap extends MapAdaptable { * @return the string attribute value * @throws IllegalArgumentException if the attribute is present but not a string */ - public String getString(String attributeName, String defaultValue) throws IllegalArgumentException; + String getString(String attributeName, String defaultValue) throws IllegalArgumentException; /** * Returns a string attribute value in the map, throwing an exception if the attribute is not present and of the @@ -133,7 +133,7 @@ public interface AttributeMap extends MapAdaptable { * @return the string attribute value * @throws IllegalArgumentException if the attribute is not present or present but not a string */ - public String getRequiredString(String attributeName) throws IllegalArgumentException; + String getRequiredString(String attributeName) throws IllegalArgumentException; /** * Returns a collection attribute value in the map. @@ -141,7 +141,7 @@ public interface AttributeMap extends MapAdaptable { * @return the collection attribute value * @throws IllegalArgumentException if the attribute is present but not a collection */ - public Collection getCollection(String attributeName) throws IllegalArgumentException; + Collection getCollection(String attributeName) throws IllegalArgumentException; /** * Returns a collection attribute value in the map and make sure it is of the required type. @@ -150,7 +150,7 @@ public interface AttributeMap extends MapAdaptable { * @return the collection attribute value * @throws IllegalArgumentException if the attribute is present but not a collection of the required type */ - public > T getCollection(String attributeName, Class requiredType) + > T getCollection(String attributeName, Class requiredType) throws IllegalArgumentException; /** @@ -160,7 +160,7 @@ public interface AttributeMap extends MapAdaptable { * @return the collection attribute value * @throws IllegalArgumentException if the attribute is not present or is present but not a collection */ - public Collection getRequiredCollection(String attributeName) throws IllegalArgumentException; + Collection getRequiredCollection(String attributeName) throws IllegalArgumentException; /** * Returns a collection attribute value in the map, throwing an exception if the attribute is not present or not a @@ -171,7 +171,7 @@ public interface AttributeMap extends MapAdaptable { * @throws IllegalArgumentException if the attribute is not present or is present but not a collection of the * required type */ - public > T getRequiredCollection(String attributeName, Class requiredType) + > T getRequiredCollection(String attributeName, Class requiredType) throws IllegalArgumentException; /** @@ -181,7 +181,7 @@ public interface AttributeMap extends MapAdaptable { * @return the array attribute value * @throws IllegalArgumentException if the attribute is present but not an array of the required type */ - public T[] getArray(String attributeName, Class requiredType) + T[] getArray(String attributeName, Class requiredType) throws IllegalArgumentException; /** @@ -193,7 +193,7 @@ public interface AttributeMap extends MapAdaptable { * @throws IllegalArgumentException if the attribute is not present or is present but not a array of the required * type */ - public T[] getRequiredArray(String attributeName, Class requiredType) + T[] getRequiredArray(String attributeName, Class requiredType) throws IllegalArgumentException; /** @@ -204,7 +204,7 @@ public interface AttributeMap extends MapAdaptable { * @return the number attribute value * @throws IllegalArgumentException if the attribute is present but not a number of the required type */ - public T getNumber(String attributeName, Class requiredType) throws IllegalArgumentException; + T getNumber(String attributeName, Class requiredType) throws IllegalArgumentException; /** * Returns a number attribute value in the map of the specified type, returning the default value if no value was @@ -214,7 +214,7 @@ public interface AttributeMap extends MapAdaptable { * @return the number attribute value * @throws IllegalArgumentException if the attribute is present but not a number of the required type */ - public T getNumber(String attributeName, Class requiredType, T defaultValue) + T getNumber(String attributeName, Class requiredType, T defaultValue) throws IllegalArgumentException; /** @@ -224,7 +224,7 @@ public interface AttributeMap extends MapAdaptable { * @return the number attribute value * @throws IllegalArgumentException if the attribute is not present or present but not a number of the required type */ - public T getRequiredNumber(String attributeName, Class requiredType) + T getRequiredNumber(String attributeName, Class requiredType) throws IllegalArgumentException; /** @@ -233,7 +233,7 @@ public interface AttributeMap extends MapAdaptable { * @return the integer attribute value * @throws IllegalArgumentException if the attribute is present but not an integer */ - public Integer getInteger(String attributeName) throws IllegalArgumentException; + Integer getInteger(String attributeName) throws IllegalArgumentException; /** * Returns an integer attribute value in the map, returning the default value if no value was found. @@ -242,7 +242,7 @@ public interface AttributeMap extends MapAdaptable { * @return the integer attribute value * @throws IllegalArgumentException if the attribute is present but not an integer */ - public Integer getInteger(String attributeName, Integer defaultValue) throws IllegalArgumentException; + Integer getInteger(String attributeName, Integer defaultValue) throws IllegalArgumentException; /** * Returns an integer attribute value in the map, throwing an exception if the attribute is not present and of the @@ -251,7 +251,7 @@ public interface AttributeMap extends MapAdaptable { * @return the integer attribute value * @throws IllegalArgumentException if the attribute is not present or present but not an integer */ - public Integer getRequiredInteger(String attributeName) throws IllegalArgumentException; + Integer getRequiredInteger(String attributeName) throws IllegalArgumentException; /** * Returns a long attribute value in the map, returning null if no value was found. @@ -259,7 +259,7 @@ public interface AttributeMap extends MapAdaptable { * @return the long attribute value * @throws IllegalArgumentException if the attribute is present but not a long */ - public Long getLong(String attributeName) throws IllegalArgumentException; + Long getLong(String attributeName) throws IllegalArgumentException; /** * Returns a long attribute value in the map, returning the default value if no value was found. @@ -268,7 +268,7 @@ public interface AttributeMap extends MapAdaptable { * @return the long attribute value * @throws IllegalArgumentException if the attribute is present but not a long */ - public Long getLong(String attributeName, Long defaultValue) throws IllegalArgumentException; + Long getLong(String attributeName, Long defaultValue) throws IllegalArgumentException; /** * Returns a long attribute value in the map, throwing an exception if the attribute is not present and of the @@ -277,7 +277,7 @@ public interface AttributeMap extends MapAdaptable { * @return the long attribute value * @throws IllegalArgumentException if the attribute is not present or present but not a long */ - public Long getRequiredLong(String attributeName) throws IllegalArgumentException; + Long getRequiredLong(String attributeName) throws IllegalArgumentException; /** * Returns a boolean attribute value in the map, returning null if no value was found. @@ -285,7 +285,7 @@ public interface AttributeMap extends MapAdaptable { * @return the long attribute value * @throws IllegalArgumentException if the attribute is present but not a boolean */ - public Boolean getBoolean(String attributeName) throws IllegalArgumentException; + Boolean getBoolean(String attributeName) throws IllegalArgumentException; /** * Returns a boolean attribute value in the map, returning the default value if no value was found. @@ -294,7 +294,7 @@ public interface AttributeMap extends MapAdaptable { * @return the boolean attribute value * @throws IllegalArgumentException if the attribute is present but not a boolean */ - public Boolean getBoolean(String attributeName, Boolean defaultValue) throws IllegalArgumentException; + Boolean getBoolean(String attributeName, Boolean defaultValue) throws IllegalArgumentException; /** * Returns a boolean attribute value in the map, throwing an exception if the attribute is not present and of the @@ -303,13 +303,13 @@ public interface AttributeMap extends MapAdaptable { * @return the boolean attribute value * @throws IllegalArgumentException if the attribute is not present or present but is not a boolean */ - public Boolean getRequiredBoolean(String attributeName) throws IllegalArgumentException; + Boolean getRequiredBoolean(String attributeName) throws IllegalArgumentException; /** * Returns a new attribute map containing the union of this map with the provided map. * @param attributes the map to combine with this map * @return a new, combined map */ - public AttributeMap union(AttributeMap attributes); + AttributeMap union(AttributeMap attributes); -} +} diff --git a/spring-webflow/src/main/java/org/springframework/webflow/core/collection/CollectionUtils.java b/spring-webflow/src/main/java/org/springframework/webflow/core/collection/CollectionUtils.java index 179d4595..0e458970 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/core/collection/CollectionUtils.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/core/collection/CollectionUtils.java @@ -83,9 +83,9 @@ public class CollectionUtils { return false; } else { boolean changed = false; - for (int i = 0; i < objects.length; i++) { - if (!target.contains(objects[i])) { - target.add(objects[i]); + for (T object : objects) { + if (!target.contains(object)) { + target.add(object); changed = true; } } diff --git a/spring-webflow/src/main/java/org/springframework/webflow/core/collection/MutableAttributeMap.java b/spring-webflow/src/main/java/org/springframework/webflow/core/collection/MutableAttributeMap.java index 06119d86..6cbf1146 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/core/collection/MutableAttributeMap.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/core/collection/MutableAttributeMap.java @@ -36,21 +36,21 @@ public interface MutableAttributeMap extends AttributeMap { * @param attributeValue the attribute value * @return the previous value of the attribute, or null of there was no previous value */ - public V put(String attributeName, V attributeValue); + V put(String attributeName, V attributeValue); /** * Put all the attributes into this map. * @param attributes the attributes to put into this map * @return this, to support call chaining */ - public MutableAttributeMap putAll(AttributeMap attributes); + MutableAttributeMap putAll(AttributeMap attributes); /** * Remove all attributes in the map provided from this map. * @param attributes the attributes to remove from this map * @return this, to support call chaining */ - public MutableAttributeMap removeAll(MutableAttributeMap attributes); + MutableAttributeMap removeAll(MutableAttributeMap attributes); /** * Remove an attribute from this map. @@ -58,27 +58,27 @@ public interface MutableAttributeMap extends AttributeMap { * @return previous value associated with specified attribute name, or null if there was no mapping for the * name */ - public Object remove(String attributeName); + Object remove(String attributeName); /** * Extract an attribute from this map, getting it and removing it in a single operation. * @param attributeName the attribute name * @return the value of the attribute, or null of there was no value */ - public Object extract(String attributeName); + Object extract(String attributeName); /** * Remove all attributes in this map. * @return this, to support call chaining */ - public MutableAttributeMap clear(); + MutableAttributeMap clear(); /** * Replace the contents of this attribute map with the contents of the provided collection. * @param attributes the attribute collection * @return this, to support call chaining */ - public MutableAttributeMap replaceWith(AttributeMap attributes) + MutableAttributeMap replaceWith(AttributeMap attributes) throws UnsupportedOperationException; -} +} diff --git a/spring-webflow/src/main/java/org/springframework/webflow/core/collection/ParameterMap.java b/spring-webflow/src/main/java/org/springframework/webflow/core/collection/ParameterMap.java index 4ae99df0..a4619b0f 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/core/collection/ParameterMap.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/core/collection/ParameterMap.java @@ -34,27 +34,27 @@ public interface ParameterMap extends MapAdaptable { * Is this parameter map empty, with a size of 0? * @return true if empty, false if not */ - public boolean isEmpty(); + boolean isEmpty(); /** * Returns the number of parameters in this map. * @return the parameter count */ - public int size(); + int size(); /** * Does the parameter with the provided name exist in this map? * @param parameterName the parameter name * @return true if so, false otherwise */ - public boolean contains(String parameterName); + boolean contains(String parameterName); /** * Get a parameter value, returning null if no value is found. * @param parameterName the parameter name * @return the parameter value */ - public String get(String parameterName); + String get(String parameterName); /** * Get a parameter value, returning the defaultValue if no value is found. @@ -62,7 +62,7 @@ public interface ParameterMap extends MapAdaptable { * @param defaultValue the default * @return the parameter value */ - public String get(String parameterName, String defaultValue); + String get(String parameterName, String defaultValue); /** * Get a multi-valued parameter value, returning null if no value is found. If the parameter is single @@ -70,7 +70,7 @@ public interface ParameterMap extends MapAdaptable { * @param parameterName the parameter name * @return the parameter value array */ - public String[] getArray(String parameterName); + String[] getArray(String parameterName); /** * Get a multi-valued parameter value, converting each value to the target type or returning null if no @@ -80,7 +80,7 @@ public interface ParameterMap extends MapAdaptable { * @return the converterd parameter value array * @throws ConversionExecutionException when the value could not be converted */ - public T[] getArray(String parameterName, Class targetElementType) throws ConversionExecutionException; + T[] getArray(String parameterName, Class targetElementType) throws ConversionExecutionException; /** * Get a parameter value, converting it from String to the target type. @@ -89,7 +89,7 @@ public interface ParameterMap extends MapAdaptable { * @return the converted parameter value, or null if not found * @throws ConversionExecutionException when the value could not be converted */ - public T get(String parameterName, Class targetType) throws ConversionExecutionException; + T get(String parameterName, Class targetType) throws ConversionExecutionException; /** * Get a parameter value, converting it from String to the target type or returning the defaultValue if @@ -100,7 +100,7 @@ public interface ParameterMap extends MapAdaptable { * @return the converted parameter value, or the default if not found * @throws ConversionExecutionException when a value could not be converted */ - public T get(String parameterName, Class targetType, T defaultValue) throws ConversionExecutionException; + T get(String parameterName, Class targetType, T defaultValue) throws ConversionExecutionException; /** * Get the value of a required parameter. @@ -108,7 +108,7 @@ public interface ParameterMap extends MapAdaptable { * @return the parameter value * @throws IllegalArgumentException when the parameter is not found */ - public String getRequired(String parameterName) throws IllegalArgumentException; + String getRequired(String parameterName) throws IllegalArgumentException; /** * Get a required multi-valued parameter value. @@ -116,7 +116,7 @@ public interface ParameterMap extends MapAdaptable { * @return the parameter value * @throws IllegalArgumentException when the parameter is not found */ - public String[] getRequiredArray(String parameterName) throws IllegalArgumentException; + String[] getRequiredArray(String parameterName) throws IllegalArgumentException; /** * Get a required multi-valued parameter value, converting each value to the target type. @@ -125,7 +125,7 @@ public interface ParameterMap extends MapAdaptable { * @throws IllegalArgumentException when the parameter is not found * @throws ConversionExecutionException when a value could not be converted */ - public T[] getRequiredArray(String parameterName, Class targetElementType) throws IllegalArgumentException, + T[] getRequiredArray(String parameterName, Class targetElementType) throws IllegalArgumentException, ConversionExecutionException; /** @@ -136,7 +136,7 @@ public interface ParameterMap extends MapAdaptable { * @throws IllegalArgumentException when the parameter is not found * @throws ConversionExecutionException when the value could not be converted */ - public T getRequired(String parameterName, Class targetType) throws IllegalArgumentException, + T getRequired(String parameterName, Class targetType) throws IllegalArgumentException, ConversionExecutionException; /** @@ -147,7 +147,7 @@ public interface ParameterMap extends MapAdaptable { * @return the number parameter value * @throws ConversionExecutionException when the value could not be converted */ - public T getNumber(String parameterName, Class targetType) + T getNumber(String parameterName, Class targetType) throws ConversionExecutionException; /** @@ -158,7 +158,7 @@ public interface ParameterMap extends MapAdaptable { * @return the number parameter value * @throws ConversionExecutionException when the value could not be converted */ - public T getNumber(String parameterName, Class targetType, T defaultValue) + T getNumber(String parameterName, Class targetType, T defaultValue) throws ConversionExecutionException; /** @@ -169,7 +169,7 @@ public interface ParameterMap extends MapAdaptable { * @throws IllegalArgumentException if the parameter is not present * @throws ConversionExecutionException when the value could not be converted */ - public T getRequiredNumber(String parameterName, Class targetType) + T getRequiredNumber(String parameterName, Class targetType) throws IllegalArgumentException, ConversionExecutionException; /** @@ -178,7 +178,7 @@ public interface ParameterMap extends MapAdaptable { * @return the integer parameter value * @throws ConversionExecutionException when the value could not be converted */ - public Integer getInteger(String parameterName) throws ConversionExecutionException; + Integer getInteger(String parameterName) throws ConversionExecutionException; /** * Returns an integer parameter value in the map, returning the defaultValue if no value was found. @@ -187,7 +187,7 @@ public interface ParameterMap extends MapAdaptable { * @return the integer parameter value * @throws ConversionExecutionException when the value could not be converted */ - public Integer getInteger(String parameterName, Integer defaultValue) throws ConversionExecutionException; + Integer getInteger(String parameterName, Integer defaultValue) throws ConversionExecutionException; /** * Returns an integer parameter value in the map, throwing an exception if the parameter is not present or could not @@ -197,7 +197,7 @@ public interface ParameterMap extends MapAdaptable { * @throws IllegalArgumentException if the parameter is not present * @throws ConversionExecutionException when the value could not be converted */ - public Integer getRequiredInteger(String parameterName) throws IllegalArgumentException, + Integer getRequiredInteger(String parameterName) throws IllegalArgumentException, ConversionExecutionException; /** @@ -206,7 +206,7 @@ public interface ParameterMap extends MapAdaptable { * @return the long parameter value * @throws ConversionExecutionException when the value could not be converted */ - public Long getLong(String parameterName) throws ConversionExecutionException; + Long getLong(String parameterName) throws ConversionExecutionException; /** * Returns a long parameter value in the map, returning the defaultValue if no value was found. @@ -215,7 +215,7 @@ public interface ParameterMap extends MapAdaptable { * @return the long parameter value * @throws ConversionExecutionException when the value could not be converted */ - public Long getLong(String parameterName, Long defaultValue) throws ConversionExecutionException; + Long getLong(String parameterName, Long defaultValue) throws ConversionExecutionException; /** * Returns a long parameter value in the map, throwing an exception if the parameter is not present or could not be @@ -225,7 +225,7 @@ public interface ParameterMap extends MapAdaptable { * @throws IllegalArgumentException if the parameter is not present * @throws ConversionExecutionException when the value could not be converted */ - public Long getRequiredLong(String parameterName) throws IllegalArgumentException, ConversionExecutionException; + Long getRequiredLong(String parameterName) throws IllegalArgumentException, ConversionExecutionException; /** * Returns a boolean parameter value in the map, returning null if no value was found. @@ -233,7 +233,7 @@ public interface ParameterMap extends MapAdaptable { * @return the long parameter value * @throws ConversionExecutionException when the value could not be converted */ - public Boolean getBoolean(String parameterName) throws ConversionExecutionException; + Boolean getBoolean(String parameterName) throws ConversionExecutionException; /** * Returns a boolean parameter value in the map, returning the defaultValue if no value was found. @@ -242,7 +242,7 @@ public interface ParameterMap extends MapAdaptable { * @return the boolean parameter value * @throws ConversionExecutionException when the value could not be converted */ - public Boolean getBoolean(String parameterName, Boolean defaultValue) throws ConversionExecutionException; + Boolean getBoolean(String parameterName, Boolean defaultValue) throws ConversionExecutionException; /** * Returns a boolean parameter value in the map, throwing an exception if the parameter is not present or could not @@ -252,7 +252,7 @@ public interface ParameterMap extends MapAdaptable { * @throws IllegalArgumentException if the parameter is not present * @throws ConversionExecutionException when the value could not be converted */ - public Boolean getRequiredBoolean(String parameterName) throws IllegalArgumentException, + Boolean getRequiredBoolean(String parameterName) throws IllegalArgumentException, ConversionExecutionException; /** @@ -260,7 +260,7 @@ public interface ParameterMap extends MapAdaptable { * @param parameterName the parameter name * @return the multipart file */ - public MultipartFile getMultipartFile(String parameterName); + MultipartFile getMultipartFile(String parameterName); /** * Get the value of a required multipart file parameter. @@ -268,12 +268,12 @@ public interface ParameterMap extends MapAdaptable { * @return the parameter value * @throws IllegalArgumentException when the parameter is not found */ - public MultipartFile getRequiredMultipartFile(String parameterName); + MultipartFile getRequiredMultipartFile(String parameterName); /** * Adapts this parameter map to an {@link AttributeMap}. * @return the underlying map as a unmodifiable attribute map */ - public AttributeMap asAttributeMap(); + AttributeMap asAttributeMap(); -} +} diff --git a/spring-webflow/src/main/java/org/springframework/webflow/core/collection/SharedAttributeMap.java b/spring-webflow/src/main/java/org/springframework/webflow/core/collection/SharedAttributeMap.java index 11e223b3..b020cfd2 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/core/collection/SharedAttributeMap.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/core/collection/SharedAttributeMap.java @@ -25,5 +25,5 @@ public interface SharedAttributeMap extends MutableAttributeMap { /** * Returns the shared map's mutex, which may be synchronized on to block access to the map by other threads. */ - public Object getMutex(); -} + Object getMutex(); +} diff --git a/spring-webflow/src/main/java/org/springframework/webflow/definition/FlowDefinition.java b/spring-webflow/src/main/java/org/springframework/webflow/definition/FlowDefinition.java index 6b8751ea..14e81e95 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/definition/FlowDefinition.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/definition/FlowDefinition.java @@ -47,13 +47,13 @@ public interface FlowDefinition extends Annotated { * Returns the unique id of this flow. * @return the flow id */ - public String getId(); + String getId(); /** * Return this flow's starting point. * @return the start state */ - public StateDefinition getStartState(); + StateDefinition getStartState(); /** * Returns the state definition with the specified id. @@ -61,35 +61,35 @@ public interface FlowDefinition extends Annotated { * @return the state definition * @throws IllegalArgumentException if a state with this id does not exist */ - public StateDefinition getState(String id) throws IllegalArgumentException; + StateDefinition getState(String id) throws IllegalArgumentException; /** * Returns the outcomes that are possible for this flow to reach. * @return the possible outcomes */ - public String[] getPossibleOutcomes(); + String[] getPossibleOutcomes(); /** * Returns the class loader used by this flow definition to load classes. * @return the class loader */ - public ClassLoader getClassLoader(); + ClassLoader getClassLoader(); /** * Returns a reference to application context hosting application objects and services used by this flow definition. * @return the application context */ - public ApplicationContext getApplicationContext(); + ApplicationContext getApplicationContext(); /** * Returns true if this flow definition is currently in development (running in development mode). * @return the development flag */ - public boolean inDevelopment(); + boolean inDevelopment(); /** * Destroy this flow definition, releasing any resources. After the flow is destroyed it cannot be started again. */ - public void destroy(); + void destroy(); } \ No newline at end of file diff --git a/spring-webflow/src/main/java/org/springframework/webflow/definition/StateDefinition.java b/spring-webflow/src/main/java/org/springframework/webflow/definition/StateDefinition.java index b530682b..eef91975 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/definition/StateDefinition.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/definition/StateDefinition.java @@ -32,17 +32,17 @@ public interface StateDefinition extends Annotated { * Returns the flow definition this state belongs to. * @return the owning flow definition */ - public FlowDefinition getOwner(); + FlowDefinition getOwner(); /** * Returns this state's identifier, locally unique to is containing flow definition. * @return the state identifier */ - public String getId(); + String getId(); /** * Returns true if this state is a view state. * @return true if a view state, false otherwise */ - public boolean isViewState(); + boolean isViewState(); } \ No newline at end of file diff --git a/spring-webflow/src/main/java/org/springframework/webflow/definition/TransitionDefinition.java b/spring-webflow/src/main/java/org/springframework/webflow/definition/TransitionDefinition.java index 8e7c722d..3b00220d 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/definition/TransitionDefinition.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/definition/TransitionDefinition.java @@ -29,7 +29,7 @@ public interface TransitionDefinition extends Annotated { * The identifier of this transition. This id value should be unique among all other transitions in a set. * @return the transition identifier */ - public String getId(); + String getId(); /** * Returns an identification of the target state of this transition. This could be an actual static state id or @@ -37,5 +37,5 @@ public interface TransitionDefinition extends Annotated { * execution time. * @return the target state identifier */ - public String getTargetStateId(); + String getTargetStateId(); } \ No newline at end of file diff --git a/spring-webflow/src/main/java/org/springframework/webflow/definition/TransitionableStateDefinition.java b/spring-webflow/src/main/java/org/springframework/webflow/definition/TransitionableStateDefinition.java index 00156799..5feac694 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/definition/TransitionableStateDefinition.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/definition/TransitionableStateDefinition.java @@ -27,12 +27,12 @@ public interface TransitionableStateDefinition extends StateDefinition { * Returns the available transitions out of this state. * @return the available state transitions */ - public TransitionDefinition[] getTransitions(); + TransitionDefinition[] getTransitions(); /** * Returns the transition that matches the event with the provided id. * @param eventId the event id * @return the transition that matches, or null if no match is found. */ - public TransitionDefinition getTransition(String eventId); + TransitionDefinition getTransition(String eventId); } \ No newline at end of file diff --git a/spring-webflow/src/main/java/org/springframework/webflow/definition/registry/FlowDefinitionHolder.java b/spring-webflow/src/main/java/org/springframework/webflow/definition/registry/FlowDefinitionHolder.java index 6bd67dab..28d7246d 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/definition/registry/FlowDefinitionHolder.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/definition/registry/FlowDefinitionHolder.java @@ -32,7 +32,7 @@ public interface FlowDefinitionHolder { * callers may call to obtain the id of the flow without triggering full flow definition assembly (which may be an * expensive operation). */ - public String getFlowDefinitionId(); + String getFlowDefinitionId(); /** * Returns a descriptive string that identifies the source of this FlowDefinition. This is also a lightweight method @@ -40,27 +40,27 @@ public interface FlowDefinitionHolder { * definition assembly. Used for informational purposes. * @return the flow definition resource string */ - public String getFlowDefinitionResourceString(); + String getFlowDefinitionResourceString(); /** * Returns the flow definition held by this holder. Calling this method the first time may trigger flow assembly * (which may be expensive). * @throws FlowDefinitionConstructionException if there is a problem constructing the target flow definition */ - public FlowDefinition getFlowDefinition() throws FlowDefinitionConstructionException; + FlowDefinition getFlowDefinition() throws FlowDefinitionConstructionException; /** * Refresh the flow definition held by this holder. Calling this method typically triggers flow re-assembly, which * may include a refresh from an externalized resource such as a file. * @throws FlowDefinitionConstructionException if there is a problem constructing the target flow definition */ - public void refresh() throws FlowDefinitionConstructionException; + void refresh() throws FlowDefinitionConstructionException; /** * Indicates that the system is being shutdown and any resources flow resources should be released. After this * method is called, calls to {@link #getFlowDefinition()} are undefined. Should only be called once. May be a no-op * if the held flow was never constructed to begin with. */ - public void destroy(); + void destroy(); } \ No newline at end of file diff --git a/spring-webflow/src/main/java/org/springframework/webflow/definition/registry/FlowDefinitionLocator.java b/spring-webflow/src/main/java/org/springframework/webflow/definition/registry/FlowDefinitionLocator.java index 6d6b0d9b..975e522c 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/definition/registry/FlowDefinitionLocator.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/definition/registry/FlowDefinitionLocator.java @@ -33,6 +33,6 @@ public interface FlowDefinitionLocator { * @throws NoSuchFlowDefinitionException when the flow definition with the specified id does not exist * @throws FlowDefinitionConstructionException if there is a problem constructing the identified flow definition */ - public FlowDefinition getFlowDefinition(String id) throws NoSuchFlowDefinitionException, + FlowDefinition getFlowDefinition(String id) throws NoSuchFlowDefinitionException, FlowDefinitionConstructionException; -} +} diff --git a/spring-webflow/src/main/java/org/springframework/webflow/definition/registry/FlowDefinitionRegistry.java b/spring-webflow/src/main/java/org/springframework/webflow/definition/registry/FlowDefinitionRegistry.java index 24d0536b..9f436aac 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/definition/registry/FlowDefinitionRegistry.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/definition/registry/FlowDefinitionRegistry.java @@ -32,19 +32,19 @@ public interface FlowDefinitionRegistry extends FlowDefinitionLocator { * Returns the number of flow definitions registered in this registry. * @return the flow definition count */ - public int getFlowDefinitionCount(); + int getFlowDefinitionCount(); /** * Returns the ids of the flows registered in this registry. * @return the flow definition ids */ - public String[] getFlowDefinitionIds(); + String[] getFlowDefinitionIds(); /** * Returns this registry's parent registry. * @return the parent flow definition registry, or null if no parent is set */ - public FlowDefinitionRegistry getParent(); + FlowDefinitionRegistry getParent(); /** * Does this registry contain a flow with the given id? More specifically, is {@link #getFlowDefinition(String)} @@ -53,14 +53,14 @@ public interface FlowDefinitionRegistry extends FlowDefinitionLocator { * @param flowId the id of the flow to query * @return whether a flow definition with the given id is registered */ - public boolean containsFlowDefinition(String flowId); + boolean containsFlowDefinition(String flowId); /** * Sets this registry's parent registry. When asked by a client to locate a flow definition this registry will query * it's parent if it cannot fulfill the lookup request itself. * @param parent the parent flow definition registry, may be null */ - public void setParent(FlowDefinitionRegistry parent); + void setParent(FlowDefinitionRegistry parent); /** * Register a flow definition in this registry. Registers a "holder", not the Flow definition itself. This allows @@ -68,12 +68,12 @@ public interface FlowDefinitionRegistry extends FlowDefinitionLocator { * resource changes without re-deploy. * @param definitionHolder a holder holding the flow definition to register */ - public void registerFlowDefinition(FlowDefinitionHolder definitionHolder); + void registerFlowDefinition(FlowDefinitionHolder definitionHolder); /** * Register a flow definition in this registry. * @param definition the actual flow definition */ - public void registerFlowDefinition(FlowDefinition definition); + void registerFlowDefinition(FlowDefinition definition); } \ No newline at end of file diff --git a/spring-webflow/src/main/java/org/springframework/webflow/engine/FlowExecutionExceptionHandler.java b/spring-webflow/src/main/java/org/springframework/webflow/engine/FlowExecutionExceptionHandler.java index a9add62e..36ed6514 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/engine/FlowExecutionExceptionHandler.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/engine/FlowExecutionExceptionHandler.java @@ -43,7 +43,7 @@ public interface FlowExecutionExceptionHandler { * @param exception the exception that occurred * @return true if yes, false if no */ - public boolean canHandle(FlowExecutionException exception); + boolean canHandle(FlowExecutionException exception); /** * Handle the exception in the context of the current request. An implementation is expected to transition the flow @@ -51,5 +51,5 @@ public interface FlowExecutionExceptionHandler { * @param exception the exception that occurred * @param context the execution control context for this request */ - public void handle(FlowExecutionException exception, RequestControlContext context); + void handle(FlowExecutionException exception, RequestControlContext context); } diff --git a/spring-webflow/src/main/java/org/springframework/webflow/engine/RequestControlContext.java b/spring-webflow/src/main/java/org/springframework/webflow/engine/RequestControlContext.java index 6dc7a5fd..0e92f93b 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/engine/RequestControlContext.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/engine/RequestControlContext.java @@ -51,31 +51,31 @@ public interface RequestControlContext extends RequestContext { * @param state the current state * @see State#enter(RequestControlContext) */ - public void setCurrentState(State state); + void setCurrentState(State state); /** * Assign the ongoing flow execution its flow execution key. This method will be called before a state is about to * render a view and pause the flow execution. */ - public FlowExecutionKey assignFlowExecutionKey(); + FlowExecutionKey assignFlowExecutionKey(); /** * Sets the current view. * @param view the current view, or null to mark the current view as null */ - public void setCurrentView(View view); + void setCurrentView(View view); /** * Called when the current view is about to be rendered in the current view state. * @param view the view to be rendered */ - public void viewRendering(View view); + void viewRendering(View view); /** * Called when the current view has completed rendering in the current view state. * @param view the view that rendered */ - public void viewRendered(View view); + void viewRendered(View view); /** * Signals the occurrence of an event in the current state of this flow execution request context. This method @@ -87,7 +87,7 @@ public interface RequestControlContext extends RequestContext { * signalEvent operation * @see Flow#handleEvent(RequestControlContext) */ - public boolean handleEvent(Event event) throws FlowExecutionException; + boolean handleEvent(Event event) throws FlowExecutionException; /** * Execute this transition out of the current source state. Allows for privileged execution of an arbitrary @@ -95,7 +95,7 @@ public interface RequestControlContext extends RequestContext { * @param transition the transition * @see Transition#execute(State, RequestControlContext) */ - public boolean execute(Transition transition); + boolean execute(Transition transition); /** * Record the transition executing in the flow. This method will be called as part of executing a transition from @@ -103,22 +103,22 @@ public interface RequestControlContext extends RequestContext { * @param transition the transition being executed * @see Transition#execute(State, RequestControlContext) */ - public void setCurrentTransition(Transition transition); + void setCurrentTransition(Transition transition); /** * Update the current flow execution snapshot to save the current state. */ - public void updateCurrentFlowExecutionSnapshot(); + void updateCurrentFlowExecutionSnapshot(); /** * Remove the current flow execution snapshot to invalidate the current state. */ - public void removeCurrentFlowExecutionSnapshot(); + void removeCurrentFlowExecutionSnapshot(); /** * Remove all flow execution snapshots associated with the ongoing conversation. Invalidates previous states. */ - public void removeAllFlowExecutionSnapshots(); + void removeAllFlowExecutionSnapshots(); /** * Spawn a new flow session and activate it in the currently executing flow. Also transitions the spawned flow to @@ -131,7 +131,7 @@ public interface RequestControlContext extends RequestContext { * start operation * @see Flow#start(RequestControlContext, MutableAttributeMap) */ - public void start(Flow flow, MutableAttributeMap input) throws FlowExecutionException; + void start(Flow flow, MutableAttributeMap input) throws FlowExecutionException; /** * End the active flow session of the current flow execution. This method should be called by clients that terminate @@ -142,25 +142,25 @@ public interface RequestControlContext extends RequestContext { * @throws IllegalStateException when the flow execution is not active * @see Flow#end(RequestControlContext, String, MutableAttributeMap) */ - public void endActiveFlowSession(String outcome, MutableAttributeMap output) throws IllegalStateException; + void endActiveFlowSession(String outcome, MutableAttributeMap output) throws IllegalStateException; /** * Returns true if the 'redirect on pause' flow execution attribute is set to true, false otherwise. * @return true or false */ - public boolean getRedirectOnPause(); + boolean getRedirectOnPause(); /** * Returns the value of the 'redirect in same state' flow execution attribute if set or otherwise it falls back on * the value returned by {@link #getRedirectOnPause()}. * @return true or false */ - public boolean getRedirectInSameState(); + boolean getRedirectInSameState(); /** * Returns true if the flow current flow execution was launched in embedded page mode. When a flow is embedded on a * page it can make different assumptions with regards to whether redirect after post is necessary. */ - public boolean getEmbeddedMode(); + boolean getEmbeddedMode(); -} +} diff --git a/spring-webflow/src/main/java/org/springframework/webflow/engine/SubflowAttributeMapper.java b/spring-webflow/src/main/java/org/springframework/webflow/engine/SubflowAttributeMapper.java index 72be66a2..18ca1a20 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/engine/SubflowAttributeMapper.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/engine/SubflowAttributeMapper.java @@ -30,12 +30,12 @@ public interface SubflowAttributeMapper { * @param context the current request execution context * @return a map of attributes to pass as input */ - public MutableAttributeMap createSubflowInput(RequestContext context); + MutableAttributeMap createSubflowInput(RequestContext context); /** * Map output attributes of an ended subflow flow to the resuming parent flow. * @param output the output attributes returned by the ended subflow * @param context the current request execution context, which gives access to the parent flow scope */ - public void mapSubflowOutput(AttributeMap output, RequestContext context); + void mapSubflowOutput(AttributeMap output, RequestContext context); } diff --git a/spring-webflow/src/main/java/org/springframework/webflow/engine/TargetStateResolver.java b/spring-webflow/src/main/java/org/springframework/webflow/engine/TargetStateResolver.java index 0cb84972..31ab0646 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/engine/TargetStateResolver.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/engine/TargetStateResolver.java @@ -33,5 +33,5 @@ public interface TargetStateResolver { * @param context the current request context * @return the transition's target state - may be null if no state change should occur */ - public State resolveTargetState(Transition transition, State sourceState, RequestContext context); + State resolveTargetState(Transition transition, State sourceState, RequestContext context); } \ No newline at end of file diff --git a/spring-webflow/src/main/java/org/springframework/webflow/engine/TransitionCriteria.java b/spring-webflow/src/main/java/org/springframework/webflow/engine/TransitionCriteria.java index 7759e149..7aef6c37 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/engine/TransitionCriteria.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/engine/TransitionCriteria.java @@ -34,6 +34,6 @@ public interface TransitionCriteria { * @param context the flow execution request context * @return true if the transition should fire, false otherwise */ - public boolean test(RequestContext context); + boolean test(RequestContext context); } \ No newline at end of file diff --git a/spring-webflow/src/main/java/org/springframework/webflow/engine/VariableValueFactory.java b/spring-webflow/src/main/java/org/springframework/webflow/engine/VariableValueFactory.java index 2d671c46..7e54858c 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/engine/VariableValueFactory.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/engine/VariableValueFactory.java @@ -28,7 +28,7 @@ public interface VariableValueFactory { * @param context the currently executing flow request * @return the value */ - public Object createInitialValue(RequestContext context); + Object createInitialValue(RequestContext context); /** * Restore any references the variable's value needs to other objects. Such references may have been lost during @@ -36,5 +36,5 @@ public interface VariableValueFactory { * @param value the current variable value * @param context the currently executing flow request */ - public void restoreReferences(Object value, RequestContext context); + void restoreReferences(Object value, RequestContext context); } diff --git a/spring-webflow/src/main/java/org/springframework/webflow/engine/builder/FlowBuilder.java b/spring-webflow/src/main/java/org/springframework/webflow/engine/builder/FlowBuilder.java index 7f1aa0a8..857f6de3 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/engine/builder/FlowBuilder.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/engine/builder/FlowBuilder.java @@ -60,55 +60,55 @@ public interface FlowBuilder { * @param context the flow builder context * @throws FlowBuilderException an exception occurred building the flow */ - public void init(FlowBuilderContext context) throws FlowBuilderException; + void init(FlowBuilderContext context) throws FlowBuilderException; /** * Builds any variables initialized by the flow when it starts. * @throws FlowBuilderException an exception occurred building the flow */ - public void buildVariables() throws FlowBuilderException; + void buildVariables() throws FlowBuilderException; /** * Builds the input mapper responsible for mapping flow input on start. * @throws FlowBuilderException an exception occurred building the flow */ - public void buildInputMapper() throws FlowBuilderException; + void buildInputMapper() throws FlowBuilderException; /** * Builds any start actions to execute when the flow starts. * @throws FlowBuilderException an exception occurred building the flow */ - public void buildStartActions() throws FlowBuilderException; + void buildStartActions() throws FlowBuilderException; /** * Builds the states of the flow. * @throws FlowBuilderException an exception occurred building the flow */ - public void buildStates() throws FlowBuilderException; + void buildStates() throws FlowBuilderException; /** * Builds any transitions shared by all states of the flow. * @throws FlowBuilderException an exception occurred building the flow */ - public void buildGlobalTransitions() throws FlowBuilderException; + void buildGlobalTransitions() throws FlowBuilderException; /** * Builds any end actions to execute when the flow ends. * @throws FlowBuilderException an exception occurred building the flow */ - public void buildEndActions() throws FlowBuilderException; + void buildEndActions() throws FlowBuilderException; /** * Builds the output mapper responsible for mapping flow output on end. * @throws FlowBuilderException an exception occurred building the flow */ - public void buildOutputMapper() throws FlowBuilderException; + void buildOutputMapper() throws FlowBuilderException; /** * Creates and adds all exception handlers to the flow built by this builder. * @throws FlowBuilderException an exception occurred building this flow */ - public void buildExceptionHandlers() throws FlowBuilderException; + void buildExceptionHandlers() throws FlowBuilderException; /** * Get the fully constructed and configured Flow object. Called by the builder's assembler (director) after @@ -116,26 +116,26 @@ public interface FlowBuilder { * returned flow is fully configured and ready for use. * @throws FlowBuilderException an exception occurred building this flow */ - public Flow getFlow() throws FlowBuilderException; + Flow getFlow() throws FlowBuilderException; /** * Shutdown the builder, releasing any resources it holds. A new flow construction process should start with another * call to the {@link #init(FlowBuilderContext)} method. * @throws FlowBuilderException an exception occurred building this flow */ - public void dispose() throws FlowBuilderException; + void dispose() throws FlowBuilderException; /** * As the underlying flow managed by this builder changed since the last build occurred? * @return true if changed, false if not */ - public boolean hasFlowChanged(); + boolean hasFlowChanged(); /** * Returns a string describing the location of the flow resource; the logical location where the source code can be * found. Used for informational purposes. * @return the flow resource string */ - public String getFlowResourceString(); + String getFlowResourceString(); } \ No newline at end of file diff --git a/spring-webflow/src/main/java/org/springframework/webflow/engine/builder/FlowBuilderContext.java b/spring-webflow/src/main/java/org/springframework/webflow/engine/builder/FlowBuilderContext.java index 8cbebed6..3994a935 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/engine/builder/FlowBuilderContext.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/engine/builder/FlowBuilderContext.java @@ -33,59 +33,59 @@ public interface FlowBuilderContext { * Returns an externally configured flow definition identifier to assign to the flow being built. * @return the flow id */ - public String getFlowId(); + String getFlowId(); /** * Returns externally configured attributes to assign to the flow definition being built. * @return the flow attributes */ - public AttributeMap getFlowAttributes(); + AttributeMap getFlowAttributes(); /** * Returns the locator for locating dependent flows (subflows). * @return the flow definition locator */ - public FlowDefinitionLocator getFlowDefinitionLocator(); + FlowDefinitionLocator getFlowDefinitionLocator(); /** * Returns the factory for core flow artifacts such as Flow and State. * @return the flow artifact factory */ - public FlowArtifactFactory getFlowArtifactFactory(); + FlowArtifactFactory getFlowArtifactFactory(); /** * Returns a generic type conversion service for converting between types, typically from string to a rich value * object. * @return the generic conversion service */ - public ConversionService getConversionService(); + ConversionService getConversionService(); /** * Returns the view factory creator for configuring a ViewFactory per view state * @return the view factory creator */ - public ViewFactoryCreator getViewFactoryCreator(); + ViewFactoryCreator getViewFactoryCreator(); /** * Returns the expression parser for parsing expression strings. * @return the expression parser */ - public ExpressionParser getExpressionParser(); + ExpressionParser getExpressionParser(); /** * Returns the Validator instance to use for validating a model. * @return the validator */ - public Validator getValidator(); + Validator getValidator(); /** * Return the {@link ValidationHintResolver}. */ - public ValidationHintResolver getValidationHintResolver(); + ValidationHintResolver getValidationHintResolver(); /** * Returns the application context hosting the flow system. * @return the application context */ - public ApplicationContext getApplicationContext(); + ApplicationContext getApplicationContext(); } diff --git a/spring-webflow/src/main/java/org/springframework/webflow/engine/builder/ViewFactoryCreator.java b/spring-webflow/src/main/java/org/springframework/webflow/engine/builder/ViewFactoryCreator.java index 099b093f..0957f982 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/engine/builder/ViewFactoryCreator.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/engine/builder/ViewFactoryCreator.java @@ -40,7 +40,7 @@ public interface ViewFactoryCreator { * @param validationHintResolver a custom ValidationHintResolver to use * @return the view factory */ - public ViewFactory createViewFactory(Expression viewId, ExpressionParser expressionParser, + ViewFactory createViewFactory(Expression viewId, ExpressionParser expressionParser, ConversionService conversionService, BinderConfiguration binderConfiguration, Validator validator, ValidationHintResolver validationHintResolver); @@ -49,6 +49,6 @@ public interface ViewFactoryCreator { * @param viewStateId the view state id * @return the default view id */ - public String getViewIdByConvention(String viewStateId); + String getViewIdByConvention(String viewStateId); } \ No newline at end of file diff --git a/spring-webflow/src/main/java/org/springframework/webflow/engine/builder/support/FlowBuilderContextImpl.java b/spring-webflow/src/main/java/org/springframework/webflow/engine/builder/support/FlowBuilderContextImpl.java index 859ece94..87bf65d3 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/engine/builder/support/FlowBuilderContextImpl.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/engine/builder/support/FlowBuilderContextImpl.java @@ -121,8 +121,8 @@ public class FlowBuilderContextImpl implements FlowBuilderContext { * @return the flow builder conversion service */ protected ConversionService createConversionService() { - GenericConversionService service = new GenericConversionService(getFlowBuilderServices().getConversionService() - .getDelegateConversionService()); + GenericConversionService service = new GenericConversionService( + getFlowBuilderServices().getConversionService().getDelegateConversionService()); service.addConverter(new TextToTransitionCriteria(this)); service.addConverter(new TextToTargetStateResolver(this)); service.setParent(new ParentConversionServiceProxy()); diff --git a/spring-webflow/src/main/java/org/springframework/webflow/engine/builder/support/TextToTransitionCriteria.java b/spring-webflow/src/main/java/org/springframework/webflow/engine/builder/support/TextToTransitionCriteria.java index c468758c..0114f126 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/engine/builder/support/TextToTransitionCriteria.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/engine/builder/support/TextToTransitionCriteria.java @@ -67,7 +67,7 @@ class TextToTransitionCriteria implements Converter { return TransitionCriteria.class; } - public Object convertSourceToTargetClass(Object source, Class targetClass) throws Exception { + public Object convertSourceToTargetClass(Object source, Class targetClass) { String encodedCriteria = (String) source; ExpressionParser parser = flowBuilderContext.getExpressionParser(); if (!StringUtils.hasText(encodedCriteria) @@ -92,4 +92,4 @@ class TextToTransitionCriteria implements Converter { new FluentParserContext().template().evaluate(RequestContext.class)); return new DefaultTransitionCriteria(expression); } -} +} diff --git a/spring-webflow/src/main/java/org/springframework/webflow/engine/model/AbstractModel.java b/spring-webflow/src/main/java/org/springframework/webflow/engine/model/AbstractModel.java index b5120e7b..1ccedda9 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/engine/model/AbstractModel.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/engine/model/AbstractModel.java @@ -47,6 +47,7 @@ public abstract class AbstractModel implements Model { * @param parent the parent string to merge * @return the merged string */ + @SuppressWarnings("RedundantCast") protected String merge(String child, String parent) { return (String) merge((Object) child, (Object) parent); } diff --git a/spring-webflow/src/main/java/org/springframework/webflow/engine/model/Model.java b/spring-webflow/src/main/java/org/springframework/webflow/engine/model/Model.java index 5ea56797..49714347 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/engine/model/Model.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/engine/model/Model.java @@ -29,20 +29,20 @@ public interface Model { * * @return true if able to merge */ - public boolean isMergeableWith(Model model); + boolean isMergeableWith(Model model); /** * Merge the model into the current model * * @param model the model to merge with */ - public void merge(Model model); + void merge(Model model); /** * Create a deep copy of this model. Needed when merging models and collections. * * @return a deep copy of this model */ - public Model createCopy(); + Model createCopy(); } diff --git a/spring-webflow/src/main/java/org/springframework/webflow/engine/model/builder/FlowModelBuilder.java b/spring-webflow/src/main/java/org/springframework/webflow/engine/model/builder/FlowModelBuilder.java index 11dafda9..8229ffbc 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/engine/model/builder/FlowModelBuilder.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/engine/model/builder/FlowModelBuilder.java @@ -45,13 +45,13 @@ public interface FlowModelBuilder { * the flow definition, for example. * @throws FlowModelBuilderException an exception occurred building the flow */ - public void init() throws FlowModelBuilderException; + void init() throws FlowModelBuilderException; /** * Builds any variables initialized by the flow when it starts. * @throws FlowModelBuilderException an exception occurred building the flow */ - public void build() throws FlowModelBuilderException; + void build() throws FlowModelBuilderException; /** * Get the fully constructed flow model. Called by the builder's assembler (director) after assembly. When this @@ -59,27 +59,27 @@ public interface FlowModelBuilder { * ready for use. * @throws FlowModelBuilderException an exception occurred building this flow */ - public FlowModel getFlowModel() throws FlowModelBuilderException; + FlowModel getFlowModel() throws FlowModelBuilderException; /** * Shutdown the builder, releasing any resources it holds. A new flow construction process should start with another * call to the {@link #init()} method. * @throws FlowModelBuilderException an exception occurred disposing this flow */ - public void dispose() throws FlowModelBuilderException; + void dispose() throws FlowModelBuilderException; /** * Get the underlying flow model resource accessed to build this flow model. Returns null if this builder does not * construct the flow model from a resource. * @return the flow model resource */ - public Resource getFlowModelResource(); + Resource getFlowModelResource(); /** * Returns true if the underlying flow model resource has changed since the last call to {@link #init()}. Always * returns false if the flow model is not build from a resource. * @return true if the resource backing the flow model has changed */ - public boolean hasFlowModelResourceChanged(); + boolean hasFlowModelResourceChanged(); } \ No newline at end of file diff --git a/spring-webflow/src/main/java/org/springframework/webflow/engine/model/builder/xml/DocumentLoader.java b/spring-webflow/src/main/java/org/springframework/webflow/engine/model/builder/xml/DocumentLoader.java index dece01ba..f3795034 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/engine/model/builder/xml/DocumentLoader.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/engine/model/builder/xml/DocumentLoader.java @@ -38,5 +38,5 @@ public interface DocumentLoader { * @throws ParserConfigurationException an exception occured building the document parser * @throws SAXException a error occured during document parsing */ - public Document loadDocument(Resource resource) throws IOException, ParserConfigurationException, SAXException; + Document loadDocument(Resource resource) throws IOException, ParserConfigurationException, SAXException; } \ No newline at end of file diff --git a/spring-webflow/src/main/java/org/springframework/webflow/engine/model/registry/FlowModelHolder.java b/spring-webflow/src/main/java/org/springframework/webflow/engine/model/registry/FlowModelHolder.java index 1bae7201..7b749f1b 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/engine/model/registry/FlowModelHolder.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/engine/model/registry/FlowModelHolder.java @@ -32,24 +32,24 @@ public interface FlowModelHolder { /** * Returns the flow model held by this holder. Calling this method the first time may trigger flow model assembly. */ - public FlowModel getFlowModel(); + FlowModel getFlowModel(); /** * Has the underlying flow model changed since it was last accessed via a call to {@link #getFlowModel()}. * @return true if yes, false if not */ - public boolean hasFlowModelChanged(); + boolean hasFlowModelChanged(); /** * Returns the underlying resource defining the flow model. * @return the flow model resource */ - public Resource getFlowModelResource(); + Resource getFlowModelResource(); /** * Refresh the flow model held by this holder. Calling this method typically triggers flow re-assembly, which may * include a refresh from an externalized resource such as a file. */ - public void refresh(); + void refresh(); } \ No newline at end of file diff --git a/spring-webflow/src/main/java/org/springframework/webflow/engine/model/registry/FlowModelHolderLocator.java b/spring-webflow/src/main/java/org/springframework/webflow/engine/model/registry/FlowModelHolderLocator.java index 7fdc0559..770c0153 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/engine/model/registry/FlowModelHolderLocator.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/engine/model/registry/FlowModelHolderLocator.java @@ -31,6 +31,6 @@ public interface FlowModelHolderLocator { * @throws NoSuchFlowModelException when the flow model with the specified * id does not exist */ - public FlowModelHolder getFlowModelHolder(String id) throws NoSuchFlowModelException; + FlowModelHolder getFlowModelHolder(String id) throws NoSuchFlowModelException; } diff --git a/spring-webflow/src/main/java/org/springframework/webflow/engine/model/registry/FlowModelLocator.java b/spring-webflow/src/main/java/org/springframework/webflow/engine/model/registry/FlowModelLocator.java index 117d62c1..698f9cac 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/engine/model/registry/FlowModelLocator.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/engine/model/registry/FlowModelLocator.java @@ -33,5 +33,5 @@ public interface FlowModelLocator { * @return the flow mode * @throws NoSuchFlowModelException when the flow model with the specified id does not exist */ - public FlowModel getFlowModel(String id) throws NoSuchFlowModelException; -} + FlowModel getFlowModel(String id) throws NoSuchFlowModelException; +} diff --git a/spring-webflow/src/main/java/org/springframework/webflow/engine/model/registry/FlowModelRegistry.java b/spring-webflow/src/main/java/org/springframework/webflow/engine/model/registry/FlowModelRegistry.java index 04a9a321..e7df0ee7 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/engine/model/registry/FlowModelRegistry.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/engine/model/registry/FlowModelRegistry.java @@ -32,7 +32,7 @@ public interface FlowModelRegistry extends FlowModelLocator { * parent if it cannot fulfill the lookup request itself. * @param parent the parent flow model registry, may be null */ - public void setParent(FlowModelRegistry parent); + void setParent(FlowModelRegistry parent); /** * Register a flow model in this registry. Registers a "holder", not the Flow model itself. This allows the actual @@ -41,6 +41,6 @@ public interface FlowModelRegistry extends FlowModelLocator { * @param id the id to register the flow model under * @param modelHolder a holder holding the flow model to register */ - public void registerFlowModel(String id, FlowModelHolder modelHolder); + void registerFlowModel(String id, FlowModelHolder modelHolder); } \ No newline at end of file diff --git a/spring-webflow/src/main/java/org/springframework/webflow/execution/Action.java b/spring-webflow/src/main/java/org/springframework/webflow/execution/Action.java index 3db2d3a7..ce576664 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/execution/Action.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/execution/Action.java @@ -97,5 +97,5 @@ public interface Action { * recoverable exceptions should be caught within this method and an appropriate result outcome returned * or be handled by the current state of the calling flow execution. */ - public Event execute(RequestContext context) throws Exception; + Event execute(RequestContext context) throws Exception; } diff --git a/spring-webflow/src/main/java/org/springframework/webflow/execution/FlowExecution.java b/spring-webflow/src/main/java/org/springframework/webflow/execution/FlowExecution.java index 3ded162f..7bea9806 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/execution/FlowExecution.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/execution/FlowExecution.java @@ -36,7 +36,7 @@ public interface FlowExecution extends FlowExecutionContext { * @throws FlowExecutionException if an exception was thrown within a state of the flow execution during request * processing */ - public void start(MutableAttributeMap input, ExternalContext context) throws FlowExecutionException; + void start(MutableAttributeMap input, ExternalContext context) throws FlowExecutionException; /** * Resume this flow execution. May be called when the flow execution is paused. @@ -48,6 +48,6 @@ public interface FlowExecution extends FlowExecutionContext { * @throws FlowExecutionException if an exception was thrown within a state of the resumed flow execution during * event processing */ - public void resume(ExternalContext context) throws FlowExecutionException; + void resume(ExternalContext context) throws FlowExecutionException; -} +} diff --git a/spring-webflow/src/main/java/org/springframework/webflow/execution/FlowExecutionContext.java b/spring-webflow/src/main/java/org/springframework/webflow/execution/FlowExecutionContext.java index a44cb562..f1c57b01 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/execution/FlowExecutionContext.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/execution/FlowExecutionContext.java @@ -46,7 +46,7 @@ public interface FlowExecutionContext { * identity. * @return the flow execution key; may be null if a key has not yet been assigned. */ - public FlowExecutionKey getKey(); + FlowExecutionKey getKey(); /** * Returns the root flow definition associated with this executing flow. @@ -55,7 +55,7 @@ public interface FlowExecutionContext { * actually be active (for example, if subflows have been spawned). * @return the root flow definition */ - public FlowDefinition getDefinition(); + FlowDefinition getDefinition(); /** * Returns a flag indicating if this execution has been started. A flow execution that has started and is active is @@ -63,14 +63,14 @@ public interface FlowExecutionContext { * @see #isActive() * @return true if started, false if not started */ - public boolean hasStarted(); + boolean hasStarted(); /** * Is the flow execution active? A flow execution is active once it has an {@link #getActiveSession() active * session} and remains active until it has ended. * @return true if active, false if the flow execution has terminated or has not yet been started */ - public boolean isActive(); + boolean isActive(); /** * Returns a flag indicating if this execution has ended. A flow execution that has ended has been started but is no @@ -79,13 +79,13 @@ public interface FlowExecutionContext { * @see #isActive() * @return true if ended, false if not started or still active */ - public boolean hasEnded(); + boolean hasEnded(); /** * Returns the outcome reached by this execution, or null if this execution has not yet ended. * @return the outcome, or null if this execution has not yet ended */ - public FlowExecutionOutcome getOutcome(); + FlowExecutionOutcome getOutcome(); /** * Returns the active flow session of this flow execution. The active flow session is the currently executing @@ -95,26 +95,26 @@ public interface FlowExecutionContext { * @throws IllegalStateException if this flow execution is not active * @see #isActive() */ - public FlowSession getActiveSession() throws IllegalStateException; + FlowSession getActiveSession() throws IllegalStateException; /** * Returns a mutable map for data held in "flash scope". Attributes in this map are cleared out on the next view * rendering. Flash attributes survive flow execution refresh operations. * @return flash scope */ - public MutableAttributeMap getFlashScope(); + MutableAttributeMap getFlashScope(); /** * Returns a mutable map for data held in "conversation scope". Conversation scope is a data structure that exists * for the life of this flow execution and is accessible to all flow sessions. * @return conversation scope */ - public MutableAttributeMap getConversationScope(); + MutableAttributeMap getConversationScope(); /** * Returns runtime execution attributes that may influence the behavior of flow artifacts, such as states and * actions. * @return execution attributes */ - public AttributeMap getAttributes(); -} + AttributeMap getAttributes(); +} diff --git a/spring-webflow/src/main/java/org/springframework/webflow/execution/FlowExecutionFactory.java b/spring-webflow/src/main/java/org/springframework/webflow/execution/FlowExecutionFactory.java index cc12446c..dce2de03 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/execution/FlowExecutionFactory.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/execution/FlowExecutionFactory.java @@ -42,7 +42,7 @@ public interface FlowExecutionFactory { * @param flowDefinition the flow definition * @return the new flow execution, fully initialized and awaiting to be started */ - public FlowExecution createFlowExecution(FlowDefinition flowDefinition); + FlowExecution createFlowExecution(FlowDefinition flowDefinition); /** * Restore the transient state of the flow execution. @@ -55,7 +55,7 @@ public interface FlowExecutionFactory { * @param subflowDefinitionLocator for locating the definitions of any subflows started by the execution * @return the restored flow execution */ - public FlowExecution restoreFlowExecution(FlowExecution flowExecution, FlowDefinition flowDefinition, + FlowExecution restoreFlowExecution(FlowExecution flowExecution, FlowDefinition flowDefinition, FlowExecutionKey flowExecutionKey, MutableAttributeMap conversationScope, FlowDefinitionLocator subflowDefinitionLocator); -} +} diff --git a/spring-webflow/src/main/java/org/springframework/webflow/execution/FlowExecutionKeyFactory.java b/spring-webflow/src/main/java/org/springframework/webflow/execution/FlowExecutionKeyFactory.java index 615aa863..0c31936e 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/execution/FlowExecutionKeyFactory.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/execution/FlowExecutionKeyFactory.java @@ -29,27 +29,27 @@ public interface FlowExecutionKeyFactory { * @param execution the flow execution * @return the key to assign to the flow execution */ - public FlowExecutionKey getKey(FlowExecution execution); + FlowExecutionKey getKey(FlowExecution execution); /** * Capture the current state of the flow execution by updating its snapshot in storage. Does nothing if the no key * has been assigned or no snapshot has already been taken. * @param execution the flow execution */ - public void updateFlowExecutionSnapshot(FlowExecution execution); + void updateFlowExecutionSnapshot(FlowExecution execution); /** * Remove the snapshot that was used to restore this flow execution, discarding it for future use. Does nothing if * the no key been assigned or no snapshot has been taken. * @param execution the flow execution */ - public void removeFlowExecutionSnapshot(FlowExecution execution); + void removeFlowExecutionSnapshot(FlowExecution execution); /** * Remove all snapshots associated with the flow execution from storage, invalidating all history. Does nothing if * no key has been assigned or no snapshots have been taken. * @param execution the flow execution */ - public void removeAllFlowExecutionSnapshots(FlowExecution execution); + void removeAllFlowExecutionSnapshots(FlowExecution execution); } diff --git a/spring-webflow/src/main/java/org/springframework/webflow/execution/FlowExecutionListener.java b/spring-webflow/src/main/java/org/springframework/webflow/execution/FlowExecutionListener.java index 84569e87..47431d45 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/execution/FlowExecutionListener.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/execution/FlowExecutionListener.java @@ -56,13 +56,13 @@ public interface FlowExecutionListener { * processing. * @param context the current flow request context */ - public void requestSubmitted(RequestContext context); + void requestSubmitted(RequestContext context); /** * Called when a client request has completed processing. * @param context the source of the event */ - public void requestProcessed(RequestContext context); + void requestProcessed(RequestContext context); /** * Called to indicate a new flow definition session is about to be created. Called before the session is created. An @@ -71,7 +71,7 @@ public interface FlowExecutionListener { * @param context the current flow request context * @param definition the flow for which a new session is starting */ - public void sessionCreating(RequestContext context, FlowDefinition definition); + void sessionCreating(RequestContext context, FlowDefinition definition); /** * Called after a new flow session has been created but before it starts. Useful for setting arbitrary attributes in @@ -81,7 +81,7 @@ public interface FlowExecutionListener { * @param input a mutable input map - attributes placed in this map are eligible for input mapping by the flow * definition at startup */ - public void sessionStarting(RequestContext context, FlowSession session, MutableAttributeMap input); + void sessionStarting(RequestContext context, FlowSession session, MutableAttributeMap input); /** * Called after a new flow session has started. At this point the flow's start state has been entered and any other @@ -89,21 +89,21 @@ public interface FlowExecutionListener { * @param context the current flow request context * @param session the session that was started */ - public void sessionStarted(RequestContext context, FlowSession session); + void sessionStarted(RequestContext context, FlowSession session); /** * Called when an event is signaled in the current state, but prior to any state transition. * @param context the current flow request context * @param event the event that occurred */ - public void eventSignaled(RequestContext context, Event event); + void eventSignaled(RequestContext context, Event event); /** * Called when a transition is matched but before the transition occurs. * @param context the current flow request context * @param transition the proposed transition */ - public void transitionExecuting(RequestContext context, TransitionDefinition transition); + void transitionExecuting(RequestContext context, TransitionDefinition transition); /** * Called when a state transitions, after the transition is matched but before the transition occurs. @@ -111,7 +111,7 @@ public interface FlowExecutionListener { * @param state the proposed state to transition to * @throws EnterStateVetoException when entering the state is not allowed */ - public void stateEntering(RequestContext context, StateDefinition state) throws EnterStateVetoException; + void stateEntering(RequestContext context, StateDefinition state) throws EnterStateVetoException; /** * Called when a state transitions, after the transition occurred. @@ -119,7 +119,7 @@ public interface FlowExecutionListener { * @param previousState from state of the transition * @param state to state of the transition */ - public void stateEntered(RequestContext context, StateDefinition previousState, StateDefinition state); + void stateEntered(RequestContext context, StateDefinition previousState, StateDefinition state); /** * Called when a view is about to render in a view-state, before any render actions are executed. @@ -127,7 +127,7 @@ public interface FlowExecutionListener { * @param view the view that is about to render * @param viewState the current view state */ - public void viewRendering(RequestContext context, View view, StateDefinition viewState); + void viewRendering(RequestContext context, View view, StateDefinition viewState); /** * Called after a view has completed rendering. @@ -135,19 +135,19 @@ public interface FlowExecutionListener { * @param view the view that rendered * @param viewState the current view state */ - public void viewRendered(RequestContext context, View view, StateDefinition viewState); + void viewRendered(RequestContext context, View view, StateDefinition viewState); /** * Called when a flow execution is paused, for instance when it is waiting for user input (after event processing). * @param context the current flow request context */ - public void paused(RequestContext context); + void paused(RequestContext context); /** * Called after a flow execution is successfully reactivated after pause (but before event processing). * @param context the current flow request context */ - public void resuming(RequestContext context); + void resuming(RequestContext context); /** * Called when the active flow execution session has been asked to end but before it has ended. @@ -157,7 +157,7 @@ public interface FlowExecutionListener { * @param output the flow output produced by the ending session, this map may be modified by this listener to affect * the output returned */ - public void sessionEnding(RequestContext context, FlowSession session, String outcome, MutableAttributeMap output); + void sessionEnding(RequestContext context, FlowSession session, String outcome, MutableAttributeMap output); /** * Called when a flow execution session ends. If the ended session was the root session of the flow execution, the @@ -167,7 +167,7 @@ public interface FlowExecutionListener { * @param outcome the outcome reached by the ended session, generally the id of the terminating end-state * @param output the flow output returned by the ending session */ - public void sessionEnded(RequestContext context, FlowSession session, String outcome, AttributeMap output); + void sessionEnded(RequestContext context, FlowSession session, String outcome, AttributeMap output); /** * Called when an exception is thrown during a flow execution, before the exception is handled by any registered @@ -175,6 +175,6 @@ public interface FlowExecutionListener { * @param context the current flow request context * @param exception the exception that occurred */ - public void exceptionThrown(RequestContext context, FlowExecutionException exception); + void exceptionThrown(RequestContext context, FlowExecutionException exception); -} +} diff --git a/spring-webflow/src/main/java/org/springframework/webflow/execution/FlowSession.java b/spring-webflow/src/main/java/org/springframework/webflow/execution/FlowSession.java index 6e625ed5..b24020b9 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/execution/FlowSession.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/execution/FlowSession.java @@ -41,18 +41,18 @@ public interface FlowSession { /** * Returns the flow definition backing this session. */ - public FlowDefinition getDefinition(); + FlowDefinition getDefinition(); /** * Returns the current state of this flow session. This value changes as the flow executes. */ - public StateDefinition getState(); + StateDefinition getState(); /** * Return this session's local attributes; the basis for "flow scope" (flow session scope). * @return the flow scope attributes */ - public MutableAttributeMap getScope(); + MutableAttributeMap getScope(); /** * Returns a mutable map for data held in "view scope". Attributes in this map are cleared out when the current view @@ -60,24 +60,24 @@ public interface FlowSession { * @return view scope * @throws IllegalStateException if this flow session is not currently in a view state */ - public MutableAttributeMap getViewScope() throws IllegalStateException; + MutableAttributeMap getViewScope() throws IllegalStateException; /** * Returns true if the flow session was started in embedded page mode. An embedded flow can make different * assumptions with regards to whether redirect after post is necessary. */ - public boolean isEmbeddedMode(); + boolean isEmbeddedMode(); /** * Returns the parent flow session in the current flow execution, or null if there is no parent flow * session. */ - public FlowSession getParent(); + FlowSession getParent(); /** * Returns whether this flow session is the root flow session in the ongoing flow execution. The root flow session * does not have a parent flow session. */ - public boolean isRoot(); + boolean isRoot(); -} +} diff --git a/spring-webflow/src/main/java/org/springframework/webflow/execution/RequestContext.java b/spring-webflow/src/main/java/org/springframework/webflow/execution/RequestContext.java index 1aecb38e..7d07b7de 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/execution/RequestContext.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/execution/RequestContext.java @@ -63,7 +63,7 @@ public interface RequestContext { * @throws IllegalStateException if the flow execution is not active * @see FlowExecutionContext#isActive() */ - public FlowDefinition getActiveFlow() throws IllegalStateException; + FlowDefinition getActiveFlow() throws IllegalStateException; /** * Returns the current state of the executing flow. Returns null if the active flow's start state has @@ -72,7 +72,7 @@ public interface RequestContext { * @throws IllegalStateException if this flow execution is not active * @see FlowExecutionContext#isActive() */ - public StateDefinition getCurrentState() throws IllegalStateException; + StateDefinition getCurrentState() throws IllegalStateException; /** * Returns the transition that would execute on the occurrence of the given event. @@ -81,7 +81,7 @@ public interface RequestContext { * @throws IllegalStateException if this flow execution is not active * @see FlowExecutionContext#isActive() */ - public TransitionDefinition getMatchingTransition(String eventId) throws IllegalStateException; + TransitionDefinition getMatchingTransition(String eventId) throws IllegalStateException; /** * Returns true if the flow is currently active and in a view state. When in a view state {@link #getViewScope()}, @@ -89,21 +89,21 @@ public interface RequestContext { * @see #getViewScope() * @return true if in a view state, false if not */ - public boolean inViewState(); + boolean inViewState(); /** * Returns a mutable map for accessing and/or setting attributes in request scope. Request scoped attributes * exist for the duration of this request only. * @return the request scope */ - public MutableAttributeMap getRequestScope(); + MutableAttributeMap getRequestScope(); /** * Returns a mutable map for accessing and/or setting attributes in flash scope. Flash scoped attributes exist * until the next event is signaled in the flow execution. * @return the flash scope */ - public MutableAttributeMap getFlashScope(); + MutableAttributeMap getFlashScope(); /** * Returns a mutable map for accessing and/or setting attributes in view scope. View scoped attributes exist for @@ -113,7 +113,7 @@ public interface RequestContext { * @throws IllegalStateException if this flow is not in a view-state or the flow execution is not active * @see FlowExecutionContext#isActive() */ - public MutableAttributeMap getViewScope() throws IllegalStateException; + MutableAttributeMap getViewScope() throws IllegalStateException; /** * Returns a mutable map for accessing and/or setting attributes in flow scope. Flow scoped attributes exist for @@ -123,7 +123,7 @@ public interface RequestContext { * @throws IllegalStateException if the flow execution is not active * @see FlowExecutionContext#isActive() */ - public MutableAttributeMap getFlowScope() throws IllegalStateException; + MutableAttributeMap getFlowScope() throws IllegalStateException; /** * Returns a mutable accessor for accessing and/or setting attributes in conversation scope. Conversation scoped @@ -131,7 +131,7 @@ public interface RequestContext { * @return the conversation scope * @see FlowExecutionContext */ - public MutableAttributeMap getConversationScope(); + MutableAttributeMap getConversationScope(); /** * Returns the immutable input parameters associated with this request into Spring Web Flow. The map returned is @@ -141,7 +141,7 @@ public interface RequestContext { * directly. * @see #getExternalContext() */ - public ParameterMap getRequestParameters(); + ParameterMap getRequestParameters(); /** * Returns the external client context that originated (or triggered) this request. @@ -156,34 +156,34 @@ public interface RequestContext { * environment when possible. * @return the originating external context, the one that triggered the current execution request */ - public ExternalContext getExternalContext(); + ExternalContext getExternalContext(); /** * Returns the message context of this request. Useful for recording messages during the course of flow execution * for display to the client. * @return the message context */ - public MessageContext getMessageContext(); + MessageContext getMessageContext(); /** * Returns contextual information about the flow execution itself. Information in this context typically spans more * than one request. * @return the flow execution context */ - public FlowExecutionContext getFlowExecutionContext(); + FlowExecutionContext getFlowExecutionContext(); /** * Returns the current event being processed by this flow. The event may or may not have caused a state transition * to happen. * @return the current event, or null if no event has been signaled yet */ - public Event getCurrentEvent(); + Event getCurrentEvent(); /** * Returns the current transition executing in this request. * @return the current transition, or null if no transition has occurred yet */ - public TransitionDefinition getCurrentTransition(); + TransitionDefinition getCurrentTransition(); /** * Returns the current view in use; if not null, the view returned is about to be rendered, is rendering, is @@ -191,14 +191,14 @@ public interface RequestContext { * state transition. Returns null if the flow is not in a view state. * @return the current view, or null if the flow is not in a view state */ - public View getCurrentView(); + View getCurrentView(); /** * Returns a context map for accessing attributes about the state of the current request. These attributes may be * used to influence flow execution behavior. * @return the current attributes of this request, or empty if none are set */ - public MutableAttributeMap getAttributes(); + MutableAttributeMap getAttributes(); /** * Returns the URL of this flow execution. Needed by response writers that write out the URL of this flow execution @@ -206,6 +206,6 @@ public interface RequestContext { * @throws IllegalStateException if the flow execution has not yet had its key assigned * @return the flow execution URL */ - public String getFlowExecutionUrl() throws IllegalStateException; + String getFlowExecutionUrl() throws IllegalStateException; } diff --git a/spring-webflow/src/main/java/org/springframework/webflow/execution/View.java b/spring-webflow/src/main/java/org/springframework/webflow/execution/View.java index 55c6159a..7c22fcc1 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/execution/View.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/execution/View.java @@ -33,45 +33,45 @@ public interface View { /** * Well-known attribute name for storing a render fragments value. */ - public static final String RENDER_FRAGMENTS_ATTRIBUTE = "flowRenderFragments"; + String RENDER_FRAGMENTS_ATTRIBUTE = "flowRenderFragments"; /** * Well-known attribute name for storing the results of processing a user event */ - public static final String USER_EVENT_STATE_ATTRIBUTE = "viewUserEventState"; + String USER_EVENT_STATE_ATTRIBUTE = "viewUserEventState"; /** * Render this view's content. * @throws IOException if an IO Exception occured rendering the view */ - public void render() throws IOException; + void render() throws IOException; /** * True if there is a user event queued this view should process. * @return true if a user event is queued, false if not */ - public boolean userEventQueued(); + boolean userEventQueued(); /** * Process the queued user event. Should only be called when {@link #userEventQueued()} returns true. After calling * this method, a flow event may be raised that should be handled in the Web Flow system. * @see #hasFlowEvent() */ - public void processUserEvent(); + void processUserEvent(); /** * True if a call to {@link #processUserEvent()} raised a flow event the current state should handle. Call * {@link #getFlowEvent()} to access the Event. * @return true if yes, false otherwise */ - public boolean hasFlowEvent(); + boolean hasFlowEvent(); /** * Get the flow event the current state should handle. Returns an Event object when {@link #hasFlowEvent()} returns * true. Returns null otherwise. * @return the event, or null if there is no event for the flow system to handle */ - public Event getFlowEvent(); + Event getFlowEvent(); /** * A memento holding the results of processing a user event. Used to allow transient view state such as binding and @@ -79,13 +79,13 @@ public interface View { * @return the serializable user event state object, or null if no event state needs managing * @see #processUserEvent() */ - public Serializable getUserEventState(); + Serializable getUserEventState(); /** * Saves any state associated with this view out to view scope. Called when exiting a {@link ViewState} to allow for * any changes applied after postback processing to be captured and reflected when going back. Can be a no-op for * views that store no view state. */ - public void saveState(); + void saveState(); } diff --git a/spring-webflow/src/main/java/org/springframework/webflow/execution/ViewFactory.java b/spring-webflow/src/main/java/org/springframework/webflow/execution/ViewFactory.java index 90c80228..343966e3 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/execution/ViewFactory.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/execution/ViewFactory.java @@ -28,5 +28,5 @@ public interface ViewFactory { * @param context the flow execution request context. * @return the view to render */ - public View getView(RequestContext context); + View getView(RequestContext context); } \ No newline at end of file diff --git a/spring-webflow/src/main/java/org/springframework/webflow/execution/factory/FlowExecutionListenerCriteria.java b/spring-webflow/src/main/java/org/springframework/webflow/execution/factory/FlowExecutionListenerCriteria.java index 969893e4..bab8d86b 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/execution/factory/FlowExecutionListenerCriteria.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/execution/factory/FlowExecutionListenerCriteria.java @@ -37,5 +37,5 @@ public interface FlowExecutionListenerCriteria { * @param definition the flow definition * @return true if yes, false if no */ - public boolean appliesTo(FlowDefinition definition); + boolean appliesTo(FlowDefinition definition); } \ No newline at end of file diff --git a/spring-webflow/src/main/java/org/springframework/webflow/execution/factory/FlowExecutionListenerCriteriaFactory.java b/spring-webflow/src/main/java/org/springframework/webflow/execution/factory/FlowExecutionListenerCriteriaFactory.java index 202517d8..96c48f27 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/execution/factory/FlowExecutionListenerCriteriaFactory.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/execution/factory/FlowExecutionListenerCriteriaFactory.java @@ -57,7 +57,7 @@ public class FlowExecutionListenerCriteriaFactory { * @param flowId the flow id to match */ public FlowExecutionListenerCriteria flow(String flowId) { - return new FlowIdFlowExecutionListenerCriteria(new String[] { flowId }); + return new FlowIdFlowExecutionListenerCriteria(flowId); } /** diff --git a/spring-webflow/src/main/java/org/springframework/webflow/execution/factory/FlowExecutionListenerLoader.java b/spring-webflow/src/main/java/org/springframework/webflow/execution/factory/FlowExecutionListenerLoader.java index f01cedb3..782bfb9d 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/execution/factory/FlowExecutionListenerLoader.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/execution/factory/FlowExecutionListenerLoader.java @@ -32,5 +32,5 @@ public interface FlowExecutionListenerLoader { * @param flowDefinition the flow definition * @return the listeners that apply */ - public FlowExecutionListener[] getListeners(FlowDefinition flowDefinition); + FlowExecutionListener[] getListeners(FlowDefinition flowDefinition); } \ No newline at end of file diff --git a/spring-webflow/src/main/java/org/springframework/webflow/execution/repository/FlowExecutionLock.java b/spring-webflow/src/main/java/org/springframework/webflow/execution/repository/FlowExecutionLock.java index 80d03944..fd459d76 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/execution/repository/FlowExecutionLock.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/execution/repository/FlowExecutionLock.java @@ -26,10 +26,10 @@ public interface FlowExecutionLock { /** * Acquire the flow execution lock. This method will block until the lock becomes available for acquisition. */ - public void lock(); + void lock(); /** * Release the flow execution lock. */ - public void unlock(); + void unlock(); } \ No newline at end of file diff --git a/spring-webflow/src/main/java/org/springframework/webflow/execution/repository/FlowExecutionRepository.java b/spring-webflow/src/main/java/org/springframework/webflow/execution/repository/FlowExecutionRepository.java index e5d542bc..44cc0c34 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/execution/repository/FlowExecutionRepository.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/execution/repository/FlowExecutionRepository.java @@ -42,7 +42,7 @@ public interface FlowExecutionRepository { * @param encodedKey the string encoded key * @return the parsed flow execution key, the persistent identifier for exactly one flow execution */ - public FlowExecutionKey parseFlowExecutionKey(String encodedKey) throws FlowExecutionRepositoryException; + FlowExecutionKey parseFlowExecutionKey(String encodedKey) throws FlowExecutionRepositoryException; /** * Return the lock for the flow execution, allowing for the lock to be acquired or released. Caution: care should be @@ -64,7 +64,7 @@ public interface FlowExecutionRepository { * @return the lock * @throws FlowExecutionRepositoryException a problem occurred accessing the lock object */ - public FlowExecutionLock getLock(FlowExecutionKey key) throws FlowExecutionRepositoryException; + FlowExecutionLock getLock(FlowExecutionKey key) throws FlowExecutionRepositoryException; /** * Return the FlowExecution indexed by the provided key. The returned flow execution represents the @@ -74,7 +74,7 @@ public interface FlowExecutionRepository { * @return the flow execution, fully hydrated and ready to resume * @throws FlowExecutionRepositoryException if no flow execution was indexed with the key provided */ - public FlowExecution getFlowExecution(FlowExecutionKey key) throws FlowExecutionRepositoryException; + FlowExecution getFlowExecution(FlowExecutionKey key) throws FlowExecutionRepositoryException; /** * Place the FlowExecution in this repository under the provided key. This should be called to save or @@ -83,7 +83,7 @@ public interface FlowExecutionRepository { * @param flowExecution the flow execution * @throws FlowExecutionRepositoryException the flow execution could not be stored */ - public void putFlowExecution(FlowExecution flowExecution) throws FlowExecutionRepositoryException; + void putFlowExecution(FlowExecution flowExecution) throws FlowExecutionRepositoryException; /** * Remove the flow execution from the repository. This should be called when the flow execution ends (is no longer @@ -91,6 +91,6 @@ public interface FlowExecutionRepository { * @param flowExecution the flow execution * @throws FlowExecutionRepositoryException the flow execution could not be removed. */ - public void removeFlowExecution(FlowExecution flowExecution) throws FlowExecutionRepositoryException; + void removeFlowExecution(FlowExecution flowExecution) throws FlowExecutionRepositoryException; } diff --git a/spring-webflow/src/main/java/org/springframework/webflow/execution/repository/impl/FlowExecutionSnapshotGroup.java b/spring-webflow/src/main/java/org/springframework/webflow/execution/repository/impl/FlowExecutionSnapshotGroup.java index 087cca12..5d38459c 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/execution/repository/impl/FlowExecutionSnapshotGroup.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/execution/repository/impl/FlowExecutionSnapshotGroup.java @@ -20,42 +20,42 @@ public interface FlowExecutionSnapshotGroup { * @return the continuation * @throws SnapshotNotFoundException if the id does not match a continuation in this group */ - public FlowExecutionSnapshot getSnapshot(Serializable snapshotId) throws SnapshotNotFoundException; + FlowExecutionSnapshot getSnapshot(Serializable snapshotId) throws SnapshotNotFoundException; /** * Add a flow execution snapshot with given id to this group. * @param snapshotId the snapshot id * @param snapshot the snapshot */ - public void addSnapshot(Serializable snapshotId, FlowExecutionSnapshot snapshot); + void addSnapshot(Serializable snapshotId, FlowExecutionSnapshot snapshot); /** * Update the snapshot with the given id. Does nothing if no snapshot has been added with the id provided. * @param snapshotId the snapshot id * @param snapshot the new snapshot */ - public void updateSnapshot(Serializable snapshotId, FlowExecutionSnapshot snapshot); + void updateSnapshot(Serializable snapshotId, FlowExecutionSnapshot snapshot); /** * Remove the snapshot with the given id. Does nothing if no snapshot has been added with the id provided. * @param snapshotId the continuation id */ - public void removeSnapshot(Serializable snapshotId); + void removeSnapshot(Serializable snapshotId); /** * Remove all snapshots in this group. Does nothing if no snapshots have been added to this group. */ - public void removeAllSnapshots(); + void removeAllSnapshots(); /** * Returns the count of snapshots in this group. */ - public int getSnapshotCount(); + int getSnapshotCount(); /** * Gets the next snapshot id for new snapshot to add to this group. * @return the next snapshot id */ - public Serializable nextSnapshotId(); + Serializable nextSnapshotId(); } \ No newline at end of file diff --git a/spring-webflow/src/main/java/org/springframework/webflow/execution/repository/impl/SimpleFlowExecutionSnapshotGroup.java b/spring-webflow/src/main/java/org/springframework/webflow/execution/repository/impl/SimpleFlowExecutionSnapshotGroup.java index 2baed1b6..4e97f450 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/execution/repository/impl/SimpleFlowExecutionSnapshotGroup.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/execution/repository/impl/SimpleFlowExecutionSnapshotGroup.java @@ -108,7 +108,7 @@ class SimpleFlowExecutionSnapshotGroup implements FlowExecutionSnapshotGroup, Se } public Serializable nextSnapshotId() { - Integer nextSnapshotId = Integer.valueOf(snapshotIdSequence); + Integer nextSnapshotId = snapshotIdSequence; snapshotIdSequence++; return nextSnapshotId; } diff --git a/spring-webflow/src/main/java/org/springframework/webflow/execution/repository/snapshot/FlowExecutionSnapshotFactory.java b/spring-webflow/src/main/java/org/springframework/webflow/execution/repository/snapshot/FlowExecutionSnapshotFactory.java index 40df15e7..5aa730a2 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/execution/repository/snapshot/FlowExecutionSnapshotFactory.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/execution/repository/snapshot/FlowExecutionSnapshotFactory.java @@ -35,7 +35,7 @@ public interface FlowExecutionSnapshotFactory { * @return the new snapshot * @throws SnapshotCreationException if the snapshot could not be created */ - public FlowExecutionSnapshot createSnapshot(FlowExecution flowExecution) throws SnapshotCreationException; + FlowExecutionSnapshot createSnapshot(FlowExecution flowExecution) throws SnapshotCreationException; /** * Restores a flow execution from a previously taken snapshot. @@ -47,7 +47,7 @@ public interface FlowExecutionSnapshotFactory { * @return the restored flow execution * @throws FlowExecutionRestorationFailureException if flow execution restoration fails */ - public FlowExecution restoreExecution(FlowExecutionSnapshot snapshot, String flowId, FlowExecutionKey key, + FlowExecution restoreExecution(FlowExecutionSnapshot snapshot, String flowId, FlowExecutionKey key, MutableAttributeMap conversationScope, FlowExecutionKeyFactory keyFactory) throws FlowExecutionRestorationFailureException; } diff --git a/spring-webflow/src/main/java/org/springframework/webflow/execution/repository/support/FlowExecutionStateRestorer.java b/spring-webflow/src/main/java/org/springframework/webflow/execution/repository/support/FlowExecutionStateRestorer.java index dd8d7a36..b56513c5 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/execution/repository/support/FlowExecutionStateRestorer.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/execution/repository/support/FlowExecutionStateRestorer.java @@ -39,6 +39,6 @@ public interface FlowExecutionStateRestorer { * @param subflowDefinitionLocator for locating the definitions of any subflows started by the execution * @return the restored flow execution */ - public FlowExecution restoreState(FlowExecution execution, FlowDefinition definition, FlowExecutionKey key, + FlowExecution restoreState(FlowExecution execution, FlowDefinition definition, FlowExecutionKey key, MutableAttributeMap conversationScope, FlowDefinitionLocator subflowDefinitionLocator); -} +} diff --git a/spring-webflow/src/main/java/org/springframework/webflow/executor/FlowExecutor.java b/spring-webflow/src/main/java/org/springframework/webflow/executor/FlowExecutor.java index ebadbc23..c43fb8ec 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/executor/FlowExecutor.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/executor/FlowExecutor.java @@ -37,7 +37,7 @@ public interface FlowExecutor { * @param input input to pass to the new execution on startup (optional) * @param context access to the calling environment (required) */ - public FlowExecutionResult launchExecution(String flowId, MutableAttributeMap input, ExternalContext context) + FlowExecutionResult launchExecution(String flowId, MutableAttributeMap input, ExternalContext context) throws FlowException; /** @@ -45,6 +45,6 @@ public interface FlowExecutor { * @param flowExecutionKey the key of a paused execution of the flow definition * @param context access to the calling environment */ - public FlowExecutionResult resumeExecution(String flowExecutionKey, ExternalContext context) throws FlowException; + FlowExecutionResult resumeExecution(String flowExecutionKey, ExternalContext context) throws FlowException; } diff --git a/spring-webflow/src/main/java/org/springframework/webflow/expression/spel/ActionPropertyAccessor.java b/spring-webflow/src/main/java/org/springframework/webflow/expression/spel/ActionPropertyAccessor.java index 1cd3ca32..0bb1397a 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/expression/spel/ActionPropertyAccessor.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/expression/spel/ActionPropertyAccessor.java @@ -40,17 +40,17 @@ public class ActionPropertyAccessor implements PropertyAccessor { return new Class[] { Action.class }; } - public boolean canRead(EvaluationContext context, Object target, String name) throws AccessException { + public boolean canRead(EvaluationContext context, Object target, String name) { return true; } - public TypedValue read(EvaluationContext context, Object target, String name) throws AccessException { + public TypedValue read(EvaluationContext context, Object target, String name) { AnnotatedAction annotated = new AnnotatedAction((Action) target); annotated.setMethod(name); return new TypedValue(annotated); } - public boolean canWrite(EvaluationContext context, Object target, String name) throws AccessException { + public boolean canWrite(EvaluationContext context, Object target, String name) { return false; } diff --git a/spring-webflow/src/main/java/org/springframework/webflow/expression/spel/BeanFactoryPropertyAccessor.java b/spring-webflow/src/main/java/org/springframework/webflow/expression/spel/BeanFactoryPropertyAccessor.java index 72f0dba3..560b5d2e 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/expression/spel/BeanFactoryPropertyAccessor.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/expression/spel/BeanFactoryPropertyAccessor.java @@ -39,15 +39,15 @@ public class BeanFactoryPropertyAccessor implements PropertyAccessor { return null; } - public boolean canRead(EvaluationContext context, Object target, String name) throws AccessException { + public boolean canRead(EvaluationContext context, Object target, String name) { return getBeanFactory().containsBean(name); } - public TypedValue read(EvaluationContext context, Object target, String name) throws AccessException { + public TypedValue read(EvaluationContext context, Object target, String name) { return new TypedValue(getBeanFactory().getBean(name)); } - public boolean canWrite(EvaluationContext context, Object target, String name) throws AccessException { + public boolean canWrite(EvaluationContext context, Object target, String name) { return false; } diff --git a/spring-webflow/src/main/java/org/springframework/webflow/expression/spel/FlowVariablePropertyAccessor.java b/spring-webflow/src/main/java/org/springframework/webflow/expression/spel/FlowVariablePropertyAccessor.java index 9571e474..056a2a44 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/expression/spel/FlowVariablePropertyAccessor.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/expression/spel/FlowVariablePropertyAccessor.java @@ -71,16 +71,16 @@ public class FlowVariablePropertyAccessor implements PropertyAccessor { return null; } - public boolean canRead(EvaluationContext context, Object target, String name) throws AccessException { + public boolean canRead(EvaluationContext context, Object target, String name) { return variables.containsKey(name); } - public TypedValue read(EvaluationContext context, Object target, String name) throws AccessException { + public TypedValue read(EvaluationContext context, Object target, String name) { FlowVariableAccessor var = variables.get(name); return new TypedValue(var.getVariable()); } - public boolean canWrite(EvaluationContext context, Object target, String name) throws AccessException { + public boolean canWrite(EvaluationContext context, Object target, String name) { return false; } diff --git a/spring-webflow/src/main/java/org/springframework/webflow/expression/spel/MapAdaptablePropertyAccessor.java b/spring-webflow/src/main/java/org/springframework/webflow/expression/spel/MapAdaptablePropertyAccessor.java index 46212d6d..f5afff84 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/expression/spel/MapAdaptablePropertyAccessor.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/expression/spel/MapAdaptablePropertyAccessor.java @@ -16,7 +16,6 @@ package org.springframework.webflow.expression.spel; import org.springframework.binding.collection.MapAdaptable; -import org.springframework.expression.AccessException; import org.springframework.expression.EvaluationContext; import org.springframework.expression.PropertyAccessor; import org.springframework.expression.TypedValue; @@ -34,21 +33,21 @@ public class MapAdaptablePropertyAccessor implements PropertyAccessor { return new Class[] { MapAdaptable.class }; } - public boolean canRead(EvaluationContext context, Object target, String name) throws AccessException { + public boolean canRead(EvaluationContext context, Object target, String name) { return true; } - public TypedValue read(EvaluationContext context, Object target, String name) throws AccessException { + public TypedValue read(EvaluationContext context, Object target, String name) { MapAdaptable map = (MapAdaptable) target; return new TypedValue(map.asMap().get(name)); } - public boolean canWrite(EvaluationContext context, Object target, String name) throws AccessException { + public boolean canWrite(EvaluationContext context, Object target, String name) { return (target instanceof MutableAttributeMap); } @SuppressWarnings({ "rawtypes", "unchecked" }) - public void write(EvaluationContext context, Object target, String name, Object newValue) throws AccessException { + public void write(EvaluationContext context, Object target, String name, Object newValue) { MutableAttributeMap map = (MutableAttributeMap) target; map.put(name, newValue); } diff --git a/spring-webflow/src/main/java/org/springframework/webflow/expression/spel/MessageSourcePropertyAccessor.java b/spring-webflow/src/main/java/org/springframework/webflow/expression/spel/MessageSourcePropertyAccessor.java index b8315132..5b69540d 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/expression/spel/MessageSourcePropertyAccessor.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/expression/spel/MessageSourcePropertyAccessor.java @@ -47,15 +47,15 @@ public class MessageSourcePropertyAccessor implements PropertyAccessor { return new Class[] { MessageSource.class }; } - public boolean canRead(EvaluationContext context, Object target, String name) throws AccessException { + public boolean canRead(EvaluationContext context, Object target, String name) { return (getMessage(target, name) != null); } - public TypedValue read(EvaluationContext context, Object target, String name) throws AccessException { + public TypedValue read(EvaluationContext context, Object target, String name) { return new TypedValue(getMessage(target, name)); } - public boolean canWrite(EvaluationContext context, Object target, String name) throws AccessException { + public boolean canWrite(EvaluationContext context, Object target, String name) { return false; } diff --git a/spring-webflow/src/main/java/org/springframework/webflow/expression/spel/ScopeSearchingPropertyAccessor.java b/spring-webflow/src/main/java/org/springframework/webflow/expression/spel/ScopeSearchingPropertyAccessor.java index 9967af00..b838b9e0 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/expression/spel/ScopeSearchingPropertyAccessor.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/expression/spel/ScopeSearchingPropertyAccessor.java @@ -15,7 +15,6 @@ */ package org.springframework.webflow.expression.spel; -import org.springframework.expression.AccessException; import org.springframework.expression.EvaluationContext; import org.springframework.expression.PropertyAccessor; import org.springframework.expression.TypedValue; @@ -34,20 +33,20 @@ public class ScopeSearchingPropertyAccessor implements PropertyAccessor { return new Class[] { RequestContext.class }; } - public boolean canRead(EvaluationContext context, Object target, String name) throws AccessException { + public boolean canRead(EvaluationContext context, Object target, String name) { return (findScopeForAttribute((RequestContext) target, name) != null); } - public TypedValue read(EvaluationContext context, Object target, String name) throws AccessException { + public TypedValue read(EvaluationContext context, Object target, String name) { MutableAttributeMap scope = findScopeForAttribute((RequestContext) target, name); return new TypedValue(scope == null ? null : scope.get(name)); } - public boolean canWrite(EvaluationContext context, Object target, String name) throws AccessException { + public boolean canWrite(EvaluationContext context, Object target, String name) { return (findScopeForAttribute((RequestContext) target, name) != null); } - public void write(EvaluationContext context, Object target, String name, Object newValue) throws AccessException { + public void write(EvaluationContext context, Object target, String name, Object newValue) { MutableAttributeMap scope = findScopeForAttribute((RequestContext) target, name); if (scope != null) { scope.put(name, newValue); diff --git a/spring-webflow/src/main/java/org/springframework/webflow/mvc/servlet/FlowHandler.java b/spring-webflow/src/main/java/org/springframework/webflow/mvc/servlet/FlowHandler.java index 900bcb86..d7e13e9e 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/mvc/servlet/FlowHandler.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/mvc/servlet/FlowHandler.java @@ -41,7 +41,7 @@ public interface FlowHandler { * Returns the id of the flow handled by this handler. Used by a Controller to load the flow definition. Optional. * @return the flow id, or null if the flow id should be determined by the caller */ - public String getFlowId(); + String getFlowId(); /** * Creates the flow execution input map to pass to a new instance of the flow being started. Used by a Controller to @@ -49,7 +49,7 @@ public interface FlowHandler { * @param request the current request * @return the input map, or null if the contents of the input map should be determined by the caller */ - public MutableAttributeMap createExecutionInputMap(HttpServletRequest request); + MutableAttributeMap createExecutionInputMap(HttpServletRequest request); /** * Handles a specific flow execution outcome. Used by a Controller to get the location of the resource to redirect @@ -72,7 +72,7 @@ public interface FlowHandler { * @return the location of the new resource to redirect to, or null if the execution outcome was not handled and * should be handled by the caller */ - public String handleExecutionOutcome(FlowExecutionOutcome outcome, HttpServletRequest request, + String handleExecutionOutcome(FlowExecutionOutcome outcome, HttpServletRequest request, HttpServletResponse response); /** @@ -85,5 +85,5 @@ public interface FlowHandler { * @return the location of the error resource to redirect to, or null if the execution outcome was not handled and * should be handled by the caller */ - public String handleException(FlowException e, HttpServletRequest request, HttpServletResponse response); + String handleException(FlowException e, HttpServletRequest request, HttpServletResponse response); } diff --git a/spring-webflow/src/main/java/org/springframework/webflow/mvc/view/BindingModel.java b/spring-webflow/src/main/java/org/springframework/webflow/mvc/view/BindingModel.java index d3247157..b72d53c2 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/mvc/view/BindingModel.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/mvc/view/BindingModel.java @@ -315,23 +315,14 @@ public class BindingModel extends AbstractErrors implements BindingResult { } } - private static final MessageCriteria ERRORS_ANY_SOURCE = new MessageCriteria() { - public boolean test(Message message) { - return message.getSeverity() == Severity.ERROR; - } - }; + private static final MessageCriteria ERRORS_ANY_SOURCE = + message -> message.getSeverity() == Severity.ERROR; - private static final MessageCriteria ERRORS_WITHOUT_FIELD_SOURCE = new MessageCriteria() { - public boolean test(Message message) { - return (!message.hasField() && message.getSeverity() == Severity.ERROR); - } - }; + private static final MessageCriteria ERRORS_WITHOUT_FIELD_SOURCE = + message -> (!message.hasField() && message.getSeverity() == Severity.ERROR); - private static final MessageCriteria ERRORS_FIELD_SOURCE = new MessageCriteria() { - public boolean test(Message message) { - return (message.hasField() && message.getSeverity() == Severity.ERROR); - } - }; + private static final MessageCriteria ERRORS_FIELD_SOURCE = + message -> (message.hasField() && message.getSeverity() == Severity.ERROR); private static class FieldErrorMessage implements MessageCriteria { private String field; @@ -360,7 +351,7 @@ public class BindingModel extends AbstractErrors implements BindingResult { } } - private static interface ObjectErrorFactory { + private interface ObjectErrorFactory { T get(String objectName, Message message); } @@ -375,14 +366,11 @@ public class BindingModel extends AbstractErrors implements BindingResult { } }; - private static final ObjectErrorFactory FIELD_ERRORS = new ObjectErrorFactory() { - - public FieldError get(String objectName, Message message) { - if (message.getSource() != null) { - return new FieldError(objectName, (String) message.getSource(), message.getText()); - } - return null; + private static final ObjectErrorFactory FIELD_ERRORS = (objectName, message) -> { + if (message.getSource() != null) { + return new FieldError(objectName, (String) message.getSource(), message.getText()); } + return null; }; } diff --git a/spring-webflow/src/main/java/org/springframework/webflow/mvc/view/FlowViewResolver.java b/spring-webflow/src/main/java/org/springframework/webflow/mvc/view/FlowViewResolver.java index ce9d1b42..52e68322 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/mvc/view/FlowViewResolver.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/mvc/view/FlowViewResolver.java @@ -34,13 +34,13 @@ public interface FlowViewResolver { * @param context the current flow request * @return the resolved Spring MVC view */ - public View resolveView(String viewId, RequestContext context); + View resolveView(String viewId, RequestContext context); /** * Get the default id of the view to render in the provided view state by convention. * @param viewStateId the view state id * @return the default view id */ - public String getViewIdByConvention(String viewStateId); + String getViewIdByConvention(String viewStateId); } \ No newline at end of file diff --git a/spring-webflow/src/main/java/org/springframework/webflow/test/MockRequestControlContext.java b/spring-webflow/src/main/java/org/springframework/webflow/test/MockRequestControlContext.java index 24e0e7c6..e7bbd6b9 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/test/MockRequestControlContext.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/test/MockRequestControlContext.java @@ -144,13 +144,11 @@ public class MockRequestControlContext extends MockRequestContext implements Req // implementation specific accessors for testing public void setAlwaysRedirectOnPause(boolean alwaysRedirectOnPause) { - getMockFlowExecutionContext().getAttributeMap().put("alwaysRedirectOnPause", - Boolean.valueOf(alwaysRedirectOnPause)); + getMockFlowExecutionContext().getAttributeMap().put("alwaysRedirectOnPause", alwaysRedirectOnPause); } public void setRedirectInSameState(boolean redirectInSameState) { - getMockFlowExecutionContext().getAttributeMap() - .put("redirectInSameState", Boolean.valueOf(redirectInSameState)); + getMockFlowExecutionContext().getAttributeMap().put("redirectInSameState", redirectInSameState); } public void setEmbeddedMode() { diff --git a/spring-webflow/src/main/java/org/springframework/webflow/validation/BeanValidationHintResolver.java b/spring-webflow/src/main/java/org/springframework/webflow/validation/BeanValidationHintResolver.java index 2a8c1f85..b2fbe078 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/validation/BeanValidationHintResolver.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/validation/BeanValidationHintResolver.java @@ -52,7 +52,7 @@ public class BeanValidationHintResolver implements ValidationHintResolver { return null; } - List> result = new ArrayList>(); + List> result = new ArrayList<>(); for (String hint : hints) { if (hint.equalsIgnoreCase("Default")) { hint = "javax.validation.groups.Default"; diff --git a/spring-webflow/src/main/java/org/springframework/webflow/validation/ValidationHelper.java b/spring-webflow/src/main/java/org/springframework/webflow/validation/ValidationHelper.java index 019b733f..14c1900e 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/validation/ValidationHelper.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/validation/ValidationHelper.java @@ -192,31 +192,29 @@ public class ValidationHelper { private boolean invokeValidateMethodForCurrentState(Object model) { String methodName = "validate" + StringUtils.capitalize(requestContext.getCurrentState().getId()); // preferred - Method validateMethod = ReflectionUtils.findMethod(model.getClass(), methodName, - new Class[] { ValidationContext.class }); + Method validateMethod = ReflectionUtils.findMethod(model.getClass(), methodName, ValidationContext.class); if (validateMethod != null) { if (logger.isDebugEnabled()) { logger.debug("Invoking current state model validation method '" + methodName + "(ValidationContext)'"); } - ReflectionUtils.invokeMethod(validateMethod, model, new Object[] { new DefaultValidationContext( - requestContext, eventId, mappingResults) }); + ReflectionUtils.invokeMethod(validateMethod, model, new DefaultValidationContext(requestContext, eventId, mappingResults)); return true; } // web flow 2.0.3 or < compatibility only - validateMethod = ReflectionUtils.findMethod(model.getClass(), methodName, new Class[] { MessageContext.class }); + validateMethod = ReflectionUtils.findMethod(model.getClass(), methodName, MessageContext.class); if (validateMethod != null) { - ReflectionUtils.invokeMethod(validateMethod, model, new Object[] { requestContext.getMessageContext() }); + ReflectionUtils.invokeMethod(validateMethod, model, requestContext.getMessageContext()); return true; } // mvc 2 compatibility only - validateMethod = ReflectionUtils.findMethod(model.getClass(), methodName, new Class[] { Errors.class }); + validateMethod = ReflectionUtils.findMethod(model.getClass(), methodName, Errors.class); if (validateMethod != null) { MessageContextErrors errors = new MessageContextErrors(requestContext.getMessageContext(), modelName, model, expressionParser, messageCodesResolver, mappingResults); if (logger.isDebugEnabled()) { logger.debug("Invoking current state model validation method '" + methodName + "(Errors)'"); } - ReflectionUtils.invokeMethod(validateMethod, model, new Object[] { errors }); + ReflectionUtils.invokeMethod(validateMethod, model, errors); return true; } return false; @@ -224,25 +222,23 @@ public class ValidationHelper { private boolean invokeDefaultValidateMethod(Object model) { // preferred - Method validateMethod = ReflectionUtils.findMethod(model.getClass(), "validate", - new Class[] { ValidationContext.class }); + Method validateMethod = ReflectionUtils.findMethod(model.getClass(), "validate", ValidationContext.class); if (validateMethod != null) { if (logger.isDebugEnabled()) { logger.debug("Invoking default model validation method 'validate(ValidationContext)'"); } - ReflectionUtils.invokeMethod(validateMethod, model, new Object[] { new DefaultValidationContext( - requestContext, eventId, mappingResults) }); + ReflectionUtils.invokeMethod(validateMethod, model, new DefaultValidationContext(requestContext, eventId, mappingResults)); return true; } // mvc 2 compatibility only - validateMethod = ReflectionUtils.findMethod(model.getClass(), "validate", new Class[] { Errors.class }); + validateMethod = ReflectionUtils.findMethod(model.getClass(), "validate", Errors.class); if (validateMethod != null) { if (logger.isDebugEnabled()) { logger.debug("Invoking default model validation method 'validate(Errors)'"); } MessageContextErrors errors = new MessageContextErrors(requestContext.getMessageContext(), modelName, model, expressionParser, messageCodesResolver, mappingResults); - ReflectionUtils.invokeMethod(validateMethod, model, new Object[] { errors }); + ReflectionUtils.invokeMethod(validateMethod, model, errors); return true; } return false; @@ -274,8 +270,8 @@ public class ValidationHelper { + ClassUtils.getShortName(validator.getClass()) + "." + methodName + "(" + ClassUtils.getShortName(model.getClass()) + ", ValidationContext)'"); } - ReflectionUtils.invokeMethod(validateMethod, validator, new Object[] { model, - new DefaultValidationContext(requestContext, eventId, mappingResults) }); + ReflectionUtils.invokeMethod(validateMethod, validator, model, + new DefaultValidationContext(requestContext, eventId, mappingResults)); return true; } // mvc 2 compatibility only @@ -288,14 +284,14 @@ public class ValidationHelper { } MessageContextErrors errors = new MessageContextErrors(requestContext.getMessageContext(), modelName, model, expressionParser, messageCodesResolver, mappingResults); - ReflectionUtils.invokeMethod(validateMethod, validator, new Object[] { model, errors }); + ReflectionUtils.invokeMethod(validateMethod, validator, model, errors); return true; } // web flow 2.0.0 to 2.0.3 compatibility only [to remove in web flow 3] validateMethod = findValidationMethod(model, validator, methodName, MessageContext.class); if (validateMethod != null) { ReflectionUtils.invokeMethod(validateMethod, validator, - new Object[] { model, requestContext.getMessageContext() }); + model, requestContext.getMessageContext()); return true; } return false; @@ -339,8 +335,8 @@ public class ValidationHelper { logger.debug("Invoking default validator method '" + ClassUtils.getShortName(validator.getClass()) + ".validate(" + ClassUtils.getShortName(model.getClass()) + ", ValidationContext)'"); } - ReflectionUtils.invokeMethod(validateMethod, validator, new Object[] { model, - new DefaultValidationContext(requestContext, eventId, mappingResults) }); + ReflectionUtils.invokeMethod(validateMethod, validator, model, + new DefaultValidationContext(requestContext, eventId, mappingResults)); return true; } // mvc 2 compatibility only @@ -352,7 +348,7 @@ public class ValidationHelper { } MessageContextErrors errors = new MessageContextErrors(requestContext.getMessageContext(), modelName, model, expressionParser, messageCodesResolver, mappingResults); - ReflectionUtils.invokeMethod(validateMethod, validator, new Object[] { model, errors }); + ReflectionUtils.invokeMethod(validateMethod, validator, model, errors); return true; } return false; @@ -367,8 +363,7 @@ public class ValidationHelper { modelClass = modelClass.getSuperclass(); } for (Class searchClass : modelSearchClasses) { - Method method = ReflectionUtils.findMethod(validator.getClass(), methodName, new Class[] { searchClass, - context }); + Method method = ReflectionUtils.findMethod(validator.getClass(), methodName, searchClass, context); if (method != null) { return method; } diff --git a/spring-webflow/src/test/java/org/springframework/webflow/action/AbstractActionTests.java b/spring-webflow/src/test/java/org/springframework/webflow/action/AbstractActionTests.java index 972acd12..d3b07802 100644 --- a/spring-webflow/src/test/java/org/springframework/webflow/action/AbstractActionTests.java +++ b/spring-webflow/src/test/java/org/springframework/webflow/action/AbstractActionTests.java @@ -51,7 +51,7 @@ public class AbstractActionTests extends TestCase { public void testNormalExecute() throws Exception { action = new TestAbstractAction() { - protected Event doExecute(RequestContext context) throws Exception { + protected Event doExecute(RequestContext context) { return success(); } }; @@ -71,7 +71,7 @@ public class AbstractActionTests extends TestCase { public void testPreExecuteShortCircuit() throws Exception { action = new TestAbstractAction() { - protected Event doPreExecute(RequestContext context) throws Exception { + protected Event doPreExecute(RequestContext context) { return success(); } }; diff --git a/spring-webflow/src/test/java/org/springframework/webflow/action/CompositeActionTests.java b/spring-webflow/src/test/java/org/springframework/webflow/action/CompositeActionTests.java index 59f159a6..79e155f2 100644 --- a/spring-webflow/src/test/java/org/springframework/webflow/action/CompositeActionTests.java +++ b/spring-webflow/src/test/java/org/springframework/webflow/action/CompositeActionTests.java @@ -47,9 +47,9 @@ public class CompositeActionTests extends TestCase { LocalAttributeMap attributes = new LocalAttributeMap<>(); attributes.put("some key", "some value"); EasyMock.expect(actionMock.execute(mockRequestContext)).andReturn(new Event(this, "some event", attributes)); - EasyMock.replay(new Object[] { actionMock }); + EasyMock.replay(actionMock); Event result = tested.doExecute(mockRequestContext); - EasyMock.verify(new Object[] { actionMock }); + EasyMock.verify(actionMock); assertEquals("some event", result.getId()); assertEquals(1, result.getAttributes().size()); } @@ -58,9 +58,9 @@ public class CompositeActionTests extends TestCase { tested.setStopOnError(true); MockRequestContext mockRequestContext = new MockRequestContext(); EasyMock.expect(actionMock.execute(mockRequestContext)).andReturn(new Event(this, "error")); - EasyMock.replay(new Object[] { actionMock }); + EasyMock.replay(actionMock); Event result = tested.doExecute(mockRequestContext); - EasyMock.verify(new Object[] { actionMock }); + EasyMock.verify(actionMock); assertEquals("error", result.getId()); } @@ -68,22 +68,24 @@ public class CompositeActionTests extends TestCase { tested.setStopOnError(true); MockRequestContext mockRequestContext = new MockRequestContext(); EasyMock.expect(actionMock.execute(mockRequestContext)).andReturn(null); - EasyMock.replay(new Object[] { actionMock }); + EasyMock.replay(actionMock); Event result = tested.doExecute(mockRequestContext); - EasyMock.verify(new Object[] { actionMock }); + EasyMock.verify(actionMock); assertEquals("Expecting success since no check is performed if null result,", "success", result.getId()); } public void testMultipleActions() throws Exception { - CompositeAction ca = new CompositeAction(new Action[] { new Action() { - public Event execute(RequestContext context) throws Exception { - return new Event(this, "foo"); - } - }, new Action() { - public Event execute(RequestContext context) throws Exception { - return new Event(this, "bar"); - } - } }); + CompositeAction ca = new CompositeAction( + new Action() { + public Event execute(RequestContext context) { + return new Event(this, "foo"); + } + }, + new Action() { + public Event execute(RequestContext context) { + return new Event(this, "bar"); + } + }); assertEquals("Result of last executed action should be returned", "bar", ca.execute(new MockRequestContext()) .getId()); } diff --git a/spring-webflow/src/test/java/org/springframework/webflow/action/DispatchMethodInvokerTests.java b/spring-webflow/src/test/java/org/springframework/webflow/action/DispatchMethodInvokerTests.java index 4456b636..e51cf264 100644 --- a/spring-webflow/src/test/java/org/springframework/webflow/action/DispatchMethodInvokerTests.java +++ b/spring-webflow/src/test/java/org/springframework/webflow/action/DispatchMethodInvokerTests.java @@ -26,27 +26,27 @@ public class DispatchMethodInvokerTests extends TestCase { } public void testInvokeWithExplicitParameters() throws Exception { - DispatchMethodInvoker invoker = new DispatchMethodInvoker(mockClass, new Class[] { Object.class }); - invoker.invoke("argumentMethod", new Object[] { "testValue" }); + DispatchMethodInvoker invoker = new DispatchMethodInvoker(mockClass, Object.class); + invoker.invoke("argumentMethod", "testValue"); assertTrue("Method should have been called successfully", mockClass.getMethodCalled()); } public void testInvokeWithAssignableParameters() throws Exception { - DispatchMethodInvoker invoker = new DispatchMethodInvoker(mockClass, new Class[] { String.class }); - invoker.invoke("argumentMethod", new Object[] { "testValue" }); + DispatchMethodInvoker invoker = new DispatchMethodInvoker(mockClass, String.class); + invoker.invoke("argumentMethod", "testValue"); assertTrue("Method should have been called successfully", mockClass.getMethodCalled()); } public void testInvokeWithNoParameters() throws Exception { - DispatchMethodInvoker invoker = new DispatchMethodInvoker(mockClass, new Class[0]); - invoker.invoke("noArgumentMethod", new Object[0]); + DispatchMethodInvoker invoker = new DispatchMethodInvoker(mockClass); + invoker.invoke("noArgumentMethod"); assertTrue("Method should have been called successfully", mockClass.getMethodCalled()); } public void testInvokeWithException() { - DispatchMethodInvoker invoker = new DispatchMethodInvoker(mockClass, new Class[] { Object.class }); + DispatchMethodInvoker invoker = new DispatchMethodInvoker(mockClass, Object.class); try { - invoker.invoke("exceptionMethod", new Object[] { "testValue" }); + invoker.invoke("exceptionMethod", "testValue"); fail("Should have thrown an exception"); } catch (Exception e) { } diff --git a/spring-webflow/src/test/java/org/springframework/webflow/action/ExternalRedirectActionTests.java b/spring-webflow/src/test/java/org/springframework/webflow/action/ExternalRedirectActionTests.java index 2b1aabe9..a2a42f88 100644 --- a/spring-webflow/src/test/java/org/springframework/webflow/action/ExternalRedirectActionTests.java +++ b/spring-webflow/src/test/java/org/springframework/webflow/action/ExternalRedirectActionTests.java @@ -15,7 +15,7 @@ public class ExternalRedirectActionTests extends TestCase { assertEquals("/wherever", context.getMockExternalContext().getExternalRedirectUrl()); } - public void testExecuteWithNullResourceUri() throws Exception { + public void testExecuteWithNullResourceUri() { try { action = new ExternalRedirectAction(null); fail("Should have failed"); diff --git a/spring-webflow/src/test/java/org/springframework/webflow/action/FormActionBindingTests.java b/spring-webflow/src/test/java/org/springframework/webflow/action/FormActionBindingTests.java index f770f3e9..2c3b9aea 100644 --- a/spring-webflow/src/test/java/org/springframework/webflow/action/FormActionBindingTests.java +++ b/spring-webflow/src/test/java/org/springframework/webflow/action/FormActionBindingTests.java @@ -74,7 +74,7 @@ public class FormActionBindingTests extends TestCase { public void testFieldBinding() throws Exception { FormAction formAction = new FormAction() { - protected Object createFormObject(RequestContext context) throws Exception { + protected Object createFormObject(RequestContext context) { TestBean res = new TestBean(); res.setProp(-1L); res.otherProp = "initialValue"; @@ -93,7 +93,7 @@ public class FormActionBindingTests extends TestCase { formAction.execute(context); Errors errors = new FormObjectAccessor(context).getFormErrors("formObject", ScopeType.FLASH); assertNotNull(errors); - assertEquals(new Long(-1), errors.getFieldValue("prop")); + assertEquals((long) -1, errors.getFieldValue("prop")); // this fails because of SWF-193 assertEquals("initialValue", errors.getFieldValue("otherProp")); @@ -107,7 +107,7 @@ public class FormActionBindingTests extends TestCase { errors = new FormObjectAccessor(context).getFormErrors("formObject", ScopeType.FLASH); assertNotNull(formObject); assertEquals(new Long(1), formObject.getProp()); - assertEquals(new Long(1), errors.getFieldValue("prop")); + assertEquals(1L, errors.getFieldValue("prop")); assertEquals("value", formObject.otherProp); assertEquals("value", errors.getFieldValue("otherProp")); } diff --git a/spring-webflow/src/test/java/org/springframework/webflow/action/FormActionTests.java b/spring-webflow/src/test/java/org/springframework/webflow/action/FormActionTests.java index 3198c2ee..42c62275 100644 --- a/spring-webflow/src/test/java/org/springframework/webflow/action/FormActionTests.java +++ b/spring-webflow/src/test/java/org/springframework/webflow/action/FormActionTests.java @@ -327,7 +327,7 @@ public class FormActionTests extends TestCase { Object formObject = getFormObject(context); BindingResult errors = (BindingResult) getErrors(context); - assertTrue(formObject instanceof TestBean); + assertTrue(formObject != null); assertTrue(errors.getTarget() instanceof TestBean); assertSame(formObject, errors.getTarget()); diff --git a/spring-webflow/src/test/java/org/springframework/webflow/action/MultiActionTests.java b/spring-webflow/src/test/java/org/springframework/webflow/action/MultiActionTests.java index 2ecbd63d..9267adaf 100644 --- a/spring-webflow/src/test/java/org/springframework/webflow/action/MultiActionTests.java +++ b/spring-webflow/src/test/java/org/springframework/webflow/action/MultiActionTests.java @@ -22,7 +22,6 @@ import org.springframework.webflow.action.MultiAction.MethodResolver; import org.springframework.webflow.engine.StubViewFactory; import org.springframework.webflow.engine.ViewState; import org.springframework.webflow.execution.AnnotatedAction; -import org.springframework.webflow.execution.RequestContext; import org.springframework.webflow.test.MockFlowSession; import org.springframework.webflow.test.MockRequestContext; @@ -78,11 +77,7 @@ public class MultiActionTests extends TestCase { } public void testCustomMethodResolver() throws Exception { - MethodResolver methodResolver = new MethodResolver() { - public String resolveMethod(RequestContext context) { - return "increment"; - } - }; + MethodResolver methodResolver = context -> "increment"; action.setMethodResolver(methodResolver); action.execute(context); assertEquals(1, action.counter); diff --git a/spring-webflow/src/test/java/org/springframework/webflow/action/RenderActionTests.java b/spring-webflow/src/test/java/org/springframework/webflow/action/RenderActionTests.java index ba12f3e0..493136df 100644 --- a/spring-webflow/src/test/java/org/springframework/webflow/action/RenderActionTests.java +++ b/spring-webflow/src/test/java/org/springframework/webflow/action/RenderActionTests.java @@ -2,7 +2,6 @@ package org.springframework.webflow.action; import junit.framework.TestCase; -import org.springframework.binding.expression.Expression; import org.springframework.binding.expression.support.StaticExpression; import org.springframework.webflow.execution.Event; import org.springframework.webflow.execution.View; @@ -12,7 +11,7 @@ public class RenderActionTests extends TestCase { public void testRenderAction() throws Exception { StaticExpression name = new StaticExpression("frag1"); StaticExpression name2 = new StaticExpression("frag2"); - RenderAction action = new RenderAction(new Expression[] { name, name2 }); + RenderAction action = new RenderAction(name, name2); MockRequestContext context = new MockRequestContext(); Event result = action.execute(context); assertEquals("success", result.getId()); @@ -32,7 +31,7 @@ public class RenderActionTests extends TestCase { public void testIllegalEmptyArg() { try { - new RenderAction(new Expression[0]); + new RenderAction(); fail("iae"); } catch (IllegalArgumentException e) { diff --git a/spring-webflow/src/test/java/org/springframework/webflow/action/ResultObjectBasedEventFactoryTests.java b/spring-webflow/src/test/java/org/springframework/webflow/action/ResultObjectBasedEventFactoryTests.java index f118ef5d..04b952ba 100644 --- a/spring-webflow/src/test/java/org/springframework/webflow/action/ResultObjectBasedEventFactoryTests.java +++ b/spring-webflow/src/test/java/org/springframework/webflow/action/ResultObjectBasedEventFactoryTests.java @@ -49,7 +49,7 @@ public class ResultObjectBasedEventFactoryTests extends TestCase { assertSame(MyLabeledEnum.A, event.getAttributes().get("result")); } - public static enum MyLabeledEnum { + public enum MyLabeledEnum { A, B; } diff --git a/spring-webflow/src/test/java/org/springframework/webflow/action/ResultObjectEventFactoryTests.java b/spring-webflow/src/test/java/org/springframework/webflow/action/ResultObjectEventFactoryTests.java index a678638f..0b82d0e7 100644 --- a/spring-webflow/src/test/java/org/springframework/webflow/action/ResultObjectEventFactoryTests.java +++ b/spring-webflow/src/test/java/org/springframework/webflow/action/ResultObjectEventFactoryTests.java @@ -65,8 +65,8 @@ public class ResultObjectEventFactoryTests extends TestCase { assertEquals("hello", result.getId()); } - private static enum MyEnum { - FOO; + private enum MyEnum { + FOO } } diff --git a/spring-webflow/src/test/java/org/springframework/webflow/action/TestMultiAction.java b/spring-webflow/src/test/java/org/springframework/webflow/action/TestMultiAction.java index 28e48449..0d57b9e1 100644 --- a/spring-webflow/src/test/java/org/springframework/webflow/action/TestMultiAction.java +++ b/spring-webflow/src/test/java/org/springframework/webflow/action/TestMultiAction.java @@ -27,12 +27,12 @@ public class TestMultiAction extends MultiAction { int counter = 0; - public Event increment(RequestContext context) throws Exception { + public Event increment(RequestContext context) { counter++; return success(); } - public Event decrement(RequestContext context) throws Exception { + public Event decrement(RequestContext context) { counter--; return success(); } diff --git a/spring-webflow/src/test/java/org/springframework/webflow/config/AbstractFlowExecutorConfigurationTests.java b/spring-webflow/src/test/java/org/springframework/webflow/config/AbstractFlowExecutorConfigurationTests.java index 77154c89..2f3ecd98 100644 --- a/spring-webflow/src/test/java/org/springframework/webflow/config/AbstractFlowExecutorConfigurationTests.java +++ b/spring-webflow/src/test/java/org/springframework/webflow/config/AbstractFlowExecutorConfigurationTests.java @@ -51,7 +51,7 @@ public abstract class AbstractFlowExecutorConfigurationTests extends TestCase { assertEquals(Boolean.FALSE, attributes.getBoolean("alwaysRedirectOnPause")); assertEquals(Boolean.TRUE, attributes.getBoolean("redirectInSameState")); assertEquals("bar", attributes.get("foo")); - assertEquals(new Integer(2), attributes.get("bar")); + assertEquals(2, attributes.get("bar")); } } diff --git a/spring-webflow/src/test/java/org/springframework/webflow/config/AbstractFlowRegistryConfigurationTests.java b/spring-webflow/src/test/java/org/springframework/webflow/config/AbstractFlowRegistryConfigurationTests.java index 63342c6c..30a2b38c 100644 --- a/spring-webflow/src/test/java/org/springframework/webflow/config/AbstractFlowRegistryConfigurationTests.java +++ b/spring-webflow/src/test/java/org/springframework/webflow/config/AbstractFlowRegistryConfigurationTests.java @@ -26,7 +26,7 @@ public abstract class AbstractFlowRegistryConfigurationTests extends TestCase { FlowDefinition flow = registry.getFlowDefinition("flow"); assertEquals("flow", flow.getId()); assertEquals("bar", flow.getAttributes().get("foo")); - assertEquals(new Integer(2), flow.getAttributes().get("bar")); + assertEquals(2, flow.getAttributes().get("bar")); } public void testRegistryFlowLocationPatternsPopulated() { @@ -50,7 +50,7 @@ public abstract class AbstractFlowRegistryConfigurationTests extends TestCase { FlowDefinition foo3 = registry.getFlowDefinition("foo3"); assertEquals("foo3", foo3.getId()); assertEquals("bar", foo3.getAttributes().get("foo")); - assertEquals(new Integer(2), foo3.getAttributes().get("bar")); + assertEquals(2, foo3.getAttributes().get("bar")); } public void testNoSuchFlow() { diff --git a/spring-webflow/src/test/java/org/springframework/webflow/config/FlowBuilderServicesJavaConfigTests.java b/spring-webflow/src/test/java/org/springframework/webflow/config/FlowBuilderServicesJavaConfigTests.java index 896f0c4e..cefa360f 100644 --- a/spring-webflow/src/test/java/org/springframework/webflow/config/FlowBuilderServicesJavaConfigTests.java +++ b/spring-webflow/src/test/java/org/springframework/webflow/config/FlowBuilderServicesJavaConfigTests.java @@ -1,13 +1,9 @@ package org.springframework.webflow.config; -import java.util.HashMap; -import java.util.Map; - import org.springframework.context.ApplicationContext; import org.springframework.context.annotation.AnnotationConfigApplicationContext; import org.springframework.context.annotation.Bean; import org.springframework.expression.spel.standard.SpelExpressionParser; -import org.springframework.webflow.definition.registry.FlowDefinitionRegistry; import org.springframework.webflow.engine.builder.support.FlowBuilderServices; import org.springframework.webflow.expression.spel.WebFlowSpringELExpressionParser; diff --git a/spring-webflow/src/test/java/org/springframework/webflow/config/FlowExecutorFactoryBeanTests.java b/spring-webflow/src/test/java/org/springframework/webflow/config/FlowExecutorFactoryBeanTests.java index d3b23170..f55670fe 100644 --- a/spring-webflow/src/test/java/org/springframework/webflow/config/FlowExecutorFactoryBeanTests.java +++ b/spring-webflow/src/test/java/org/springframework/webflow/config/FlowExecutorFactoryBeanTests.java @@ -35,30 +35,24 @@ public class FlowExecutorFactoryBeanTests extends TestCase { } public void testGetFlowExecutorBasicConfig() throws Exception { - factoryBean.setFlowDefinitionLocator(new FlowDefinitionLocator() { - public FlowDefinition getFlowDefinition(String id) throws NoSuchFlowDefinitionException, - FlowDefinitionConstructionException { - Flow flow = new Flow(id); - ViewState view = new ViewState(flow, "view", new StubViewFactory()); - view.getTransitionSet().add(new Transition(new DefaultTargetStateResolver("end"))); - new EndState(flow, "end"); - return flow; - } + factoryBean.setFlowDefinitionLocator(id -> { + Flow flow = new Flow(id); + ViewState view = new ViewState(flow, "view", new StubViewFactory()); + view.getTransitionSet().add(new Transition(new DefaultTargetStateResolver("end"))); + new EndState(flow, "end"); + return flow; }); factoryBean.afterPropertiesSet(); factoryBean.getObject(); } public void testGetFlowExecutorOptionsSpecified() throws Exception { - factoryBean.setFlowDefinitionLocator(new FlowDefinitionLocator() { - public FlowDefinition getFlowDefinition(String id) throws NoSuchFlowDefinitionException, - FlowDefinitionConstructionException { - Flow flow = new Flow(id); - ViewState view = new ViewState(flow, "view", new StubViewFactory()); - view.getTransitionSet().add(new Transition(new DefaultTargetStateResolver("end"))); - new EndState(flow, "end"); - return flow; - } + factoryBean.setFlowDefinitionLocator(id -> { + Flow flow = new Flow(id); + ViewState view = new ViewState(flow, "view", new StubViewFactory()); + view.getTransitionSet().add(new Transition(new DefaultTargetStateResolver("end"))); + new EndState(flow, "end"); + return flow; }); Set attributes = new HashSet<>(); attributes.add(new FlowElementAttribute("foo", "bar", null)); diff --git a/spring-webflow/src/test/java/org/springframework/webflow/context/servlet/AbstractAjaxHandlerTests.java b/spring-webflow/src/test/java/org/springframework/webflow/context/servlet/AbstractAjaxHandlerTests.java index d82d6220..f24cab53 100644 --- a/spring-webflow/src/test/java/org/springframework/webflow/context/servlet/AbstractAjaxHandlerTests.java +++ b/spring-webflow/src/test/java/org/springframework/webflow/context/servlet/AbstractAjaxHandlerTests.java @@ -19,17 +19,17 @@ public class AbstractAjaxHandlerTests extends TestCase { response = new MockHttpServletResponse(); } - public void testIsAjaxRequest() throws Exception { + public void testIsAjaxRequest() { TestAjaxHandler handler = new TestAjaxHandler(null, true); assertTrue(handler.isAjaxRequest(request, response)); } - public void testIsNotAjaxRequest() throws Exception { + public void testIsNotAjaxRequest() { TestAjaxHandler handler = new TestAjaxHandler(null, false); assertFalse(handler.isAjaxRequest(request, response)); } - public void testIsAjaxRequestViaDelegate() throws Exception { + public void testIsAjaxRequestViaDelegate() { TestAjaxHandler handler = new TestAjaxHandler(new TestAjaxHandler(null, true), false); assertTrue(handler.isAjaxRequest(request, response)); } @@ -69,7 +69,7 @@ public class AbstractAjaxHandlerTests extends TestCase { } protected void sendAjaxRedirectInternal(String targetUrl, HttpServletRequest request, - HttpServletResponse response, boolean popup) throws IOException { + HttpServletResponse response, boolean popup) { wasAjaxRedirectInternalCalled = true; } @@ -78,11 +78,8 @@ public class AbstractAjaxHandlerTests extends TestCase { } public boolean wasAjaxRedirectInternalCalled() { - if (wasAjaxRedirectInternalCalled) { - return true; - } else { - return (getDelegate() != null) ? delegate.wasAjaxRedirectInternalCalled() : false; - } + return wasAjaxRedirectInternalCalled || + (getDelegate() != null) && delegate.wasAjaxRedirectInternalCalled(); } } diff --git a/spring-webflow/src/test/java/org/springframework/webflow/core/collection/CollectionUtilsTests.java b/spring-webflow/src/test/java/org/springframework/webflow/core/collection/CollectionUtilsTests.java index 75d4b529..5f8f92d2 100644 --- a/spring-webflow/src/test/java/org/springframework/webflow/core/collection/CollectionUtilsTests.java +++ b/spring-webflow/src/test/java/org/springframework/webflow/core/collection/CollectionUtilsTests.java @@ -23,8 +23,8 @@ import junit.framework.TestCase; public class CollectionUtilsTests extends TestCase { public void testSingleEntryMap() { - AttributeMap map1 = CollectionUtils. singleEntryMap("foo", "bar"); - AttributeMap map2 = CollectionUtils. singleEntryMap("foo", "bar"); + AttributeMap map1 = CollectionUtils.singleEntryMap("foo", "bar"); + AttributeMap map2 = CollectionUtils.singleEntryMap("foo", "bar"); assertEquals(map1, map2); } } diff --git a/spring-webflow/src/test/java/org/springframework/webflow/core/collection/LocalParameterMapTests.java b/spring-webflow/src/test/java/org/springframework/webflow/core/collection/LocalParameterMapTests.java index e5b1d707..a860594a 100644 --- a/spring-webflow/src/test/java/org/springframework/webflow/core/collection/LocalParameterMapTests.java +++ b/spring-webflow/src/test/java/org/springframework/webflow/core/collection/LocalParameterMapTests.java @@ -86,7 +86,7 @@ public class LocalParameterMapTests extends TestCase { public void testGetWithDefaultAndConversion() { Object value = parameterMap.get("bogus", Integer.class, 1); - assertEquals(new Integer(1), value); + assertEquals(1, value); } @SuppressWarnings({ "unchecked", "rawtypes" }) @@ -181,7 +181,7 @@ public class LocalParameterMapTests extends TestCase { } public void testGetNumberWithDefault() { - Integer value = parameterMap.getNumber("bogus", Integer.class, new Integer(12345)); + Integer value = parameterMap.getNumber("bogus", Integer.class, 12345); assertEquals(new Integer(12345), value); } @@ -196,7 +196,7 @@ public class LocalParameterMapTests extends TestCase { } public void testGetIntegerWithDefault() { - Integer value = parameterMap.getInteger("bogus", new Integer(12345)); + Integer value = parameterMap.getInteger("bogus", 12345); assertEquals(new Integer(12345), value); } @@ -211,7 +211,7 @@ public class LocalParameterMapTests extends TestCase { } public void testGetLongWithDefault() { - Long value = parameterMap.getLong("bogus", new Long(12345)); + Long value = parameterMap.getLong("bogus", 12345L); assertEquals(new Long(12345), value); } diff --git a/spring-webflow/src/test/java/org/springframework/webflow/engine/SubflowStateTests.java b/spring-webflow/src/test/java/org/springframework/webflow/engine/SubflowStateTests.java index b96893e9..8015f95d 100644 --- a/spring-webflow/src/test/java/org/springframework/webflow/engine/SubflowStateTests.java +++ b/spring-webflow/src/test/java/org/springframework/webflow/engine/SubflowStateTests.java @@ -67,6 +67,7 @@ public class SubflowStateTests extends TestCase { assertEquals("child", context.getActiveFlow().getId()); } + @SuppressWarnings("unchecked") public void testEnterWithInput() { subflowState.setAttributeMapper(new SubflowAttributeMapper() { public MutableAttributeMap createSubflowInput(RequestContext context) { @@ -76,13 +77,10 @@ public class SubflowStateTests extends TestCase { public void mapSubflowOutput(AttributeMap flowOutput, RequestContext context) { } }); - subflow.setInputMapper(new Mapper() { - @SuppressWarnings("unchecked") - public MappingResults map(Object source, Object target) { - MutableAttributeMap map = (MutableAttributeMap) source; - assertEquals("bar", map.get("foo")); - return new DefaultMappingResults(source, target, Collections. emptyList()); - } + subflow.setInputMapper((source, target) -> { + MutableAttributeMap map = (MutableAttributeMap) source; + assertEquals("bar", map.get("foo")); + return new DefaultMappingResults(source, target, Collections.emptyList()); }); new State(subflow, "whatev") { protected void doEnter(RequestControlContext context) throws FlowExecutionException { @@ -92,6 +90,7 @@ public class SubflowStateTests extends TestCase { assertEquals("child", context.getActiveFlow().getId()); } + @SuppressWarnings("unchecked") public void testReturnWithOutput() { subflowState.setAttributeMapper(new SubflowAttributeMapper() { public MutableAttributeMap createSubflowInput(RequestContext context) { @@ -108,13 +107,10 @@ public class SubflowStateTests extends TestCase { } }; new EndState(subflow, "end"); - subflow.setOutputMapper(new Mapper() { - @SuppressWarnings("unchecked") - public MappingResults map(Object source, Object target) { - MutableAttributeMap map = (MutableAttributeMap) target; - map.put("foo", "bar"); - return new DefaultMappingResults(source, target, Collections. emptyList()); - } + subflow.setOutputMapper((source, target) -> { + MutableAttributeMap map = (MutableAttributeMap) target; + map.put("foo", "bar"); + return new DefaultMappingResults(source, target, Collections.emptyList()); }); subflowState.enter(context); assertEquals("parent", context.getActiveFlow().getId()); diff --git a/spring-webflow/src/test/java/org/springframework/webflow/engine/TransitionTests.java b/spring-webflow/src/test/java/org/springframework/webflow/engine/TransitionTests.java index 1b799c9d..a0515520 100644 --- a/spring-webflow/src/test/java/org/springframework/webflow/engine/TransitionTests.java +++ b/spring-webflow/src/test/java/org/springframework/webflow/engine/TransitionTests.java @@ -40,11 +40,9 @@ public class TransitionTests extends TestCase { protected void doEnter(RequestControlContext context) throws FlowExecutionException { } }; - TargetStateResolver targetResolver = new TargetStateResolver() { - public State resolveTargetState(Transition transition, State sourceState, RequestContext context) { - assertSame(source, sourceState); - return target; - } + TargetStateResolver targetResolver = (transition, sourceState, context) -> { + assertSame(source, sourceState); + return target; }; MockRequestControlContext context = new MockRequestControlContext(flow); context.setCurrentState(source); @@ -61,11 +59,9 @@ public class TransitionTests extends TestCase { protected void doEnter(RequestControlContext context) throws FlowExecutionException { } }; - TargetStateResolver targetResolver = new TargetStateResolver() { - public State resolveTargetState(Transition transition, State sourceState, RequestContext context) { - assertNull(sourceState); - return target; - } + TargetStateResolver targetResolver = (transition, sourceState, context) -> { + assertNull(sourceState); + return target; }; MockRequestControlContext context = new MockRequestControlContext(flow); Transition t = new Transition(targetResolver); @@ -84,11 +80,7 @@ public class TransitionTests extends TestCase { protected void doEnter(RequestControlContext context) throws FlowExecutionException { } }; - TargetStateResolver targetResolver = new TargetStateResolver() { - public State resolveTargetState(Transition transition, State sourceState, RequestContext context) { - return null; - } - }; + TargetStateResolver targetResolver = (transition, sourceState, context) -> null; MockRequestControlContext context = new MockRequestControlContext(flow); context.setCurrentState(source); Transition t = new Transition(targetResolver); @@ -131,20 +123,14 @@ public class TransitionTests extends TestCase { protected void doEnter(RequestControlContext context) throws FlowExecutionException { } }; - TargetStateResolver targetResolver = new TargetStateResolver() { - public State resolveTargetState(Transition transition, State sourceState, RequestContext context) { - assertSame(source, sourceState); - return target; - } + TargetStateResolver targetResolver = (transition, sourceState, context) -> { + assertSame(source, sourceState); + return target; }; MockRequestControlContext context = new MockRequestControlContext(flow); context.setCurrentState(source); Transition t = new Transition(targetResolver); - t.setExecutionCriteria(new TransitionCriteria() { - public boolean test(RequestContext context) { - return false; - } - }); + t.setExecutionCriteria(context1 -> false); boolean stateExited = t.execute(source, context); assertFalse(stateExited); assertFalse(exitCalled); diff --git a/spring-webflow/src/test/java/org/springframework/webflow/engine/builder/DefaultFlowHolderTests.java b/spring-webflow/src/test/java/org/springframework/webflow/engine/builder/DefaultFlowHolderTests.java index f14417b3..618fa878 100644 --- a/spring-webflow/src/test/java/org/springframework/webflow/engine/builder/DefaultFlowHolderTests.java +++ b/spring-webflow/src/test/java/org/springframework/webflow/engine/builder/DefaultFlowHolderTests.java @@ -32,7 +32,6 @@ public class DefaultFlowHolderTests extends TestCase { assembler = new FlowAssembler(new ChangeDetectableFlowBuilder(), new MockFlowBuilderContext("flowId")); holder = new DefaultFlowHolder(assembler); FlowDefinition flow = holder.getFlowDefinition(); - flow = holder.getFlowDefinition(); assertEquals("flowId", flow.getId()); assertEquals("end", flow.getStartState().getId()); } diff --git a/spring-webflow/src/test/java/org/springframework/webflow/engine/builder/FlowAssemblerTests.java b/spring-webflow/src/test/java/org/springframework/webflow/engine/builder/FlowAssemblerTests.java index 638e7911..f156bcb6 100644 --- a/spring-webflow/src/test/java/org/springframework/webflow/engine/builder/FlowAssemblerTests.java +++ b/spring-webflow/src/test/java/org/springframework/webflow/engine/builder/FlowAssemblerTests.java @@ -29,22 +29,22 @@ public class FlowAssemblerTests extends TestCase { builder.buildOutputMapper(); builder.buildExceptionHandlers(); EasyMock.expect(builder.getFlow()).andReturn(new Flow("search")); - EasyMock.replay(new Object[] { builder }); + EasyMock.replay(builder); Flow flow = assembler.assembleFlow(); assertEquals("search", flow.getId()); - EasyMock.verify(new Object[] { builder }); + EasyMock.verify(builder); } public void testDisposeCalledOnException() { builder.init(builderContext); EasyMock.expectLastCall().andThrow(new IllegalArgumentException()); builder.dispose(); - EasyMock.replay(new Object[] { builder }); + EasyMock.replay(builder); try { assembler.assembleFlow(); fail("Should have failed"); } catch (IllegalArgumentException e) { - EasyMock.verify(new Object[] { builder }); + EasyMock.verify(builder); } } } diff --git a/spring-webflow/src/test/java/org/springframework/webflow/engine/builder/model/FlowModelFlowBuilderTests.java b/spring-webflow/src/test/java/org/springframework/webflow/engine/builder/model/FlowModelFlowBuilderTests.java index 61a81daf..d2d43710 100644 --- a/spring-webflow/src/test/java/org/springframework/webflow/engine/builder/model/FlowModelFlowBuilderTests.java +++ b/spring-webflow/src/test/java/org/springframework/webflow/engine/builder/model/FlowModelFlowBuilderTests.java @@ -102,7 +102,7 @@ public class FlowModelFlowBuilderTests extends TestCase { model.setStates(asList(AbstractStateModel.class, new EndStateModel("end"))); Flow flow = getFlow(model); assertEquals("bar", flow.getAttributes().get("foo")); - assertEquals(new Integer(1), flow.getAttributes().get("number")); + assertEquals(1, flow.getAttributes().get("number")); } public void testPersistenceContextFlow() { @@ -152,8 +152,8 @@ public class FlowModelFlowBuilderTests extends TestCase { assertEquals("end", outcome.getId()); assertEquals("bar", outcome.getOutput().get("foo")); assertEquals("bar", outcome.getOutput().get("differentName")); - assertEquals(new Integer(3), outcome.getOutput().get("number")); - assertEquals(new Integer(3), outcome.getOutput().get("required")); + assertEquals(3, outcome.getOutput().get("number")); + assertEquals(3, outcome.getOutput().get("required")); assertEquals("a literal", outcome.getOutput().get("literal")); assertNull(outcome.getOutput().get("notReached")); } diff --git a/spring-webflow/src/test/java/org/springframework/webflow/engine/builder/support/TextToTransitionCriteriaTests.java b/spring-webflow/src/test/java/org/springframework/webflow/engine/builder/support/TextToTransitionCriteriaTests.java index c146bde4..f1375e58 100644 --- a/spring-webflow/src/test/java/org/springframework/webflow/engine/builder/support/TextToTransitionCriteriaTests.java +++ b/spring-webflow/src/test/java/org/springframework/webflow/engine/builder/support/TextToTransitionCriteriaTests.java @@ -37,7 +37,7 @@ public class TextToTransitionCriteriaTests extends TestCase { private TextToTransitionCriteria converter = new TextToTransitionCriteria(serviceLocator); @Override - protected void tearDown() throws Exception { + protected void tearDown() { RequestContextHolder.setRequestContext(null); } @@ -98,11 +98,8 @@ public class TextToTransitionCriteriaTests extends TestCase { } public void testNullExpressionEvaluation() throws Exception { - serviceLocator.getFlowBuilderServices().setExpressionParser(new ExpressionParser() { - public Expression parseExpression(String expressionString, ParserContext context) throws ParserException { - return new StaticExpression(null); - } - }); + serviceLocator.getFlowBuilderServices() + .setExpressionParser((expressionString, context) -> new StaticExpression(null)); TransitionCriteria criterion = (TransitionCriteria) converter.convertSourceToTargetClass("doesnt matter", TransitionCriteria.class); RequestContext ctx = getRequestContext(); diff --git a/spring-webflow/src/test/java/org/springframework/webflow/engine/impl/FlowExecutionImplFactoryTests.java b/spring-webflow/src/test/java/org/springframework/webflow/engine/impl/FlowExecutionImplFactoryTests.java index da3acbe6..9ed405e2 100644 --- a/spring-webflow/src/test/java/org/springframework/webflow/engine/impl/FlowExecutionImplFactoryTests.java +++ b/spring-webflow/src/test/java/org/springframework/webflow/engine/impl/FlowExecutionImplFactoryTests.java @@ -149,11 +149,11 @@ public class FlowExecutionImplFactoryTests extends TestCase { assertSame(flowExecutionKey, flowExecution.getKey()); assertSame(keyFactory, flowExecution.getKeyFactory()); assertSame(conversationScope, flowExecution.getConversationScope()); - assertSame(((FlowSession) flowExecution.getFlowSessions().get(0)).getDefinition(), flowDefinition); - assertSame(((FlowSession) flowExecution.getFlowSessions().get(0)).getDefinition().getState("end"), + assertSame(flowExecution.getFlowSessions().get(0).getDefinition(), flowDefinition); + assertSame(flowExecution.getFlowSessions().get(0).getDefinition().getState("end"), flowDefinition.getState("end")); - assertSame(((FlowSession) flowExecution.getFlowSessions().get(1)).getDefinition(), locator.child); - assertSame(((FlowSession) flowExecution.getFlowSessions().get(1)).getDefinition().getState("state"), + assertSame(flowExecution.getFlowSessions().get(1).getDefinition(), locator.child); + assertSame(flowExecution.getFlowSessions().get(1).getDefinition().getState("state"), locator.child.getState("state")); } diff --git a/spring-webflow/src/test/java/org/springframework/webflow/engine/impl/FlowExecutionImplTests.java b/spring-webflow/src/test/java/org/springframework/webflow/engine/impl/FlowExecutionImplTests.java index df76ccd1..35c67178 100644 --- a/spring-webflow/src/test/java/org/springframework/webflow/engine/impl/FlowExecutionImplTests.java +++ b/spring-webflow/src/test/java/org/springframework/webflow/engine/impl/FlowExecutionImplTests.java @@ -49,6 +49,7 @@ import org.springframework.webflow.test.MockFlowExecutionKeyFactory; */ public class FlowExecutionImplTests extends TestCase { + public void testStartAndEnd() { Flow flow = new Flow("flow"); new EndState(flow, "end"); @@ -474,4 +475,4 @@ public class FlowExecutionImplTests extends TestCase { } -} +} diff --git a/spring-webflow/src/test/java/org/springframework/webflow/engine/model/builder/xml/WebFlowEntityResolverTests.java b/spring-webflow/src/test/java/org/springframework/webflow/engine/model/builder/xml/WebFlowEntityResolverTests.java index 52d312b4..31fe9fb3 100644 --- a/spring-webflow/src/test/java/org/springframework/webflow/engine/model/builder/xml/WebFlowEntityResolverTests.java +++ b/spring-webflow/src/test/java/org/springframework/webflow/engine/model/builder/xml/WebFlowEntityResolverTests.java @@ -8,21 +8,21 @@ public class WebFlowEntityResolverTests extends TestCase { private static final String PUBLIC_ID = "http://www.springframework.org/schema/webflow"; - public void testResolve24() throws Exception { + public void testResolve24() { WebFlowEntityResolver resolver = new WebFlowEntityResolver(); InputSource source = resolver.resolveEntity(PUBLIC_ID, "http://www.springframework.org/schema/webflow/spring-webflow-2.4.xsd"); assertNotNull(source); } - public void testResolve20() throws Exception { + public void testResolve20() { WebFlowEntityResolver resolver = new WebFlowEntityResolver(); InputSource source = resolver.resolveEntity(PUBLIC_ID, "http://www.springframework.org/schema/webflow/spring-webflow-2.0.xsd"); assertNotNull(source); } - public void testResolveLatest() throws Exception { + public void testResolveLatest() { WebFlowEntityResolver resolver = new WebFlowEntityResolver(); InputSource source = resolver.resolveEntity(PUBLIC_ID, "http://www.springframework.org/schema/webflow/spring-webflow.xsd"); diff --git a/spring-webflow/src/test/java/org/springframework/webflow/engine/model/registry/DefaultFlowModelHolderTests.java b/spring-webflow/src/test/java/org/springframework/webflow/engine/model/registry/DefaultFlowModelHolderTests.java index 42ebeb1d..cac0fe64 100644 --- a/spring-webflow/src/test/java/org/springframework/webflow/engine/model/registry/DefaultFlowModelHolderTests.java +++ b/spring-webflow/src/test/java/org/springframework/webflow/engine/model/registry/DefaultFlowModelHolderTests.java @@ -6,7 +6,6 @@ import java.util.LinkedList; import junit.framework.TestCase; import org.springframework.core.io.Resource; -import org.springframework.webflow.engine.model.AbstractStateModel; import org.springframework.webflow.engine.model.EndStateModel; import org.springframework.webflow.engine.model.FlowModel; import org.springframework.webflow.engine.model.builder.DefaultFlowModelHolder; diff --git a/spring-webflow/src/test/java/org/springframework/webflow/engine/support/ActionTransitionCriteriaTests.java b/spring-webflow/src/test/java/org/springframework/webflow/engine/support/ActionTransitionCriteriaTests.java index 00ace6a2..a2196441 100644 --- a/spring-webflow/src/test/java/org/springframework/webflow/engine/support/ActionTransitionCriteriaTests.java +++ b/spring-webflow/src/test/java/org/springframework/webflow/engine/support/ActionTransitionCriteriaTests.java @@ -31,24 +31,24 @@ public class ActionTransitionCriteriaTests extends TestCase { criteria = new ActionTransitionCriteria(action); } - public void testExecuteSuccessResult() throws Exception { + public void testExecuteSuccessResult() { MockRequestContext context = new MockRequestContext(); assertTrue(criteria.test(context)); } - public void testExecuteTrueResult() throws Exception { + public void testExecuteTrueResult() { action.setResultEventId("true"); MockRequestContext context = new MockRequestContext(); assertTrue(criteria.test(context)); } - public void testExecuteYesResult() throws Exception { + public void testExecuteYesResult() { action.setResultEventId("yes"); MockRequestContext context = new MockRequestContext(); assertTrue(criteria.test(context)); } - public void testExecuteErrorResult() throws Exception { + public void testExecuteErrorResult() { action.setResultEventId("whatever"); MockRequestContext context = new MockRequestContext(); assertFalse(criteria.test(context)); diff --git a/spring-webflow/src/test/java/org/springframework/webflow/execution/factory/FlowExecutionListenerCriteriaFactoryTests.java b/spring-webflow/src/test/java/org/springframework/webflow/execution/factory/FlowExecutionListenerCriteriaFactoryTests.java index f1d13d19..5885125d 100644 --- a/spring-webflow/src/test/java/org/springframework/webflow/execution/factory/FlowExecutionListenerCriteriaFactoryTests.java +++ b/spring-webflow/src/test/java/org/springframework/webflow/execution/factory/FlowExecutionListenerCriteriaFactoryTests.java @@ -38,7 +38,7 @@ public class FlowExecutionListenerCriteriaFactoryTests extends TestCase { } public void testMultipleFlowMatch() { - FlowExecutionListenerCriteria c = factory.flows(new String[] { "foo", "bar" }); + FlowExecutionListenerCriteria c = factory.flows("foo", "bar"); assertEquals(true, c.appliesTo(new Flow("foo"))); assertEquals(true, c.appliesTo(new Flow("bar"))); assertEquals(false, c.appliesTo(new Flow("baz"))); diff --git a/spring-webflow/src/test/java/org/springframework/webflow/execution/factory/StaticFlowExecutionListenerLoaderTests.java b/spring-webflow/src/test/java/org/springframework/webflow/execution/factory/StaticFlowExecutionListenerLoaderTests.java index ff40cf25..333df446 100644 --- a/spring-webflow/src/test/java/org/springframework/webflow/execution/factory/StaticFlowExecutionListenerLoaderTests.java +++ b/spring-webflow/src/test/java/org/springframework/webflow/execution/factory/StaticFlowExecutionListenerLoaderTests.java @@ -46,7 +46,7 @@ public class StaticFlowExecutionListenerLoaderTests extends TestCase { final FlowExecutionListener listener2 = new FlowExecutionListenerAdapter() { }; - loader = new StaticFlowExecutionListenerLoader(new FlowExecutionListener[] { listener1, listener2 }); + loader = new StaticFlowExecutionListenerLoader(listener1, listener2); assertEquals(listener1, loader.getListeners(new Flow("foo"))[0]); assertEquals(listener2, loader.getListeners(new Flow("foo"))[1]); } diff --git a/spring-webflow/src/test/java/org/springframework/webflow/execution/repository/impl/DefaultFlowExecutionRepositoryTests.java b/spring-webflow/src/test/java/org/springframework/webflow/execution/repository/impl/DefaultFlowExecutionRepositoryTests.java index 791e7847..21515d24 100644 --- a/spring-webflow/src/test/java/org/springframework/webflow/execution/repository/impl/DefaultFlowExecutionRepositoryTests.java +++ b/spring-webflow/src/test/java/org/springframework/webflow/execution/repository/impl/DefaultFlowExecutionRepositoryTests.java @@ -45,12 +45,7 @@ public class DefaultFlowExecutionRepositoryTests extends TestCase { new ViewState(flow, "state2", new StubViewFactory()); conversationManager = new StubConversationManager(); - FlowDefinitionLocator locator = new FlowDefinitionLocator() { - public FlowDefinition getFlowDefinition(String flowId) throws NoSuchFlowDefinitionException, - FlowDefinitionConstructionException { - return flow; - } - }; + FlowDefinitionLocator locator = flowId -> flow; SerializedFlowExecutionSnapshotFactory snapshotFactory = new SerializedFlowExecutionSnapshotFactory( executionFactory, locator); repository = new DefaultFlowExecutionRepository(conversationManager, snapshotFactory); diff --git a/spring-webflow/src/test/java/org/springframework/webflow/execution/repository/impl/SimpleFlowExecutionSnapshotGroupTests.java b/spring-webflow/src/test/java/org/springframework/webflow/execution/repository/impl/SimpleFlowExecutionSnapshotGroupTests.java index c40ff938..9f35c69a 100644 --- a/spring-webflow/src/test/java/org/springframework/webflow/execution/repository/impl/SimpleFlowExecutionSnapshotGroupTests.java +++ b/spring-webflow/src/test/java/org/springframework/webflow/execution/repository/impl/SimpleFlowExecutionSnapshotGroupTests.java @@ -26,7 +26,7 @@ public class SimpleFlowExecutionSnapshotGroupTests extends TestCase { public void testInitialState() { assertEquals(0, group.getSnapshotCount()); assertEquals(-1, group.getMaxSnapshots()); - assertEquals(new Integer(1), group.nextSnapshotId()); + assertEquals(1, group.nextSnapshotId()); } public void testGetSnapshot() { @@ -45,8 +45,8 @@ public class SimpleFlowExecutionSnapshotGroupTests extends TestCase { } public void testNextSnapshotId() { - assertEquals(new Integer(1), group.nextSnapshotId()); - assertEquals(new Integer(2), group.nextSnapshotId()); + assertEquals(1, group.nextSnapshotId()); + assertEquals(2, group.nextSnapshotId()); } public void testAddMaximumReached() { diff --git a/spring-webflow/src/test/java/org/springframework/webflow/execution/repository/snapshot/SerializedFlowExecutionSnapshotFactoryTests.java b/spring-webflow/src/test/java/org/springframework/webflow/execution/repository/snapshot/SerializedFlowExecutionSnapshotFactoryTests.java index a3532bf9..a3f1711c 100644 --- a/spring-webflow/src/test/java/org/springframework/webflow/execution/repository/snapshot/SerializedFlowExecutionSnapshotFactoryTests.java +++ b/spring-webflow/src/test/java/org/springframework/webflow/execution/repository/snapshot/SerializedFlowExecutionSnapshotFactoryTests.java @@ -2,23 +2,18 @@ package org.springframework.webflow.execution.repository.snapshot; import junit.framework.TestCase; -import org.springframework.webflow.definition.FlowDefinition; -import org.springframework.webflow.definition.registry.FlowDefinitionConstructionException; import org.springframework.webflow.definition.registry.FlowDefinitionLocator; -import org.springframework.webflow.definition.registry.NoSuchFlowDefinitionException; import org.springframework.webflow.engine.Flow; import org.springframework.webflow.engine.RequestControlContext; import org.springframework.webflow.engine.State; import org.springframework.webflow.engine.impl.FlowExecutionImpl; import org.springframework.webflow.engine.impl.FlowExecutionImplFactory; import org.springframework.webflow.execution.FlowExecutionException; -import org.springframework.webflow.execution.FlowExecutionKeyFactory; import org.springframework.webflow.test.MockExternalContext; public class SerializedFlowExecutionSnapshotFactoryTests extends TestCase { private Flow flow; private SerializedFlowExecutionSnapshotFactory factory; - private FlowExecutionKeyFactory executionKeyFactory; private FlowExecutionImplFactory executionFactory; public void setUp() { @@ -27,14 +22,9 @@ public class SerializedFlowExecutionSnapshotFactoryTests extends TestCase { protected void doEnter(RequestControlContext context) throws FlowExecutionException { } }; - FlowDefinitionLocator locator = new FlowDefinitionLocator() { - public FlowDefinition getFlowDefinition(String flowId) throws NoSuchFlowDefinitionException, - FlowDefinitionConstructionException { - return flow; - } - }; + FlowDefinitionLocator locator = flowId -> flow; executionFactory = new FlowExecutionImplFactory(); - executionFactory.setExecutionKeyFactory(executionKeyFactory); + executionFactory.setExecutionKeyFactory(null); factory = new SerializedFlowExecutionSnapshotFactory(executionFactory, locator); } @@ -44,7 +34,7 @@ public class SerializedFlowExecutionSnapshotFactoryTests extends TestCase { flowExecution.getActiveSession().getScope().put("foo", "bar"); FlowExecutionSnapshot snapshot = factory.createSnapshot(flowExecution); FlowExecutionImpl flowExecution2 = (FlowExecutionImpl) factory.restoreExecution(snapshot, "myFlow", null, - flowExecution.getConversationScope(), executionKeyFactory); + flowExecution.getConversationScope(), null); assertNotSame(flowExecution, flowExecution2); assertEquals(flowExecution.getDefinition().getId(), flowExecution2.getDefinition().getId()); assertEquals(flowExecution.getActiveSession().getScope().get("foo"), flowExecution2.getActiveSession() diff --git a/spring-webflow/src/test/java/org/springframework/webflow/executor/FlowExecutorImplTests.java b/spring-webflow/src/test/java/org/springframework/webflow/executor/FlowExecutorImplTests.java index ad1fd45c..083f682b 100644 --- a/spring-webflow/src/test/java/org/springframework/webflow/executor/FlowExecutorImplTests.java +++ b/spring-webflow/src/test/java/org/springframework/webflow/executor/FlowExecutorImplTests.java @@ -184,10 +184,10 @@ public class FlowExecutorImplTests extends TestCase { } private void replayMocks() { - EasyMock.replay(new Object[] { locator, definition, factory, execution, repository, lock }); + EasyMock.replay(locator, definition, factory, execution, repository, lock); } private void verifyMocks() { - EasyMock.verify(new Object[] { locator, definition, factory, execution, repository, lock }); + EasyMock.verify(locator, definition, factory, execution, repository, lock); } } diff --git a/spring-webflow/src/test/java/org/springframework/webflow/expression/el/FlowDependentELResolverTestCase.java b/spring-webflow/src/test/java/org/springframework/webflow/expression/el/FlowDependentELResolverTestCase.java index 384a7950..0df669df 100644 --- a/spring-webflow/src/test/java/org/springframework/webflow/expression/el/FlowDependentELResolverTestCase.java +++ b/spring-webflow/src/test/java/org/springframework/webflow/expression/el/FlowDependentELResolverTestCase.java @@ -1,7 +1,6 @@ package org.springframework.webflow.expression.el; import java.util.List; - import javax.el.ELContext; import javax.el.ELResolver; @@ -10,10 +9,7 @@ import junit.framework.TestCase; import org.springframework.binding.expression.el.DefaultELContext; import org.springframework.binding.expression.el.DefaultELResolver; import org.springframework.webflow.engine.ViewState; -import org.springframework.webflow.execution.RequestContext; import org.springframework.webflow.execution.RequestContextHolder; -import org.springframework.webflow.execution.View; -import org.springframework.webflow.execution.ViewFactory; import org.springframework.webflow.test.MockFlowSession; import org.springframework.webflow.test.MockRequestContext; @@ -54,10 +50,8 @@ public abstract class FlowDependentELResolverTestCase extends TestCase { protected void initView(MockRequestContext requestContext) { ((MockFlowSession) requestContext.getFlowExecutionContext().getActiveSession()).setState(new ViewState( - requestContext.getRootFlow(), "view", new ViewFactory() { - public View getView(RequestContext context) { - throw new UnsupportedOperationException("Auto-generated method stub"); - } + requestContext.getRootFlow(), "view", context -> { + throw new UnsupportedOperationException("Auto-generated method stub"); })); } diff --git a/spring-webflow/src/test/java/org/springframework/webflow/expression/spel/WebFlowSpringELExpressionParserTests.java b/spring-webflow/src/test/java/org/springframework/webflow/expression/spel/WebFlowSpringELExpressionParserTests.java index 342bc30c..5cbc2727 100644 --- a/spring-webflow/src/test/java/org/springframework/webflow/expression/spel/WebFlowSpringELExpressionParserTests.java +++ b/spring-webflow/src/test/java/org/springframework/webflow/expression/spel/WebFlowSpringELExpressionParserTests.java @@ -47,7 +47,7 @@ public class WebFlowSpringELExpressionParserTests extends TestCase { RequestContextHolder.setRequestContext(null); } - public void testResourceBundleRead() throws Exception { + public void testResourceBundleRead() { MockExternalContext externalContext = (MockExternalContext) requestContext.getExternalContext(); externalContext.setLocale(Locale.ENGLISH); diff --git a/spring-webflow/src/test/java/org/springframework/webflow/mvc/servlet/FlowControllerTests.java b/spring-webflow/src/test/java/org/springframework/webflow/mvc/servlet/FlowControllerTests.java index 2f605bd8..882cfce5 100644 --- a/spring-webflow/src/test/java/org/springframework/webflow/mvc/servlet/FlowControllerTests.java +++ b/spring-webflow/src/test/java/org/springframework/webflow/mvc/servlet/FlowControllerTests.java @@ -67,10 +67,10 @@ public class FlowControllerTests extends TestCase { executor.launchExecution("foo", null, context); FlowExecutionResult result = FlowExecutionResult.createPausedResult("foo", "12345"); EasyMock.expectLastCall().andReturn(result); - EasyMock.replay(new Object[] { executor }); + EasyMock.replay(executor); ModelAndView mv = controller.handleRequest(request, response); assertNull(mv); - EasyMock.verify(new Object[] { executor }); + EasyMock.verify(executor); } public void testLaunchFlowRequestEndsAfterProcessing() throws Exception { @@ -85,11 +85,11 @@ public class FlowControllerTests extends TestCase { FlowExecutionOutcome outcome = new FlowExecutionOutcome("finish", output); FlowExecutionResult result = FlowExecutionResult.createEndedResult("foo", outcome); EasyMock.expectLastCall().andReturn(result); - EasyMock.replay(new Object[] { executor }); + EasyMock.replay(executor); ModelAndView mv = controller.handleRequest(request, response); assertNull(mv); assertEquals("/springtravel/app/foo?bar=baz", response.getRedirectedUrl()); - EasyMock.verify(new Object[] { executor }); + EasyMock.verify(executor); } public void testResumeFlowRequest() throws Exception { @@ -104,10 +104,10 @@ public class FlowControllerTests extends TestCase { executor.resumeExecution("12345", context); FlowExecutionResult result = FlowExecutionResult.createPausedResult("foo", "123456"); EasyMock.expectLastCall().andReturn(result); - EasyMock.replay(new Object[] { executor }); + EasyMock.replay(executor); ModelAndView mv = controller.handleRequest(request, response); assertNull(mv); - EasyMock.verify(new Object[] { executor }); + EasyMock.verify(executor); } public void testResumeFlowRequestEndsAfterProcessing() throws Exception { @@ -125,11 +125,11 @@ public class FlowControllerTests extends TestCase { FlowExecutionOutcome outcome = new FlowExecutionOutcome("finish", output); FlowExecutionResult result = FlowExecutionResult.createEndedResult("foo", outcome); EasyMock.expectLastCall().andReturn(result); - EasyMock.replay(new Object[] { executor }); + EasyMock.replay(executor); ModelAndView mv = controller.handleRequest(request, response); assertNull(mv); assertEquals("/springtravel/app/foo?bar=baz", response.getRedirectedUrl()); - EasyMock.verify(new Object[] { executor }); + EasyMock.verify(executor); } public void testLaunchFlowWithExecutionRedirect() throws Exception { @@ -142,11 +142,11 @@ public class FlowControllerTests extends TestCase { executor.launchExecution("foo", null, context); FlowExecutionResult result = FlowExecutionResult.createPausedResult("foo", "12345"); EasyMock.expectLastCall().andReturn(result); - EasyMock.replay(new Object[] { executor }); + EasyMock.replay(executor); ModelAndView mv = controller.handleRequest(request, response); assertNull(mv); assertEquals("/springtravel/app/foo?execution=12345", response.getRedirectedUrl()); - EasyMock.verify(new Object[] { executor }); + EasyMock.verify(executor); } public void testLaunchFlowWithExecutionRedirectAjaxHeaderOpenInPopup() throws Exception { @@ -162,14 +162,14 @@ public class FlowControllerTests extends TestCase { executor.launchExecution("foo", null, context); FlowExecutionResult result = FlowExecutionResult.createPausedResult("foo", "12345"); EasyMock.expectLastCall().andReturn(result); - EasyMock.replay(new Object[] { executor }); + EasyMock.replay(executor); ModelAndView mv = controller.handleRequest(request, response); assertNull(mv); assertEquals(null, response.getRedirectedUrl()); assertEquals("true", response.getHeader(DefaultAjaxHandler.POPUP_VIEW_HEADER)); assertEquals("/springtravel/app/foo?execution=12345", response.getHeader(DefaultAjaxHandler.REDIRECT_URL_HEADER)); - EasyMock.verify(new Object[] { executor }); + EasyMock.verify(executor); } public void testLaunchFlowWithExecutionRedirectAjaxParameter() throws Exception { @@ -186,14 +186,14 @@ public class FlowControllerTests extends TestCase { executor.launchExecution("foo", inputMap, context); FlowExecutionResult result = FlowExecutionResult.createPausedResult("foo", "12345"); EasyMock.expectLastCall().andReturn(result); - EasyMock.replay(new Object[] { executor }); + EasyMock.replay(executor); ModelAndView mv = controller.handleRequest(request, response); assertNull(mv); assertEquals(null, response.getRedirectedUrl()); assertEquals(null, response.getHeader(DefaultAjaxHandler.POPUP_VIEW_HEADER)); assertEquals("/springtravel/app/foo?execution=12345", response.getHeader(DefaultAjaxHandler.REDIRECT_URL_HEADER)); - EasyMock.verify(new Object[] { executor }); + EasyMock.verify(executor); } public void testLaunchFlowWithDefinitionRedirect() throws Exception { @@ -211,12 +211,12 @@ public class FlowControllerTests extends TestCase { FlowExecutionOutcome outcome = new FlowExecutionOutcome("finish", output); FlowExecutionResult result = FlowExecutionResult.createEndedResult("foo", outcome); EasyMock.expectLastCall().andReturn(result); - EasyMock.replay(new Object[] { executor }); + EasyMock.replay(executor); ModelAndView mv = controller.handleRequest(request, response); assertNull(mv); - EasyMock.verify(new Object[] { executor }); + EasyMock.verify(executor); assertEquals("/springtravel/app/bar?baz=boop", response.getRedirectedUrl()); - EasyMock.verify(new Object[] { executor }); + EasyMock.verify(executor); } public void testLaunchFlowWithExternalRedirect() throws Exception { @@ -229,12 +229,12 @@ public class FlowControllerTests extends TestCase { executor.launchExecution("foo", null, context); FlowExecutionResult result = FlowExecutionResult.createPausedResult("foo", "12345"); EasyMock.expectLastCall().andReturn(result); - EasyMock.replay(new Object[] { executor }); + EasyMock.replay(executor); ModelAndView mv = controller.handleRequest(request, response); assertNull(mv); - EasyMock.verify(new Object[] { executor }); + EasyMock.verify(executor); assertEquals("http://www.paypal.com", response.getRedirectedUrl()); - EasyMock.verify(new Object[] { executor }); + EasyMock.verify(executor); } public void testDefaultHandleFlowException() throws Exception { @@ -247,14 +247,14 @@ public class FlowControllerTests extends TestCase { FlowException flowException = new FlowException("Error") { }; EasyMock.expectLastCall().andThrow(flowException); - EasyMock.replay(new Object[] { executor }); + EasyMock.replay(executor); try { controller.handleRequest(request, response); fail("Should have thrown exception"); } catch (FlowException e) { assertEquals(flowException, e); } - EasyMock.verify(new Object[] { executor }); + EasyMock.verify(executor); } public void testDefaultHandleNoSuchFlowExecutionException() throws Exception { @@ -267,11 +267,11 @@ public class FlowControllerTests extends TestCase { executor.resumeExecution("12345", context); FlowException flowException = new NoSuchFlowExecutionException(new MockFlowExecutionKey("12345"), null); EasyMock.expectLastCall().andThrow(flowException); - EasyMock.replay(new Object[] { executor }); + EasyMock.replay(executor); ModelAndView mv = controller.handleRequest(request, response); assertNull(mv); assertEquals("/springtravel/app/foo", response.getRedirectedUrl()); - EasyMock.verify(new Object[] { executor }); + EasyMock.verify(executor); } public void testLaunchFlowWithCustomFlowHandler() throws Exception { @@ -303,10 +303,10 @@ public class FlowControllerTests extends TestCase { executor.launchExecution("foo", input, context); FlowExecutionResult result = FlowExecutionResult.createPausedResult("foo", "12345"); EasyMock.expectLastCall().andReturn(result); - EasyMock.replay(new Object[] { executor }); + EasyMock.replay(executor); ModelAndView mv = controller.handleRequest(request, response); assertNull(mv); - EasyMock.verify(new Object[] { executor }); + EasyMock.verify(executor); } public void testHandleFlowOutcomeCustomFlowHandler() throws Exception { @@ -345,11 +345,11 @@ public class FlowControllerTests extends TestCase { FlowExecutionOutcome outcome = new FlowExecutionOutcome("finish", output); FlowExecutionResult result = FlowExecutionResult.createEndedResult("foo", outcome); EasyMock.expectLastCall().andReturn(result); - EasyMock.replay(new Object[] { executor }); + EasyMock.replay(executor); ModelAndView mv = controller.handleRequest(request, response); assertNull(mv); assertEquals("/springtravel/app/foo?bar=baz", response.getRedirectedUrl()); - EasyMock.verify(new Object[] { executor }); + EasyMock.verify(executor); } public void testHandleFlowExceptionCustomFlowHandler() throws Exception { @@ -382,13 +382,13 @@ public class FlowControllerTests extends TestCase { request.setMethod("GET"); executor.launchExecution("foo", null, context); EasyMock.expectLastCall().andThrow(flowException); - EasyMock.replay(new Object[] { executor }); + EasyMock.replay(executor); try { controller.handleRequest(request, response); fail("Should have thrown exception"); } catch (FlowException e) { assertEquals(flowException, e); } - EasyMock.verify(new Object[] { executor }); + EasyMock.verify(executor); } } diff --git a/spring-webflow/src/test/java/org/springframework/webflow/mvc/servlet/FlowHandlerAdapterTests.java b/spring-webflow/src/test/java/org/springframework/webflow/mvc/servlet/FlowHandlerAdapterTests.java index 840c055c..b1ce23ea 100644 --- a/spring-webflow/src/test/java/org/springframework/webflow/mvc/servlet/FlowHandlerAdapterTests.java +++ b/spring-webflow/src/test/java/org/springframework/webflow/mvc/servlet/FlowHandlerAdapterTests.java @@ -92,9 +92,9 @@ public class FlowHandlerAdapterTests extends TestCase { flowExecutor.launchExecution("foo", flowInput, context); FlowExecutionResult result = FlowExecutionResult.createPausedResult("foo", "12345"); EasyMock.expectLastCall().andReturn(result); - EasyMock.replay(new Object[] { flowExecutor }); + EasyMock.replay(flowExecutor); flowHandlerAdapter.handle(request, response, flowHandler); - EasyMock.verify(new Object[] { flowExecutor }); + EasyMock.verify(flowExecutor); } public void testLaunchFlowRequestEndsAfterProcessing() throws Exception { @@ -107,10 +107,10 @@ public class FlowHandlerAdapterTests extends TestCase { FlowExecutionOutcome outcome = new FlowExecutionOutcome("finish", output); FlowExecutionResult result = FlowExecutionResult.createEndedResult("foo", outcome); EasyMock.expectLastCall().andReturn(result); - EasyMock.replay(new Object[] { flowExecutor }); + EasyMock.replay(flowExecutor); flowHandlerAdapter.handle(request, response, flowHandler); assertEquals("/springtravel/app/foo?bar=baz", response.getRedirectedUrl()); - EasyMock.verify(new Object[] { flowExecutor }); + EasyMock.verify(flowExecutor); } public void testLaunchFlowRequestEndsAfterProcessingAjaxRequest() throws Exception { @@ -124,11 +124,11 @@ public class FlowHandlerAdapterTests extends TestCase { FlowExecutionOutcome outcome = new FlowExecutionOutcome("finish", output); FlowExecutionResult result = FlowExecutionResult.createEndedResult("foo", outcome); EasyMock.expectLastCall().andReturn(result); - EasyMock.replay(new Object[] { flowExecutor }); + EasyMock.replay(flowExecutor); request.addHeader("Accept", "text/html;type=ajax"); flowHandlerAdapter.handle(request, response, flowHandler); assertEquals("/springtravel/app/foo?bar=baz", response.getHeader("Spring-Redirect-URL")); - EasyMock.verify(new Object[] { flowExecutor }); + EasyMock.verify(flowExecutor); } public void testResumeFlowRequest() throws Exception { @@ -137,9 +137,9 @@ public class FlowHandlerAdapterTests extends TestCase { flowExecutor.resumeExecution("12345", context); FlowExecutionResult result = FlowExecutionResult.createPausedResult("foo", "123456"); EasyMock.expectLastCall().andReturn(result); - EasyMock.replay(new Object[] { flowExecutor }); + EasyMock.replay(flowExecutor); flowHandlerAdapter.handle(request, response, flowHandler); - EasyMock.verify(new Object[] { flowExecutor }); + EasyMock.verify(flowExecutor); } public void testResumeFlowRequestEndsAfterProcessing() throws Exception { @@ -153,11 +153,11 @@ public class FlowHandlerAdapterTests extends TestCase { FlowExecutionOutcome outcome = new FlowExecutionOutcome("finish", output); FlowExecutionResult result = FlowExecutionResult.createEndedResult("foo", outcome); EasyMock.expectLastCall().andReturn(result); - EasyMock.replay(new Object[] { flowExecutor }); + EasyMock.replay(flowExecutor); ModelAndView mv = flowHandlerAdapter.handle(request, response, flowHandler); assertNull(mv); assertEquals("/springtravel/app/foo?bar=baz", response.getRedirectedUrl()); - EasyMock.verify(new Object[] { flowExecutor }); + EasyMock.verify(flowExecutor); } public void testResumeFlowRequestEndsAfterProcessingFlowCommittedResponse() throws Exception { @@ -172,11 +172,11 @@ public class FlowHandlerAdapterTests extends TestCase { FlowExecutionOutcome outcome = new FlowExecutionOutcome("finish", output); FlowExecutionResult result = FlowExecutionResult.createEndedResult("foo", outcome); EasyMock.expectLastCall().andReturn(result); - EasyMock.replay(new Object[] { flowExecutor }); + EasyMock.replay(flowExecutor); ModelAndView mv = flowHandlerAdapter.handle(request, response, flowHandler); assertNull(mv); assertEquals(null, response.getRedirectedUrl()); - EasyMock.verify(new Object[] { flowExecutor }); + EasyMock.verify(flowExecutor); } public void testLaunchFlowWithExecutionRedirect() throws Exception { @@ -185,11 +185,11 @@ public class FlowHandlerAdapterTests extends TestCase { flowExecutor.launchExecution("foo", flowInput, context); FlowExecutionResult result = FlowExecutionResult.createPausedResult("foo", "12345"); EasyMock.expectLastCall().andReturn(result); - EasyMock.replay(new Object[] { flowExecutor }); + EasyMock.replay(flowExecutor); flowHandlerAdapter.handle(request, response, flowHandler); - EasyMock.verify(new Object[] { flowExecutor }); + EasyMock.verify(flowExecutor); assertEquals("/springtravel/app/foo?execution=12345", response.getRedirectedUrl()); - EasyMock.verify(new Object[] { flowExecutor }); + EasyMock.verify(flowExecutor); } public void testLaunchFlowWithDefinitionRedirect() throws Exception { @@ -205,12 +205,12 @@ public class FlowHandlerAdapterTests extends TestCase { FlowExecutionOutcome outcome = new FlowExecutionOutcome("finish", output); FlowExecutionResult result = FlowExecutionResult.createEndedResult("foo", outcome); EasyMock.expectLastCall().andReturn(result); - EasyMock.replay(new Object[] { flowExecutor }); + EasyMock.replay(flowExecutor); ModelAndView mv = flowHandlerAdapter.handle(request, response, flowHandler); assertNull(mv); - EasyMock.verify(new Object[] { flowExecutor }); + EasyMock.verify(flowExecutor); assertEquals("/springtravel/app/bar?baz=boop", response.getRedirectedUrl()); - EasyMock.verify(new Object[] { flowExecutor }); + EasyMock.verify(flowExecutor); } public void testLaunchFlowWithExternalHttpRedirect() throws Exception { @@ -219,11 +219,11 @@ public class FlowHandlerAdapterTests extends TestCase { flowExecutor.launchExecution("foo", flowInput, context); FlowExecutionResult result = FlowExecutionResult.createPausedResult("foo", "12345"); EasyMock.expectLastCall().andReturn(result); - EasyMock.replay(new Object[] { flowExecutor }); + EasyMock.replay(flowExecutor); flowHandlerAdapter.handle(request, response, flowHandler); - EasyMock.verify(new Object[] { flowExecutor }); + EasyMock.verify(flowExecutor); assertEquals("http://www.paypal.com", response.getRedirectedUrl()); - EasyMock.verify(new Object[] { flowExecutor }); + EasyMock.verify(flowExecutor); } public void testLaunchFlowWithExternalHttpsRedirect() throws Exception { @@ -232,11 +232,11 @@ public class FlowHandlerAdapterTests extends TestCase { flowExecutor.launchExecution("foo", flowInput, context); FlowExecutionResult result = FlowExecutionResult.createPausedResult("foo", "12345"); EasyMock.expectLastCall().andReturn(result); - EasyMock.replay(new Object[] { flowExecutor }); + EasyMock.replay(flowExecutor); flowHandlerAdapter.handle(request, response, flowHandler); - EasyMock.verify(new Object[] { flowExecutor }); + EasyMock.verify(flowExecutor); assertEquals("https://www.paypal.com", response.getRedirectedUrl()); - EasyMock.verify(new Object[] { flowExecutor }); + EasyMock.verify(flowExecutor); } public void testLaunchFlowWithExternalRedirectServletRelative() throws Exception { @@ -245,11 +245,11 @@ public class FlowHandlerAdapterTests extends TestCase { flowExecutor.launchExecution("foo", flowInput, context); FlowExecutionResult result = FlowExecutionResult.createPausedResult("foo", "12345"); EasyMock.expectLastCall().andReturn(result); - EasyMock.replay(new Object[] { flowExecutor }); + EasyMock.replay(flowExecutor); flowHandlerAdapter.handle(request, response, flowHandler); - EasyMock.verify(new Object[] { flowExecutor }); + EasyMock.verify(flowExecutor); assertEquals("/springtravel/app/bar", response.getRedirectedUrl()); - EasyMock.verify(new Object[] { flowExecutor }); + EasyMock.verify(flowExecutor); } public void testLaunchFlowWithExternalRedirectServletRelativeWithSlash() throws Exception { @@ -258,11 +258,11 @@ public class FlowHandlerAdapterTests extends TestCase { flowExecutor.launchExecution("foo", flowInput, context); FlowExecutionResult result = FlowExecutionResult.createPausedResult("foo", "12345"); EasyMock.expectLastCall().andReturn(result); - EasyMock.replay(new Object[] { flowExecutor }); + EasyMock.replay(flowExecutor); flowHandlerAdapter.handle(request, response, flowHandler); - EasyMock.verify(new Object[] { flowExecutor }); + EasyMock.verify(flowExecutor); assertEquals("/springtravel/app/bar", response.getRedirectedUrl()); - EasyMock.verify(new Object[] { flowExecutor }); + EasyMock.verify(flowExecutor); } public void testLaunchFlowWithExternalRedirectContextRelative() throws Exception { @@ -271,11 +271,11 @@ public class FlowHandlerAdapterTests extends TestCase { flowExecutor.launchExecution("foo", flowInput, context); FlowExecutionResult result = FlowExecutionResult.createPausedResult("foo", "12345"); EasyMock.expectLastCall().andReturn(result); - EasyMock.replay(new Object[] { flowExecutor }); + EasyMock.replay(flowExecutor); flowHandlerAdapter.handle(request, response, flowHandler); - EasyMock.verify(new Object[] { flowExecutor }); + EasyMock.verify(flowExecutor); assertEquals("/springtravel/bar", response.getRedirectedUrl()); - EasyMock.verify(new Object[] { flowExecutor }); + EasyMock.verify(flowExecutor); } public void testLaunchFlowWithExternalRedirectContextRelativeWithSlash() throws Exception { @@ -284,11 +284,11 @@ public class FlowHandlerAdapterTests extends TestCase { flowExecutor.launchExecution("foo", flowInput, context); FlowExecutionResult result = FlowExecutionResult.createPausedResult("foo", "12345"); EasyMock.expectLastCall().andReturn(result); - EasyMock.replay(new Object[] { flowExecutor }); + EasyMock.replay(flowExecutor); flowHandlerAdapter.handle(request, response, flowHandler); - EasyMock.verify(new Object[] { flowExecutor }); + EasyMock.verify(flowExecutor); assertEquals("/springtravel/bar", response.getRedirectedUrl()); - EasyMock.verify(new Object[] { flowExecutor }); + EasyMock.verify(flowExecutor); } public void testLaunchFlowWithExternalRedirectServerRelative() throws Exception { @@ -297,11 +297,11 @@ public class FlowHandlerAdapterTests extends TestCase { flowExecutor.launchExecution("foo", flowInput, context); FlowExecutionResult result = FlowExecutionResult.createPausedResult("foo", "12345"); EasyMock.expectLastCall().andReturn(result); - EasyMock.replay(new Object[] { flowExecutor }); + EasyMock.replay(flowExecutor); flowHandlerAdapter.handle(request, response, flowHandler); - EasyMock.verify(new Object[] { flowExecutor }); + EasyMock.verify(flowExecutor); assertEquals("/bar", response.getRedirectedUrl()); - EasyMock.verify(new Object[] { flowExecutor }); + EasyMock.verify(flowExecutor); } public void testLaunchFlowWithExternalRedirectServerRelativeWithSlash() throws Exception { @@ -310,11 +310,11 @@ public class FlowHandlerAdapterTests extends TestCase { flowExecutor.launchExecution("foo", flowInput, context); FlowExecutionResult result = FlowExecutionResult.createPausedResult("foo", "12345"); EasyMock.expectLastCall().andReturn(result); - EasyMock.replay(new Object[] { flowExecutor }); + EasyMock.replay(flowExecutor); flowHandlerAdapter.handle(request, response, flowHandler); - EasyMock.verify(new Object[] { flowExecutor }); + EasyMock.verify(flowExecutor); assertEquals("/bar", response.getRedirectedUrl()); - EasyMock.verify(new Object[] { flowExecutor }); + EasyMock.verify(flowExecutor); } public void testLaunchFlowWithExternalRedirectNotHttp10Compatible() throws Exception { @@ -324,12 +324,12 @@ public class FlowHandlerAdapterTests extends TestCase { flowExecutor.launchExecution("foo", flowInput, context); FlowExecutionResult result = FlowExecutionResult.createPausedResult("foo", "12345"); EasyMock.expectLastCall().andReturn(result); - EasyMock.replay(new Object[] { flowExecutor }); + EasyMock.replay(flowExecutor); flowHandlerAdapter.handle(request, response, flowHandler); - EasyMock.verify(new Object[] { flowExecutor }); + EasyMock.verify(flowExecutor); assertEquals(303, response.getStatus()); assertEquals("/bar", response.getHeader("Location")); - EasyMock.verify(new Object[] { flowExecutor }); + EasyMock.verify(flowExecutor); } public void testSwf1385DefaultServletExternalRedirect() throws Exception { @@ -338,11 +338,11 @@ public class FlowHandlerAdapterTests extends TestCase { flowExecutor.launchExecution("foo", flowInput, context); FlowExecutionResult result = FlowExecutionResult.createPausedResult("foo", "12345"); EasyMock.expectLastCall().andReturn(result); - EasyMock.replay(new Object[] { flowExecutor }); + EasyMock.replay(flowExecutor); flowHandlerAdapter.handle(request, response, flowHandler); - EasyMock.verify(new Object[] { flowExecutor }); + EasyMock.verify(flowExecutor); assertEquals("/springtravel/bar", response.getRedirectedUrl()); - EasyMock.verify(new Object[] { flowExecutor }); + EasyMock.verify(flowExecutor); } public void testSwf1385DefaultServletExternalRedirectDeviation() throws Exception { @@ -354,11 +354,11 @@ public class FlowHandlerAdapterTests extends TestCase { flowExecutor.launchExecution("foo", flowInput, context); FlowExecutionResult result = FlowExecutionResult.createPausedResult("foo", "12345"); EasyMock.expectLastCall().andReturn(result); - EasyMock.replay(new Object[] { flowExecutor }); + EasyMock.replay(flowExecutor); flowHandlerAdapter.handle(request, response, flowHandler); - EasyMock.verify(new Object[] { flowExecutor }); + EasyMock.verify(flowExecutor); assertEquals("/springtravel/bar", response.getRedirectedUrl()); - EasyMock.verify(new Object[] { flowExecutor }); + EasyMock.verify(flowExecutor); } public void testSwf1385DefaultServletExternalRedirectServletRelative() throws Exception { @@ -367,11 +367,11 @@ public class FlowHandlerAdapterTests extends TestCase { flowExecutor.launchExecution("foo", flowInput, context); FlowExecutionResult result = FlowExecutionResult.createPausedResult("foo", "12345"); EasyMock.expectLastCall().andReturn(result); - EasyMock.replay(new Object[] { flowExecutor }); + EasyMock.replay(flowExecutor); flowHandlerAdapter.handle(request, response, flowHandler); - EasyMock.verify(new Object[] { flowExecutor }); + EasyMock.verify(flowExecutor); assertEquals("/springtravel/bar", response.getRedirectedUrl()); - EasyMock.verify(new Object[] { flowExecutor }); + EasyMock.verify(flowExecutor); } public void testExternalRedirectServletRelativeWithDefaultServletMapping() throws Exception { @@ -380,11 +380,11 @@ public class FlowHandlerAdapterTests extends TestCase { flowExecutor.launchExecution("foo", flowInput, context); FlowExecutionResult result = FlowExecutionResult.createPausedResult("foo", "12345"); EasyMock.expectLastCall().andReturn(result); - EasyMock.replay(new Object[] { flowExecutor }); + EasyMock.replay(flowExecutor); flowHandlerAdapter.handle(request, response, flowHandler); - EasyMock.verify(new Object[] { flowExecutor }); + EasyMock.verify(flowExecutor); assertEquals("/springtravel/foo/bar", response.getRedirectedUrl()); - EasyMock.verify(new Object[] { flowExecutor }); + EasyMock.verify(flowExecutor); } public void testRemoteHost() throws Exception { @@ -408,14 +408,14 @@ public class FlowHandlerAdapterTests extends TestCase { FlowException flowException = new FlowException("Error") { }; EasyMock.expectLastCall().andThrow(flowException); - EasyMock.replay(new Object[] { flowExecutor }); + EasyMock.replay(flowExecutor); try { flowHandlerAdapter.handle(request, response, flowHandler); fail("Should have thrown exception"); } catch (FlowException e) { assertEquals(flowException, e); } - EasyMock.verify(new Object[] { flowExecutor }); + EasyMock.verify(flowExecutor); } public void testDefaultHandleNoSuchFlowExecutionException() throws Exception { @@ -424,10 +424,10 @@ public class FlowHandlerAdapterTests extends TestCase { flowExecutor.resumeExecution("12345", context); FlowException flowException = new NoSuchFlowExecutionException(new MockFlowExecutionKey("12345"), null); EasyMock.expectLastCall().andThrow(flowException); - EasyMock.replay(new Object[] { flowExecutor }); + EasyMock.replay(flowExecutor); flowHandlerAdapter.handle(request, response, flowHandler); assertEquals("/springtravel/app/foo", response.getRedirectedUrl()); - EasyMock.verify(new Object[] { flowExecutor }); + EasyMock.verify(flowExecutor); } public void testDefaultHandleNoSuchFlowExecutionExceptionAjaxRequest() throws Exception { @@ -436,17 +436,17 @@ public class FlowHandlerAdapterTests extends TestCase { flowExecutor.resumeExecution("12345", context); FlowException flowException = new NoSuchFlowExecutionException(new MockFlowExecutionKey("12345"), null); EasyMock.expectLastCall().andThrow(flowException); - EasyMock.replay(new Object[] { flowExecutor }); + EasyMock.replay(flowExecutor); context.setAjaxRequest(true); request.addHeader("Accept", "text/html;type=ajax"); flowHandlerAdapter.handle(request, response, flowHandler); assertEquals("/springtravel/app/foo", response.getHeader("Spring-Redirect-URL")); - EasyMock.verify(new Object[] { flowExecutor }); + EasyMock.verify(flowExecutor); } public void testHandleFlowOutcomeCustomFlowHandler() throws Exception { doHandleFlowServletRedirectOutcome(); - EasyMock.verify(new Object[] { flowExecutor }); + EasyMock.verify(flowExecutor); } public void testHandleFlowExceptionCustomFlowHandler() throws Exception { @@ -456,9 +456,9 @@ public class FlowHandlerAdapterTests extends TestCase { setupRequest("/springtravel", "/app", "/foo", "GET"); flowExecutor.launchExecution("foo", flowInput, context); EasyMock.expectLastCall().andThrow(flowException); - EasyMock.replay(new Object[] { flowExecutor }); + EasyMock.replay(flowExecutor); flowHandlerAdapter.handle(request, response, flowHandler); - EasyMock.verify(new Object[] { flowExecutor }); + EasyMock.verify(flowExecutor); } public void testHandleFlowServletRedirectOutcomeWithoutFlash() throws Exception { @@ -482,9 +482,9 @@ public class FlowHandlerAdapterTests extends TestCase { FlowExecutionOutcome outcome = new FlowExecutionOutcome("finish", output); FlowExecutionResult result = FlowExecutionResult.createEndedResult("foo", outcome); EasyMock.expectLastCall().andReturn(result); - EasyMock.replay(new Object[] { flowExecutor }); + EasyMock.replay(flowExecutor); flowHandlerAdapter.handle(request, response, flowHandler); - EasyMock.verify(new Object[] { flowExecutor }); + EasyMock.verify(flowExecutor); } private void setupRequest(String contextPath, String servletPath, String pathInfo, String method) { diff --git a/spring-webflow/src/test/java/org/springframework/webflow/mvc/view/MvcViewTests.java b/spring-webflow/src/test/java/org/springframework/webflow/mvc/view/MvcViewTests.java index af08a758..7efabfdd 100644 --- a/spring-webflow/src/test/java/org/springframework/webflow/mvc/view/MvcViewTests.java +++ b/spring-webflow/src/test/java/org/springframework/webflow/mvc/view/MvcViewTests.java @@ -3,6 +3,7 @@ package org.springframework.webflow.mvc.view; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; +import java.io.IOException; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.security.Principal; @@ -136,7 +137,7 @@ public class MvcViewTests extends TestCase { assertEquals("2008-01-01", bm.getFieldValue("dateProperty")); } - public void testResumeNoEvent() throws Exception { + public void testResumeNoEvent() { MockRequestContext context = new MockRequestContext(); context.getMockExternalContext().setNativeContext(new MockServletContext()); context.getMockExternalContext().setNativeRequest(new MockHttpServletRequest()); @@ -150,7 +151,7 @@ public class MvcViewTests extends TestCase { assertNull(view.getFlowEvent()); } - public void testResumeEventNoModelBinding() throws Exception { + public void testResumeEventNoModelBinding() { MockRequestContext context = new MockRequestContext(); context.putRequestParameter("_eventId", "submit"); context.getMockExternalContext().setNativeContext(new MockServletContext()); @@ -165,7 +166,7 @@ public class MvcViewTests extends TestCase { assertEquals("submit", view.getFlowEvent().getId()); } - public void testResumeEventModelBinding() throws Exception { + public void testResumeEventModelBinding() { MockRequestContext context = new MockRequestContext(); context.putRequestParameter("_eventId", "submit"); context.putRequestParameter("stringProperty", "foo"); @@ -220,7 +221,7 @@ public class MvcViewTests extends TestCase { assertFalse(bindBean.validationMethodInvoked); } - public void testResumeEventBindingErrors() throws Exception { + public void testResumeEventBindingErrors() throws IOException { MockRequestControlContext context = new MockRequestControlContext(); context.putRequestParameter("_eventId", "submit"); context.putRequestParameter("integerProperty", "bogus 1"); @@ -249,7 +250,7 @@ public class MvcViewTests extends TestCase { assertEquals("bogus 2", bm.getFieldValue("dateProperty")); } - public void testResumeEventNoModelInScope() throws Exception { + public void testResumeEventNoModelInScope() { MockRequestContext context = new MockRequestContext(); context.putRequestParameter("_eventId", "submit"); context.putRequestParameter("stringProperty", "foo"); @@ -416,7 +417,7 @@ public class MvcViewTests extends TestCase { return restoredState; } - public void testResumeEventModelBindingAllowedFields() throws Exception { + public void testResumeEventModelBindingAllowedFields() { MockRequestContext context = new MockRequestContext(); context.putRequestParameter("_eventId", "submit"); context.putRequestParameter("stringProperty", "foo"); @@ -450,7 +451,7 @@ public class MvcViewTests extends TestCase { assertEquals(null, bindBean.getBeanProperty().getName()); } - public void testResumeEventModelBindingCustomConverter() throws Exception { + public void testResumeEventModelBindingCustomConverter() { MockRequestContext context = new MockRequestContext(); context.putRequestParameter("_eventId", "submit"); context.putRequestParameter("dateProperty", "01-01-2007"); @@ -483,7 +484,7 @@ public class MvcViewTests extends TestCase { assertEquals(cal.getTime(), bindBean.getDateProperty()); } - public void testResumeEventModelBindingFieldMarker() throws Exception { + public void testResumeEventModelBindingFieldMarker() { MockRequestContext context = new MockRequestContext(); context.putRequestParameter("_eventId", "submit"); context.putRequestParameter("_booleanProperty", "whatever"); @@ -504,7 +505,7 @@ public class MvcViewTests extends TestCase { assertEquals(false, bindBean.getBooleanProperty()); } - public void testResumeEventModelBindingFieldMarkerFieldPresent() throws Exception { + public void testResumeEventModelBindingFieldMarkerFieldPresent() { MockRequestContext context = new MockRequestContext(); context.putRequestParameter("_eventId", "submit"); context.putRequestParameter("booleanProperty", "true"); @@ -527,7 +528,7 @@ public class MvcViewTests extends TestCase { assertEquals(true, bindBean.getBooleanProperty()); } - public void testResumeEventModelBindAndValidate() throws Exception { + public void testResumeEventModelBindAndValidate() { MockRequestContext context = new MockRequestContext(); context.putRequestParameter("_eventId", "submit"); context.putRequestParameter("stringProperty", "foo"); @@ -553,7 +554,7 @@ public class MvcViewTests extends TestCase { assertTrue(bindBean.validationMethodInvoked); } - public void testResumeEventModelBindAndValidateDefaultValidatorFallback() throws Exception { + public void testResumeEventModelBindAndValidateDefaultValidatorFallback() { MockRequestContext context = new MockRequestContext(); context.putRequestParameter("_eventId", "submit"); context.putRequestParameter("stringProperty", "foo"); @@ -579,7 +580,7 @@ public class MvcViewTests extends TestCase { assertTrue(bindBean.validationMethodInvoked); } - public void testResumeEventModelValidateOnBindingErrors() throws Exception { + public void testResumeEventModelValidateOnBindingErrors() { MockRequestContext context = new MockRequestContext(); context.putRequestParameter("_eventId", "submit"); context.putRequestParameter("stringProperty", "foo"); @@ -603,7 +604,7 @@ public class MvcViewTests extends TestCase { assertTrue(bindBean.validationMethodInvoked); } - public void testResumeEventModelNoValidateOnBindingErrors() throws Exception { + public void testResumeEventModelNoValidateOnBindingErrors() { MockRequestContext context = new MockRequestContext(); context.putRequestParameter("_eventId", "submit"); context.putRequestParameter("stringProperty", "foo"); @@ -628,7 +629,7 @@ public class MvcViewTests extends TestCase { assertFalse(bindBean.validationMethodInvoked); } - public void testResumeEventStringValidationHint() throws Exception { + public void testResumeEventStringValidationHint() { StubSmartValidator validator = new StubSmartValidator(); MockRequestContext context = new MockRequestContext(); context.putRequestParameter("_eventId", "submit"); @@ -658,7 +659,7 @@ public class MvcViewTests extends TestCase { assertTrue(validator.invoked); } - public void testResumeEventObjectArrayValidationHint() throws Exception { + public void testResumeEventObjectArrayValidationHint() { StubSmartValidator validator = new StubSmartValidator(); MockRequestContext context = new MockRequestContext(); context.putRequestParameter("_eventId", "submit"); @@ -716,8 +717,7 @@ public class MvcViewTests extends TestCase { return "text/html"; } - public void render(Map model, HttpServletRequest request, HttpServletResponse response) - throws Exception { + public void render(Map model, HttpServletRequest request, HttpServletResponse response) { renderCalled = true; MvcViewTests.this.model = model; } diff --git a/spring-webflow/src/test/java/org/springframework/webflow/mvc/view/SpringBeanBindingModelTests.java b/spring-webflow/src/test/java/org/springframework/webflow/mvc/view/SpringBeanBindingModelTests.java index 10e71bbc..4065871c 100644 --- a/spring-webflow/src/test/java/org/springframework/webflow/mvc/view/SpringBeanBindingModelTests.java +++ b/spring-webflow/src/test/java/org/springframework/webflow/mvc/view/SpringBeanBindingModelTests.java @@ -22,7 +22,7 @@ public class SpringBeanBindingModelTests extends AbstractBindingModelTests { public void testGetFieldValueNonStringNoConversionService() { model = new BindingModel("testBean", testBean, getExpressionParser(), null, messages); testBean.datum2 = 3; - assertEquals(new Integer(3), model.getFieldValue("datum2")); + assertEquals(3, model.getFieldValue("datum2")); } } diff --git a/spring-webflow/src/test/java/org/springframework/webflow/persistence/AbstractFlowManagedPersistenceIntegrationTests.java b/spring-webflow/src/test/java/org/springframework/webflow/persistence/AbstractFlowManagedPersistenceIntegrationTests.java index 7c17e8c3..5a982467 100644 --- a/spring-webflow/src/test/java/org/springframework/webflow/persistence/AbstractFlowManagedPersistenceIntegrationTests.java +++ b/spring-webflow/src/test/java/org/springframework/webflow/persistence/AbstractFlowManagedPersistenceIntegrationTests.java @@ -109,7 +109,7 @@ public abstract class AbstractFlowManagedPersistenceIntegrationTests extends Tes dataSource = dmds; } - private void populateDataBase() throws Exception { + private void populateDataBase() { ResourceDatabasePopulator databasePopulator = new ResourceDatabasePopulator(); databasePopulator.addScript(new ClassPathResource("test-data.sql", this.getClass())); DataSourceInitializer initializer = new DataSourceInitializer(); diff --git a/spring-webflow/src/test/java/org/springframework/webflow/persistence/AbstractPersistenceContextPropagationTests.java b/spring-webflow/src/test/java/org/springframework/webflow/persistence/AbstractPersistenceContextPropagationTests.java index 7f3a23b0..4811fdb1 100644 --- a/spring-webflow/src/test/java/org/springframework/webflow/persistence/AbstractPersistenceContextPropagationTests.java +++ b/spring-webflow/src/test/java/org/springframework/webflow/persistence/AbstractPersistenceContextPropagationTests.java @@ -139,7 +139,7 @@ public abstract class AbstractPersistenceContextPropagationTests extends TestCas return dataSource; } - private void populateDataBase(DataSource dataSource) throws Exception { + private void populateDataBase(DataSource dataSource) { ResourceDatabasePopulator databasePopulator = new ResourceDatabasePopulator(); databasePopulator.addScript(new ClassPathResource("test-data.sql", this.getClass())); DataSourceInitializer initializer = new DataSourceInitializer(); diff --git a/spring-webflow/src/test/java/org/springframework/webflow/persistence/HibernateFlowExecutionListenerTests.java b/spring-webflow/src/test/java/org/springframework/webflow/persistence/HibernateFlowExecutionListenerTests.java index d531044d..2ac7bee2 100644 --- a/spring-webflow/src/test/java/org/springframework/webflow/persistence/HibernateFlowExecutionListenerTests.java +++ b/spring-webflow/src/test/java/org/springframework/webflow/persistence/HibernateFlowExecutionListenerTests.java @@ -72,12 +72,7 @@ public class HibernateFlowExecutionListenerTests extends TestCase { hibernateListener.resuming(context); assertSessionBound(); - hibernate.templateExecuteWithNativeSession(new SessionCallback() { - @Override - public void doWithSession(Session session) { - assertSame("Should have been original instance", hibSession, session); - } - }); + hibernate.templateExecuteWithNativeSession(session -> assertSame("Should have been original instance", hibSession, session)); hibernateListener.paused(context); assertSessionNotBound(); } @@ -90,7 +85,7 @@ public class HibernateFlowExecutionListenerTests extends TestCase { } public void testFlowCommitsInSingleRequest() { - assertEquals("Table should only have one row", 1, (int)jdbcTemplate.queryForObject("select count(*) from T_BEAN", Integer.class)); + assertEquals("Table should only have one row", 1, getCount()); MockRequestContext context = new MockRequestContext(); MockFlowSession flowSession = new MockFlowSession(); flowSession.getDefinition().getAttributes().put("persistenceContext", "true"); @@ -100,7 +95,7 @@ public class HibernateFlowExecutionListenerTests extends TestCase { TestBean bean = new TestBean("Keith Donald"); hibernate.templateSave(bean); - assertEquals("Table should still only have one row", 1, (int)jdbcTemplate.queryForObject("select count(*) from T_BEAN", Integer.class)); + assertEquals("Table should still only have one row", 1, getCount()); EndState endState = new EndState(flowSession.getDefinitionInternal(), "success"); endState.getAttributes().put("commit", true); @@ -108,12 +103,17 @@ public class HibernateFlowExecutionListenerTests extends TestCase { hibernateListener.sessionEnding(context, flowSession, "success", null); hibernateListener.sessionEnded(context, flowSession, "success", null); - assertEquals("Table should only have two rows", 2, (int)jdbcTemplate.queryForObject("select count(*) from T_BEAN", Integer.class)); + assertEquals("Table should only have two rows", 2, getCount()); assertSessionNotBound(); } + @SuppressWarnings("ConstantConditions") + private int getCount() { + return jdbcTemplate.queryForObject("select count(*) from T_BEAN", Integer.class); + } + public void testFlowCommitsAfterMultipleRequests() { - assertEquals("Table should only have one row", 1, (int)jdbcTemplate.queryForObject("select count(*) from T_BEAN", Integer.class)); + assertEquals("Table should only have one row", 1, getCount()); MockRequestContext context = new MockRequestContext(); MockFlowSession flowSession = new MockFlowSession(); flowSession.getDefinition().getAttributes().put("persistenceContext", "true"); @@ -123,14 +123,14 @@ public class HibernateFlowExecutionListenerTests extends TestCase { TestBean bean1 = new TestBean("Keith Donald"); hibernate.templateSave(bean1); - assertEquals("Table should still only have one row", 1, (int)jdbcTemplate.queryForObject("select count(*) from T_BEAN", Integer.class)); + assertEquals("Table should still only have one row", 1, getCount()); hibernateListener.paused(context); assertSessionNotBound(); hibernateListener.resuming(context); TestBean bean2 = new TestBean("Keith Donald"); hibernate.templateSave(bean2); - assertEquals("Table should still only have one row", 1, (int)jdbcTemplate.queryForObject("select count(*) from T_BEAN", Integer.class)); + assertEquals("Table should still only have one row", 1, getCount()); assertSessionBound(); EndState endState = new EndState(flowSession.getDefinitionInternal(), "success"); @@ -139,13 +139,13 @@ public class HibernateFlowExecutionListenerTests extends TestCase { hibernateListener.sessionEnding(context, flowSession, "success", null); hibernateListener.sessionEnded(context, flowSession, "success", null); - assertEquals("Table should only have three rows", 3, (int)jdbcTemplate.queryForObject("select count(*) from T_BEAN", Integer.class)); + assertEquals("Table should only have three rows", 3, getCount()); assertSessionNotBound(); } public void testCancelEndState() { - assertEquals("Table should only have one row", 1, (int)jdbcTemplate.queryForObject("select count(*) from T_BEAN", Integer.class)); + assertEquals("Table should only have one row", 1, getCount()); MockRequestContext context = new MockRequestContext(); MockFlowSession flowSession = new MockFlowSession(); flowSession.getDefinition().getAttributes().put("persistenceContext", "true"); @@ -155,19 +155,19 @@ public class HibernateFlowExecutionListenerTests extends TestCase { TestBean bean = new TestBean("Keith Donald"); hibernate.templateSave(bean); - assertEquals("Table should still only have one row", 1, (int)jdbcTemplate.queryForObject("select count(*) from T_BEAN", Integer.class)); + assertEquals("Table should still only have one row", 1, getCount()); EndState endState = new EndState(flowSession.getDefinitionInternal(), "cancel"); endState.getAttributes().put("commit", false); flowSession.setState(endState); hibernateListener.sessionEnding(context, flowSession, "success", null); hibernateListener.sessionEnded(context, flowSession, "cancel", null); - assertEquals("Table should only have two rows", 1, (int)jdbcTemplate.queryForObject("select count(*) from T_BEAN", Integer.class)); + assertEquals("Table should only have two rows", 1, getCount()); assertSessionNotBound(); } public void testNoCommitAttributeSetOnEndState() { - assertEquals("Table should only have one row", 1, (int)jdbcTemplate.queryForObject("select count(*) from T_BEAN", Integer.class)); + assertEquals("Table should only have one row", 1, getCount()); MockRequestContext context = new MockRequestContext(); MockFlowSession flowSession = new MockFlowSession(); flowSession.getDefinition().getAttributes().put("persistenceContext", "true"); @@ -180,13 +180,13 @@ public class HibernateFlowExecutionListenerTests extends TestCase { hibernateListener.sessionEnding(context, flowSession, "success", null); hibernateListener.sessionEnded(context, flowSession, "cancel", null); - assertEquals("Table should only have three rows", 1, (int)jdbcTemplate.queryForObject("select count(*) from T_BEAN", Integer.class)); + assertEquals("Table should only have three rows", 1, getCount()); assertSessionNotBound(); } public void testExceptionThrown() { - assertEquals("Table should only have one row", 1, (int)jdbcTemplate.queryForObject("select count(*) from T_BEAN", Integer.class)); + assertEquals("Table should only have one row", 1, getCount()); MockRequestContext context = new MockRequestContext(); MockFlowSession flowSession = new MockFlowSession(); flowSession.getDefinition().getAttributes().put("persistenceContext", "true"); @@ -196,15 +196,15 @@ public class HibernateFlowExecutionListenerTests extends TestCase { TestBean bean1 = new TestBean("Keith Donald"); hibernate.templateSave(bean1); - assertEquals("Table should still only have one row", 1, (int)jdbcTemplate.queryForObject("select count(*) from T_BEAN", Integer.class)); + assertEquals("Table should still only have one row", 1, getCount()); hibernateListener.exceptionThrown(context, new FlowExecutionException("bla", "bla", "bla")); - assertEquals("Table should still only have one row", 1, (int)jdbcTemplate.queryForObject("select count(*) from T_BEAN", Integer.class)); + assertEquals("Table should still only have one row", 1, getCount()); assertSessionNotBound(); } public void testExceptionThrownWithNothingBound() { - assertEquals("Table should only have one row", 1, (int)jdbcTemplate.queryForObject("select count(*) from T_BEAN", Integer.class)); + assertEquals("Table should only have one row", 1, getCount()); MockRequestContext context = new MockRequestContext(); MockFlowSession flowSession = new MockFlowSession(); flowSession.getDefinition().getAttributes().put("persistenceContext", "true"); @@ -221,7 +221,7 @@ public class HibernateFlowExecutionListenerTests extends TestCase { context.setActiveSession(flowSession); assertSessionBound(); - TestBean bean = hibernate.templateGet(TestBean.class, Long.valueOf(0)); + TestBean bean = hibernate.templateGet(TestBean.class, 0L); assertFalse("addresses should not be initialized", Hibernate.isInitialized(bean.getAddresses())); hibernateListener.paused(context); assertFalse("addresses should not be initialized", Hibernate.isInitialized(bean.getAddresses())); @@ -238,7 +238,7 @@ public class HibernateFlowExecutionListenerTests extends TestCase { return dataSource; } - private void populateDataBase(DataSource dataSource) throws Exception { + private void populateDataBase(DataSource dataSource) { ResourceDatabasePopulator databasePopulator = new ResourceDatabasePopulator(); databasePopulator.addScript(new ClassPathResource("test-data.sql", getClass())); DataSourceInitializer initializer = new DataSourceInitializer(); diff --git a/spring-webflow/src/test/java/org/springframework/webflow/persistence/HibernateFlowManagedPersistenceIntegrationTests.java b/spring-webflow/src/test/java/org/springframework/webflow/persistence/HibernateFlowManagedPersistenceIntegrationTests.java index c380c142..dd5baa16 100644 --- a/spring-webflow/src/test/java/org/springframework/webflow/persistence/HibernateFlowManagedPersistenceIntegrationTests.java +++ b/spring-webflow/src/test/java/org/springframework/webflow/persistence/HibernateFlowManagedPersistenceIntegrationTests.java @@ -4,8 +4,8 @@ import javax.sql.DataSource; import org.hibernate.Session; import org.hibernate.SessionFactory; + import org.springframework.core.io.ClassPathResource; -import org.springframework.core.io.Resource; import org.springframework.orm.hibernate5.HibernateTransactionManager; import org.springframework.orm.hibernate5.LocalSessionFactoryBean; import org.springframework.transaction.support.TransactionSynchronizationManager; @@ -28,10 +28,10 @@ public class HibernateFlowManagedPersistenceIntegrationTests extends AbstractFlo @Override protected Action incrementCountAction() { return new Action() { - public Event execute(RequestContext context) throws Exception { + public Event execute(RequestContext context) { assertSessionBound(); Session session = (Session) context.getFlowScope().get("persistenceContext"); - TestBean bean = (TestBean) session.get(TestBean.class, new Long(0)); + TestBean bean = session.get(TestBean.class, 0L); bean.incrementCount(); return new Event(this, "success"); } @@ -42,10 +42,10 @@ public class HibernateFlowManagedPersistenceIntegrationTests extends AbstractFlo protected Object assertCountAction() { return new Object() { @SuppressWarnings("unused") - public void execute(RequestContext context, int expected) throws Exception { + public void execute(RequestContext context, int expected) { assertSessionBound(); Session session = (Session) context.getFlowScope().get("persistenceContext"); - TestBean bean = (TestBean) session.get(TestBean.class, new Long(0)); + TestBean bean = session.get(TestBean.class, 0L); assertEquals(expected, bean.getCount()); } }; @@ -58,15 +58,14 @@ public class HibernateFlowManagedPersistenceIntegrationTests extends AbstractFlo /* private helper methods */ - @SuppressWarnings("cast") private SessionFactory getSessionFactory(DataSource dataSource) throws Exception { LocalSessionFactoryBean factory = new LocalSessionFactoryBean(); factory.setDataSource(dataSource); - factory.setMappingLocations(new Resource[] { + factory.setMappingLocations( new ClassPathResource("org/springframework/webflow/persistence/TestBean.hbm.xml"), - new ClassPathResource("org/springframework/webflow/persistence/TestAddress.hbm.xml") }); + new ClassPathResource("org/springframework/webflow/persistence/TestAddress.hbm.xml")); factory.afterPropertiesSet(); - return (SessionFactory) factory.getObject(); + return factory.getObject(); } } diff --git a/spring-webflow/src/test/java/org/springframework/webflow/persistence/HibernateHandlerFactory.java b/spring-webflow/src/test/java/org/springframework/webflow/persistence/HibernateHandlerFactory.java index dd12a866..495a166e 100644 --- a/spring-webflow/src/test/java/org/springframework/webflow/persistence/HibernateHandlerFactory.java +++ b/spring-webflow/src/test/java/org/springframework/webflow/persistence/HibernateHandlerFactory.java @@ -18,12 +18,10 @@ package org.springframework.webflow.persistence; import java.io.Serializable; import javax.sql.DataSource; -import org.hibernate.HibernateException; -import org.hibernate.Session; import org.hibernate.SessionFactory; import org.springframework.core.io.ClassPathResource; -import org.springframework.core.io.Resource; +import org.springframework.orm.hibernate5.HibernateCallback; import org.springframework.transaction.PlatformTransactionManager; public class HibernateHandlerFactory { @@ -56,13 +54,9 @@ public class HibernateHandlerFactory { } public void templateExecuteWithNativeSession(final SessionCallback callback) { - template.executeWithNativeSession(new org.springframework.orm.hibernate5.HibernateCallback() { - - @Override - public Void doInHibernate(Session session) throws HibernateException { - callback.doWithSession(session); - return null; - } + template.executeWithNativeSession((HibernateCallback) session -> { + callback.doWithSession(session); + return null; }); } @@ -75,11 +69,12 @@ public class HibernateHandlerFactory { } private SessionFactory getSessionFactory(DataSource dataSource) throws Exception { - org.springframework.orm.hibernate5.LocalSessionFactoryBean factory = new org.springframework.orm.hibernate5.LocalSessionFactoryBean(); + org.springframework.orm.hibernate5.LocalSessionFactoryBean factory = + new org.springframework.orm.hibernate5.LocalSessionFactoryBean(); factory.setDataSource(dataSource); - factory.setMappingLocations(new Resource[] { + factory.setMappingLocations( new ClassPathResource("org/springframework/webflow/persistence/TestBean.hbm.xml"), - new ClassPathResource("org/springframework/webflow/persistence/TestAddress.hbm.xml") }); + new ClassPathResource("org/springframework/webflow/persistence/TestAddress.hbm.xml")); factory.afterPropertiesSet(); return factory.getObject(); } diff --git a/spring-webflow/src/test/java/org/springframework/webflow/persistence/HibernatePersistenceContextPropagationTests.java b/spring-webflow/src/test/java/org/springframework/webflow/persistence/HibernatePersistenceContextPropagationTests.java index b5b0a002..de37d619 100644 --- a/spring-webflow/src/test/java/org/springframework/webflow/persistence/HibernatePersistenceContextPropagationTests.java +++ b/spring-webflow/src/test/java/org/springframework/webflow/persistence/HibernatePersistenceContextPropagationTests.java @@ -41,12 +41,15 @@ public class HibernatePersistenceContextPropagationTests extends AbstractPersist hibernate.templateSave(new TestBean(rowCount++, "Keith Donald")); } if (!isCommited) { - assertEquals("Nothing should be committed yet", 1, - (int)getJdbcTemplate().queryForObject("select count(*) from T_BEAN", Integer.class)); + assertEquals("Nothing should be committed yet", 1, getCount()); } else { - assertEquals("All rows should be committed", rowCount, - (int)getJdbcTemplate().queryForObject("select count(*) from T_BEAN", Integer.class)); + assertEquals("All rows should be committed", rowCount, getCount()); } } + @SuppressWarnings("ConstantConditions") + private int getCount() { + return getJdbcTemplate().queryForObject("select count(*) from T_BEAN", Integer.class); + } + } diff --git a/spring-webflow/src/test/java/org/springframework/webflow/persistence/JpaFlowExecutionListenerTests.java b/spring-webflow/src/test/java/org/springframework/webflow/persistence/JpaFlowExecutionListenerTests.java index 7f6a8e7f..5b73f932 100644 --- a/spring-webflow/src/test/java/org/springframework/webflow/persistence/JpaFlowExecutionListenerTests.java +++ b/spring-webflow/src/test/java/org/springframework/webflow/persistence/JpaFlowExecutionListenerTests.java @@ -50,7 +50,7 @@ public class JpaFlowExecutionListenerTests extends TestCase { } public void testFlowCommitsInSingleRequest() { - assertEquals("Table should only have one row", 1, (int)jdbcTemplate.queryForObject("select count(*) from T_BEAN", Integer.class)); + assertEquals("Table should only have one row", 1, getCount()); MockRequestContext context = new MockRequestContext(); MockFlowSession flowSession = new MockFlowSession(); flowSession.getDefinition().getAttributes().put("persistenceContext", "true"); @@ -61,7 +61,7 @@ public class JpaFlowExecutionListenerTests extends TestCase { TestBean bean = new TestBean(1, "Keith Donald"); EntityManager em = EntityManagerFactoryUtils.getTransactionalEntityManager(entityManagerFactory); em.persist(bean); - assertEquals("Table should still only have one row", 1, (int)jdbcTemplate.queryForObject("select count(*) from T_BEAN", Integer.class)); + assertEquals("Table should still only have one row", 1, getCount()); EndState endState = new EndState(flowSession.getDefinitionInternal(), "success"); endState.getAttributes().put("commit", true); @@ -69,12 +69,17 @@ public class JpaFlowExecutionListenerTests extends TestCase { jpaListener.sessionEnding(context, flowSession, "success", null); jpaListener.sessionEnded(context, flowSession, "success", null); - assertEquals("Table should only have two rows", 2, (int)jdbcTemplate.queryForObject("select count(*) from T_BEAN", Integer.class)); + assertEquals("Table should only have two rows", 2, getCount()); assertSessionNotBound(); } + @SuppressWarnings("ConstantConditions") + private int getCount() { + return jdbcTemplate.queryForObject("select count(*) from T_BEAN", Integer.class); + } + public void testFlowCommitsAfterMultipleRequests() { - assertEquals("Table should only have one row", 1, (int)jdbcTemplate.queryForObject("select count(*) from T_BEAN", Integer.class)); + assertEquals("Table should only have one row", 1, getCount()); MockRequestContext context = new MockRequestContext(); MockFlowSession flowSession = new MockFlowSession(); flowSession.getDefinition().getAttributes().put("persistenceContext", "true"); @@ -85,7 +90,7 @@ public class JpaFlowExecutionListenerTests extends TestCase { TestBean bean1 = new TestBean(1, "Keith Donald"); EntityManager em = EntityManagerFactoryUtils.getTransactionalEntityManager(entityManagerFactory); em.persist(bean1); - assertEquals("Table should still only have one row", 1, (int)jdbcTemplate.queryForObject("select count(*) from T_BEAN", Integer.class)); + assertEquals("Table should still only have one row", 1, getCount()); jpaListener.paused(context); assertSessionNotBound(); @@ -93,7 +98,7 @@ public class JpaFlowExecutionListenerTests extends TestCase { TestBean bean2 = new TestBean(2, "Keith Donald"); em = EntityManagerFactoryUtils.getTransactionalEntityManager(entityManagerFactory); em.persist(bean2); - assertEquals("Table should still only have one row", 1, (int)jdbcTemplate.queryForObject("select count(*) from T_BEAN", Integer.class)); + assertEquals("Table should still only have one row", 1, getCount()); assertSessionBound(); EndState endState = new EndState(flowSession.getDefinitionInternal(), "success"); @@ -102,13 +107,13 @@ public class JpaFlowExecutionListenerTests extends TestCase { jpaListener.sessionEnding(context, flowSession, "success", null); jpaListener.sessionEnded(context, flowSession, "success", null); - assertEquals("Table should only have three rows", 3, (int)jdbcTemplate.queryForObject("select count(*) from T_BEAN", Integer.class)); + assertEquals("Table should only have three rows", 3, getCount()); assertSessionNotBound(); } public void testCancelEndState() { - assertEquals("Table should only have one row", 1, (int)jdbcTemplate.queryForObject("select count(*) from T_BEAN", Integer.class)); + assertEquals("Table should only have one row", 1, getCount()); MockRequestContext context = new MockRequestContext(); MockFlowSession flowSession = new MockFlowSession(); flowSession.getDefinition().getAttributes().put("persistenceContext", "true"); @@ -119,19 +124,19 @@ public class JpaFlowExecutionListenerTests extends TestCase { TestBean bean = new TestBean(1, "Keith Donald"); EntityManager em = EntityManagerFactoryUtils.getTransactionalEntityManager(entityManagerFactory); em.persist(bean); - assertEquals("Table should still only have one row", 1, (int)jdbcTemplate.queryForObject("select count(*) from T_BEAN", Integer.class)); + assertEquals("Table should still only have one row", 1, getCount()); EndState endState = new EndState(flowSession.getDefinitionInternal(), "cancel"); endState.getAttributes().put("commit", false); flowSession.setState(endState); jpaListener.sessionEnding(context, flowSession, "cancel", null); jpaListener.sessionEnded(context, flowSession, "success", null); - assertEquals("Table should only have two rows", 1, (int)jdbcTemplate.queryForObject("select count(*) from T_BEAN", Integer.class)); + assertEquals("Table should only have two rows", 1, getCount()); assertSessionNotBound(); } public void testNoCommitAttributeSetOnEndState() { - assertEquals("Table should only have one row", 1, (int)jdbcTemplate.queryForObject("select count(*) from T_BEAN", Integer.class)); + assertEquals("Table should only have one row", 1, getCount()); MockRequestContext context = new MockRequestContext(); MockFlowSession flowSession = new MockFlowSession(); flowSession.getDefinition().getAttributes().put("persistenceContext", "true"); @@ -144,13 +149,13 @@ public class JpaFlowExecutionListenerTests extends TestCase { jpaListener.sessionEnding(context, flowSession, "cancel", null); jpaListener.sessionEnded(context, flowSession, "success", null); - assertEquals("Table should only have three rows", 1, (int)jdbcTemplate.queryForObject("select count(*) from T_BEAN", Integer.class)); + assertEquals("Table should only have three rows", 1, getCount()); assertSessionNotBound(); } public void testExceptionThrown() { - assertEquals("Table should only have one row", 1, (int)jdbcTemplate.queryForObject("select count(*) from T_BEAN", Integer.class)); + assertEquals("Table should only have one row", 1, getCount()); MockRequestContext context = new MockRequestContext(); MockFlowSession flowSession = new MockFlowSession(); flowSession.getDefinition().getAttributes().put("persistenceContext", "true"); @@ -161,15 +166,15 @@ public class JpaFlowExecutionListenerTests extends TestCase { TestBean bean = new TestBean(1, "Keith Donald"); EntityManager em = EntityManagerFactoryUtils.getTransactionalEntityManager(entityManagerFactory); em.persist(bean); - assertEquals("Table should still only have one row", 1, (int)jdbcTemplate.queryForObject("select count(*) from T_BEAN", Integer.class)); + assertEquals("Table should still only have one row", 1, getCount()); jpaListener.exceptionThrown(context, new FlowExecutionException("bla", "bla", "bla")); - assertEquals("Table should still only have one row", 1, (int)jdbcTemplate.queryForObject("select count(*) from T_BEAN", Integer.class)); + assertEquals("Table should still only have one row", 1, getCount()); assertSessionNotBound(); } public void testExceptionThrownWithNothingBound() { - assertEquals("Table should only have one row", 1, (int)jdbcTemplate.queryForObject("select count(*) from T_BEAN", Integer.class)); + assertEquals("Table should only have one row", 1, getCount()); MockRequestContext context = new MockRequestContext(); MockFlowSession flowSession = new MockFlowSession(); flowSession.getDefinition().getAttributes().put("persistenceContext", "true"); @@ -187,7 +192,7 @@ public class JpaFlowExecutionListenerTests extends TestCase { return dataSource; } - private void populateDataBase(DataSource dataSource) throws Exception { + private void populateDataBase(DataSource dataSource) { ResourceDatabasePopulator databasePopulator = new ResourceDatabasePopulator(); databasePopulator.addScript(new ClassPathResource("test-data.sql", this.getClass())); DataSourceInitializer initializer = new DataSourceInitializer(); @@ -196,7 +201,7 @@ public class JpaFlowExecutionListenerTests extends TestCase { initializer.afterPropertiesSet(); } - private EntityManagerFactory getEntityManagerFactory(DataSource dataSource) throws Exception { + private EntityManagerFactory getEntityManagerFactory(DataSource dataSource) { LocalContainerEntityManagerFactoryBean factory = new LocalContainerEntityManagerFactoryBean(); factory.setDataSource(dataSource); factory.setPersistenceXmlLocation("classpath:org/springframework/webflow/persistence/persistence.xml"); diff --git a/spring-webflow/src/test/java/org/springframework/webflow/persistence/JpaFlowManagedPersistenceIntegrationTests.java b/spring-webflow/src/test/java/org/springframework/webflow/persistence/JpaFlowManagedPersistenceIntegrationTests.java index 14e1b6a5..453ab0fc 100644 --- a/spring-webflow/src/test/java/org/springframework/webflow/persistence/JpaFlowManagedPersistenceIntegrationTests.java +++ b/spring-webflow/src/test/java/org/springframework/webflow/persistence/JpaFlowManagedPersistenceIntegrationTests.java @@ -18,7 +18,7 @@ public class JpaFlowManagedPersistenceIntegrationTests extends AbstractFlowManag private EntityManagerFactory entityManagerFactory; @Override - protected FlowExecutionListener createFlowExecutionListener() throws Exception { + protected FlowExecutionListener createFlowExecutionListener() { entityManagerFactory = getEntityManagerFactory(getDataSource()); JpaTransactionManager tm = new JpaTransactionManager(entityManagerFactory); return new JpaFlowExecutionListener(entityManagerFactory, tm); @@ -27,11 +27,10 @@ public class JpaFlowManagedPersistenceIntegrationTests extends AbstractFlowManag @Override protected Action incrementCountAction() { return new Action() { - @SuppressWarnings("cast") - public Event execute(RequestContext context) throws Exception { + public Event execute(RequestContext context) { assertSessionBound(); EntityManager em = (EntityManager) context.getFlowScope().get("persistenceContext"); - TestBean bean = (TestBean) em.getReference(TestBean.class, new Long(0)); + TestBean bean = em.getReference(TestBean.class, 0L); bean.incrementCount(); assertNotNull(bean); return new Event(this, "success"); @@ -42,11 +41,11 @@ public class JpaFlowManagedPersistenceIntegrationTests extends AbstractFlowManag @Override protected Object assertCountAction() { return new Object() { - @SuppressWarnings({ "unused", "cast" }) - public void execute(RequestContext context, int expected) throws Exception { + @SuppressWarnings("unused") + public void execute(RequestContext context, int expected) { assertSessionBound(); EntityManager em = (EntityManager) context.getFlowScope().get("persistenceContext"); - TestBean bean = (TestBean) em.getReference(TestBean.class, new Long(0)); + TestBean bean = em.getReference(TestBean.class, 0L); assertEquals(expected, bean.getCount()); } }; @@ -59,7 +58,7 @@ public class JpaFlowManagedPersistenceIntegrationTests extends AbstractFlowManag /* private helper methods */ - private EntityManagerFactory getEntityManagerFactory(DataSource dataSource) throws Exception { + private EntityManagerFactory getEntityManagerFactory(DataSource dataSource) { LocalContainerEntityManagerFactoryBean factory = new LocalContainerEntityManagerFactoryBean(); factory.setDataSource(dataSource); factory.setPersistenceXmlLocation("classpath:org/springframework/webflow/persistence/persistence.xml"); diff --git a/spring-webflow/src/test/java/org/springframework/webflow/persistence/JpaPersistenceContextPropagationTests.java b/spring-webflow/src/test/java/org/springframework/webflow/persistence/JpaPersistenceContextPropagationTests.java index ed1b9d72..9b32704f 100644 --- a/spring-webflow/src/test/java/org/springframework/webflow/persistence/JpaPersistenceContextPropagationTests.java +++ b/spring-webflow/src/test/java/org/springframework/webflow/persistence/JpaPersistenceContextPropagationTests.java @@ -50,10 +50,10 @@ public class JpaPersistenceContextPropagationTests extends AbstractPersistenceCo } if (!isCommited) { assertEquals("Nothing should be committed yet", 1, - (int)getJdbcTemplate().queryForObject("select count(*) from T_BEAN", Integer.class)); + getCount()); } else { assertEquals("All rows should be committed", rowCount, - (int)getJdbcTemplate().queryForObject("select count(*) from T_BEAN", Integer.class)); + getCount()); } } @@ -66,4 +66,9 @@ public class JpaPersistenceContextPropagationTests extends AbstractPersistenceCo return factory.getObject(); } + @SuppressWarnings("ConstantConditions") + private int getCount() { + return getJdbcTemplate().queryForObject("select count(*) from T_BEAN", Integer.class); + } + } diff --git a/spring-webflow/src/test/java/org/springframework/webflow/test/SearchFlowExecutionTests.java b/spring-webflow/src/test/java/org/springframework/webflow/test/SearchFlowExecutionTests.java index 1c5ac261..cd70cf3c 100644 --- a/spring-webflow/src/test/java/org/springframework/webflow/test/SearchFlowExecutionTests.java +++ b/spring-webflow/src/test/java/org/springframework/webflow/test/SearchFlowExecutionTests.java @@ -86,13 +86,9 @@ public class SearchFlowExecutionTests extends AbstractXmlFlowExecutionTests { protected void configureFlowBuilderContext(MockFlowBuilderContext builderContext) { Flow mockDetailFlow = new Flow("detail-flow"); - mockDetailFlow.setInputMapper(new Mapper() { - @SuppressWarnings("unchecked") - public MappingResults map(Object source, Object target) { - assertEquals("id of value 1 not provided as input by calling search flow", new Long(1), - ((AttributeMap) source).get("id")); - return null; - } + mockDetailFlow.setInputMapper((source, target) -> { + assertEquals("id of value 1 not provided as input by calling search flow", 1L, ((AttributeMap) source).get("id")); + return null; }); // test responding to finish result new EndState(mockDetailFlow, "finish");