Well, we got a DMI call which pass trhough some parameters to its Java class.
This is the source code:
// Client side-Javascript Code
click: function (formulario) { // Or whatever event to call dmi function
isc.DMI.call({
appID: "MyJavaClass",
className: "com.redur.MyJavaClass",
methodName: "myMethod",
arguments: [
value1,
value2,
...
value_N],
callback : function (response, data) {
// Our callback function to do whatever
}
});
}
// Server Side-Java code
package com.redur;
import any.package.from.any.Library;
public class MyJavaClass extends SqlMapClientDaoSupport {
public void albsValorar (String field1, BigDecimal field2,... String field_N) throws Exception {
// Here things suppose to do to process data received, etc, etc
}
}
The main thing is that, if I define as BigDecimal (or another numeric class) on any input parameter of java method (in this case, field2, for example), and from client side I don't pass any value, and method receive a null value at that point, then we get a exception:
java.lang.IllegalArgumentException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.isomorphic.base.Reflection.adaptArgsAndInvoke(Reflection.java:973)
at com.isomorphic.base.Reflection.adaptArgsAndInvoke(Reflection.java:805)
at com.isomorphic.rpc.RPCDMI.execute(RPCDMI.java:309)
at com.isomorphic.rpc.RPCDMI.execute(RPCDMI.java:66)
at com.isomorphic.rpc.RPCRequest.execute(RPCRequest.java:231)
at com.isomorphic.servlet.IDACall.handleRPCRequest(IDACall.java:284)
at com.isomorphic.servlet.IDACall.processRPCTransaction(IDACall.java:168)
at com.isomorphic.servlet.IDACall.processRequest(IDACall.java:137)
at com.isomorphic.servlet.IDACall.doPost(IDACall.java:73)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:647)
at com.isomorphic.servlet.BaseServlet.service(BaseServlet.java:152)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1023)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:312)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
How/Where can I define that these parameters are nullables?
What should I do to avoid exceptions when my parameters in origin are nulls?
We are working under:
v9.0p_2013-08-20/PowerEdition Development SC and IExplrorer 10.0.9200 navigator, Eclipse Helios and Tomcat 7.0.28
This is the source code:
// Client side-Javascript Code
click: function (formulario) { // Or whatever event to call dmi function
isc.DMI.call({
appID: "MyJavaClass",
className: "com.redur.MyJavaClass",
methodName: "myMethod",
arguments: [
value1,
value2,
...
value_N],
callback : function (response, data) {
// Our callback function to do whatever
}
});
}
// Server Side-Java code
package com.redur;
import any.package.from.any.Library;
public class MyJavaClass extends SqlMapClientDaoSupport {
public void albsValorar (String field1, BigDecimal field2,... String field_N) throws Exception {
// Here things suppose to do to process data received, etc, etc
}
}
The main thing is that, if I define as BigDecimal (or another numeric class) on any input parameter of java method (in this case, field2, for example), and from client side I don't pass any value, and method receive a null value at that point, then we get a exception:
java.lang.IllegalArgumentException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.isomorphic.base.Reflection.adaptArgsAndInvoke(Reflection.java:973)
at com.isomorphic.base.Reflection.adaptArgsAndInvoke(Reflection.java:805)
at com.isomorphic.rpc.RPCDMI.execute(RPCDMI.java:309)
at com.isomorphic.rpc.RPCDMI.execute(RPCDMI.java:66)
at com.isomorphic.rpc.RPCRequest.execute(RPCRequest.java:231)
at com.isomorphic.servlet.IDACall.handleRPCRequest(IDACall.java:284)
at com.isomorphic.servlet.IDACall.processRPCTransaction(IDACall.java:168)
at com.isomorphic.servlet.IDACall.processRequest(IDACall.java:137)
at com.isomorphic.servlet.IDACall.doPost(IDACall.java:73)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:647)
at com.isomorphic.servlet.BaseServlet.service(BaseServlet.java:152)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1023)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:312)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
How/Where can I define that these parameters are nullables?
What should I do to avoid exceptions when my parameters in origin are nulls?
We are working under:
v9.0p_2013-08-20/PowerEdition Development SC and IExplrorer 10.0.9200 navigator, Eclipse Helios and Tomcat 7.0.28
Comment