Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Exception logged when calling RPC method with a null argument

    Isomorphic,

    We upgraded from 12.1p to 13.1p and started to see the following warning logged now:

    Code:
    2025-01-22-10:50:55:305 -0500 com.isomorphic.base.Reflection WARN [http-nio-8180-exec-10] Caught exception in typesAsString() trying to process argument with type 'null' and value [null]
    java.lang.NullPointerException: Cannot invoke "java.lang.Class.getName()" because "this.type" is null
        at com.isomorphic.base.ReflectionArgument.getClassName(ReflectionArgument.java:89) ~[isomorphic_core_rpc.jar:?]
        at com.isomorphic.base.Reflection.typesAsString(Reflection.java:1148) [isomorphic_core_rpc.jar:?]
        at com.isomorphic.base.Reflection.adaptArgsAndInvoke(Reflection.java:973) [isomorphic_core_rpc.jar:?]
        at com.isomorphic.base.Reflection.adaptArgsAndInvoke(Reflection.java:957) [isomorphic_core_rpc.jar:?]
        at com.isomorphic.rpc.RPCDMI.execute(RPCDMI.java:337) [isomorphic_core_rpc.jar:?]
        at com.isomorphic.rpc.RPCDMI.execute(RPCDMI.java:67) [isomorphic_core_rpc.jar:?]
        at com.isomorphic.rpc.RPCRequest.execute(RPCRequest.java:274) [isomorphic_core_rpc.jar:?]
        at com.isomorphic.servlet.IDACall.handleRPCRequest(IDACall.java:391) [isomorphic_core_rpc.jar:?]
    I noticed that it occurs when passing a null value for an Integer argument, however, there may be other types impacted. The RPC method does get invoked with a null value.

    Using SmartClient Version: v13.1p_2025-01-13/Pro Deployment (built 2025-01-13)

    Thanks

    #2
    It definitely should not crash like this - it should at least provide more information.

    However, can you provide some more information here - is this because you've got a POJO as a parameter to the target method? If so, what is the type of the field on the POJO? If it's Integer (with a capital "I") it's obvious that the inbound null should make the field null.

    If it's "int", there is no clear interpretation of null - silently changing it to 0 would be too dangerous.

    Comment


      #3
      The type is java.lang.Integer.

      Here's some additional logging with DEBUG level.

      Code:
      2025-01-22-14:53:27:700 -0500 DEBUG [http-nio-8180-exec-6] adaptArgsAndInvoke:
      
       public java.util.Map *.DashboardRpc.initWidget(java.lang.Integer,java.lang.String) throws *.DatabaseException
      
      requiredArgs: [null, java.lang.String] optionalArgs: [com.isomorphic.servlet.RequestContext, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, javax.servlet.ServletContext, javax.servlet.http.HttpSession, com.isomorphic.rpc.RPCManager, com.isomorphic.rpc.RPCRequest, com.isomorphic.log.Logger]
      2025-01-22-14:53:27:700 -0500 DEBUG [http-nio-8180-exec-6] Successfully adapted required arg type: null to type: java.lang.Integer
      2025-01-22-14:53:27:700 -0500 DEBUG [http-nio-8180-exec-6] checking whether type: java.lang.String fulfills type: java.lang.String
      2025-01-22-14:53:27:700 -0500 DEBUG [http-nio-8180-exec-6] Successfully adapted required arg type: java.lang.String to type: java.lang.String
      2025-01-22-14:53:27:700 -0500 DEBUG [http-nio-8180-exec-6] method takes: 2 args. I've assembled: 2 args
      2025-01-22-14:53:27:700 -0500 DEBUG [http-nio-8180-exec-6] invoking method:
      java.util.Map *.DashboardRpc.initWidget(java.lang.Integer, java.lang.String) throws *.DatabaseException
      
      with arg types: null, java.lang.String

      Comment

      Working...
      X