[
https://issues.apache.org/jira/browse/OWB-307?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12838586#action_12838586
]
David Blevins commented on OWB-307:
-----------------------------------
Here's the code we have in OpenEJB for setParameters, The boxing/uboxing
should happen automatically at the vm level, but we do check types are
respected.
public void setParameters(Object[] parameters) {
if (operation.isCallback()) {
throw new IllegalStateException(getIllegalParameterAccessMessage());
}
if (parameters == null) throw new NullPointerException("parameters is
null");
if (parameters.length != this.parameters.length) {
throw new IllegalArgumentException("Expected " +
this.parameters.length + " parameters, but only got " + parameters.length + "
parameters");
}
for (int i = 0; i < parameters.length; i++) {
Object parameter = parameters[i];
Class<?> parameterType = parameterTypes[i];
if (parameter == null) {
if (parameterType.isPrimitive()) {
throw new IllegalArgumentException("Expected parameter " +
i + " to be primitive type " + parameterType.getName() +
", but got a parameter that is null");
}
} else if (!parameterType.isInstance(parameter)) {
throw new IllegalArgumentException("Expected parameter " + i +
" to be of type " + parameterType.getName() +
", but got a parameter of type " +
parameter.getClass().getName());
}
}
System.arraycopy(parameters, 0, this.parameters, 0, parameters.length);
}
> InvocationContext.setParameters() and primitive vs. wrapped types
> -----------------------------------------------------------------
>
> Key: OWB-307
> URL: https://issues.apache.org/jira/browse/OWB-307
> Project: OpenWebBeans
> Issue Type: Bug
> Affects Versions: M3
> Reporter: Eric Covener
> Assignee: Gurkan Erdogdu
> Fix For: 1.0.0
>
> Original Estimate: 2h
> Remaining Estimate: 2h
>
> right now setParameters() on a method with primtiive types does not permit
> the wrapped types to be set.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.