Announcement

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

    Serverside DSRequest exception source code question

    Hi Isomorphic,

    I have a problem with a server side exception where I don't know what is causing it.
    This request happens in a servlet (=no RPCManager available).
    Can you help with what might cause of this exception by looking into the code of DSRequest.java:4859? I'm using v10.1p_2016-04-27.

    Server log:
    Code:
    java.lang.NullPointerException
        at com.isomorphic.datasource.DSRequest.populateModifierAndCreatorFields(DSRequest.java:4859)
        at com.isomorphic.datasource.DSRequest.execute(DSRequest.java:2674)
        at com.lmscompany.lms.server.ReceiveMail.receiveEmail(ReceiveMail.java:284)
        at com.lmscompany.lms.server.ReceiveMail.doGet(ReceiveMail.java:78)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:622)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:291)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at com.isomorphic.servlet.CompressionFilter._doFilter(CompressionFilter.java:260)
        at com.isomorphic.servlet.BaseFilter.doFilter(BaseFilter.java:88)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:212)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)
        at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
        at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:616)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:521)
        at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1096)
        at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:674)
        at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1500)
        at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1456)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
        at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
        at java.lang.Thread.run(Unknown Source)
    Code fragment, if needed:
    Code:
                                DSRequest leadUploadReq = new DSRequest(DatasourceEnum.V_LEADUPLOAD.getValue(), DataSource.OP_ADD);
                                Helper.prepareRequest(leadUploadReq, userID, receiveMailRequestContext);
                                leadUploadReq.setValues(dataImported);
                                final DSResponse leadUploadResp = leadUploadReq.execute();
    Request context is generated using:
    RequestContext receiveMailRequestContext = RequestContext.instance(this, servletRequest, servletResponse);

    Code for prepareRequest:
    Code:
        public static void prepareRequest(DSRequest dsRequest, Long userID, RequestContext requestContext) throws Exception {
            prepareRequest(dsRequest, null, null, userID, requestContext);
        }
    
        public static void prepareRequest(DSRequest dsRequest, RPCManager rpcManager, DSTransaction dsTransaction, Long userID,
                RequestContext requestContext) throws Exception {
            if (rpcManager != null) {
                dsRequest.setRPCManager(rpcManager);
            } else {
                prepareRequest(dsRequest, requestContext);
                if (dsTransaction != null) {
                    dsRequest.setDSTransaction(dsTransaction);
                    if (userID != null && dsTransaction.getUserId() == null) {
                        dsTransaction.setUserId(userID.toString());
                        dsTransaction.setClientRequest(false);
                    }
                } else if (dsTransaction == null) {
                    if (userID != null) {
                        dsRequest.setUserId(userID.toString());
                        dsRequest.setClientRequest(false);
                    }
                }
            }
        }
    This is an important one for me.

    Thank you & Best regards
    Blama

    #2
    The .ds.xml the request goes to has these two possibly related fields:
    Code:
            <field name="CREATED_BY" type="creator">
                <title><fmt:message key="createdBy" /></title>
            </field>
            <field name="CREATED_AT" type="creatorTimestamp">
                <title><fmt:message key="createdAt" /></title>
            </field>

    Comment


      #3
      This looks like you created a DSRequest that does not have values at all (DSRequest.getValues() is returning null. Possibly the variable you used to populate the values is actually null.

      Comment


        #4
        We've made a change to address this issue anyway. Please try the next nightly build, dated May 5.

        Regards
        Isomorphic Software

        Comment


          #5
          Hi Isomorphic,

          great, thank you.
          You were right with your assumption. It's not null, but the size() is 0 (which is an error my code should handle here). I don't know if this makes any difference for your fix.

          Best regards
          Blama

          Comment


            #6
            Hi Isomorphic,

            after updating to v10.1p_2016-05-23 I can confirm that the behavior changed. I also handled trying adding an empty list in my code, as this is not a valid input for me either.

            Thank you & Best regards
            Blama

            Comment

            Working...
            X