When a method invoked by OpenAMF takes an abstract
class as parameter, or a class that cannot be
instantiated (protected constructor for example), an
error occurs before the method is invoked. This happens
although the actual parameter is a concrete subclass of
the parameter type.
A possible fix is to modify the method
decodeParameter() of org.openamf.util.OpenAMFUtils:
public static Object decodeParameter(Object parameter,
Class parameterType) {
log.debug("Decoding parameter: " + parameter + " to
type: "
+ parameterType);
if (parameter == null) {
return null;
}
if (parameter instanceof ASObject) {
ASObject aso = (ASObject)parameter;
if (aso.getType() == null)
aso.setType(parameterType.getName());
else {
// If the class of the parameter is a subtype
// of the desired type, then use the
parameter type as desired
// type. The desired type might be an
abstract class that is not
// instantiable.
try {
Class actualClass =
Class.forName(aso.getType());
if
(parameterType.isAssignableFrom(actualClass))
parameterType = actualClass;
} catch (ClassNotFoundException e) {
}
}
}
(...)
}