Fixed possbile NullPointerException in parameterTypesString() (SWF-265).
This commit is contained in:
@@ -42,7 +42,9 @@ public class MethodKey implements Serializable {
|
||||
private String methodName;
|
||||
|
||||
/**
|
||||
* The method's actual parameter types.
|
||||
* The method's actual parameter types. Could contain null values
|
||||
* if the user did not specify a parameter type for the corresponding
|
||||
* parameter
|
||||
*/
|
||||
private Class[] parameterTypes;
|
||||
|
||||
@@ -81,7 +83,8 @@ public class MethodKey implements Serializable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the method parameter types.
|
||||
* Returns the method parameter types. Could contain null values
|
||||
* if no type was specified for the corresponding parameter.
|
||||
*/
|
||||
public Class[] getParameterTypes() {
|
||||
return parameterTypes;
|
||||
@@ -104,7 +107,7 @@ public class MethodKey implements Serializable {
|
||||
*/
|
||||
protected Method resolveMethod() throws InvalidMethodKeyException {
|
||||
try {
|
||||
return declaredType.getMethod(methodName, getParameterTypes());
|
||||
return declaredType.getMethod(methodName, parameterTypes);
|
||||
}
|
||||
catch (NoSuchMethodException e) {
|
||||
Method method = findMethodConsiderAssignableParameterTypes();
|
||||
@@ -126,7 +129,7 @@ public class MethodKey implements Serializable {
|
||||
if (candidateMethods[i].getName().equals(methodName)) {
|
||||
// Check if the method has the correct number of parameters.
|
||||
Class[] candidateParameterTypes = candidateMethods[i].getParameterTypes();
|
||||
if (candidateParameterTypes.length == getParameterTypes().length) {
|
||||
if (candidateParameterTypes.length == parameterTypes.length) {
|
||||
int numberOfCorrectArguments = 0;
|
||||
for (int j = 0; j < candidateParameterTypes.length; j++) {
|
||||
// Check if the candidate type is assignable to the sig
|
||||
@@ -139,8 +142,7 @@ public class MethodKey implements Serializable {
|
||||
}
|
||||
}
|
||||
else {
|
||||
// just match on a null param type (effectively
|
||||
// 'any')
|
||||
// just match on a null param type (effectively 'any')
|
||||
numberOfCorrectArguments++;
|
||||
}
|
||||
}
|
||||
@@ -240,7 +242,12 @@ public class MethodKey implements Serializable {
|
||||
private String parameterTypesString() {
|
||||
StringBuffer parameterTypesString = new StringBuffer();
|
||||
for (int i = 0; i < parameterTypes.length; i++) {
|
||||
parameterTypesString.append(ClassUtils.getShortName(parameterTypes[i]));
|
||||
if (parameterTypes[i] == null) {
|
||||
parameterTypesString.append("<any>");
|
||||
}
|
||||
else {
|
||||
parameterTypesString.append(ClassUtils.getShortName(parameterTypes[i]));
|
||||
}
|
||||
if (i < parameterTypes.length - 1) {
|
||||
parameterTypesString.append(',');
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ public class Parameter implements Serializable {
|
||||
/**
|
||||
* Create a new named parameter definition. Named parameters are capable of resolving
|
||||
* parameter values (arguments) from argument sources.
|
||||
* @param type the type the parameter type, may be null
|
||||
* @param type the parameter type, may be null
|
||||
* @param name the name the method argument expression (required)
|
||||
*/
|
||||
public Parameter(Class type, Expression name) {
|
||||
@@ -55,7 +55,8 @@ public class Parameter implements Serializable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the parameter type.
|
||||
* Returns the parameter type. Could be null if no parameter type
|
||||
* was specified.
|
||||
*/
|
||||
public Class getType() {
|
||||
return type;
|
||||
|
||||
@@ -96,7 +96,9 @@ public class Parameters implements Serializable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get an array containing each parameter type.
|
||||
* Get an array containing each parameter type. The resulting array
|
||||
* could contain null values if the corresponding parameters did
|
||||
* not specify a parameter type.
|
||||
* @return the types
|
||||
*/
|
||||
public Class[] getTypesArray() {
|
||||
|
||||
@@ -7,7 +7,8 @@ Changes in version 1.0.2 ()
|
||||
|
||||
Package org.springframework.binding
|
||||
* GenericConversionService.getConversionExecutor() now uses isAssignableFrom to detect situations
|
||||
where no conversion is necessary (SWF-264).
|
||||
where no conversion is necessary (SWF-264).
|
||||
* Fixed possbile NullPointerException in parameterTypesString() (SWF-265).
|
||||
|
||||
Package org.springframework.webflow.action
|
||||
* FormAction methods doBind() and createBinder() now declare "throws Exception".
|
||||
|
||||
@@ -64,7 +64,7 @@ public class ActionExecutor {
|
||||
throw e;
|
||||
}
|
||||
catch (Exception e) {
|
||||
// wrap the action as an ActionExecutionException
|
||||
// wrap the exception as an ActionExecutionException
|
||||
throw new ActionExecutionException(context.getActiveFlow().getId(),
|
||||
context.getCurrentState() != null ? context.getCurrentState().getId() : null, action, context
|
||||
.getAttributes(), e);
|
||||
|
||||
Reference in New Issue
Block a user