Announcement

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

    Export can be made when session is expired

    Hello,
    I used 3.1 Pro version and i encountered a problem. When I start an export and the session is expired the export don't know how to interpret status "RPCResponse.STATUS_LOGIN_REQUIRED", so an empty csv file is exported.

    Test case:
    I had a grid, set on it a datasource and I had a custom datasource. i check in my datasource if the session is expired, and if the session if expired I redirect user to login page. If I made a sorting or filtering on grid, and the session is expired, I'm redirected to login page. But if I press an export button that call grid.exportData(exportRequest); I received an exception and an empty csv file.
    Below is the exception:
    java.lang.NullPointerException
    at com.isomorphic.rpc.DataExport.exportResultSet(DataExport.java:488)
    at com.isomorphic.rpc.DataExport.exportResultSet(DataExport.java:392)
    at com.isomorphic.rpc.RPCManager.completeResponse(RPCManager.java:986)
    at com.isomorphic.rpc.RPCManager.send(RPCManager.java:582)
    at com.isomorphic.servlet.IDACall.processRPCTransaction(IDACall.java:156)
    at com.isomorphic.servlet.IDACall.processRequest(IDACall.java:121)
    at com.isomorphic.servlet.IDACall.doPost(IDACall.java:73)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
    at com.isomorphic.servlet.BaseServlet.service(BaseServlet.java:152)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
    at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:487)
    at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:362)
    at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
    at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
    at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:729)
    at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:405)
    at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
    at org.mortbay.jetty.handler.RequestLogHandler.handle(RequestLogHandler.java:49)
    at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
    at org.mortbay.jetty.Server.handle(Server.java:324)
    at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:505)
    at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:843)
    at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:647)
    at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:211)
    at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:380)
    at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:395)
    at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:488)


    Thank you,
    Marius

    #2
    That line is a comment in the latest patched version.

    Please remember to test with the latest patched build (from smartclient.com/builds) and to always post your full version number.

    Also, even with a correct line number, there doesn't seem to be any way this issue could be related to session expiry, so if the issue still exists for you with the latest build, please clarify how it can be reproduced.

    Comment


      #3
      This are the exception when I used smartGWT 3.1 Original release (11/20/2012). Is just a simple export called grid.exportData(exportRequest); and the datasource method excecute is below:
      @Override
      public DSResponse execute(DSRequest req) throws Exception {
      DSResponse response = new DSResponse();
      HttpSession session = req.getHttpServletRequest().getSession();
      User user = (User) session.getAttribute("user");

      if (user== null) {
      response.setStatus(RPCResponse.STATUS_LOGIN_REQUIRED);
      return response;
      } else {
      ....
      }
      java.lang.NullPointerException
      at com.isomorphic.rpc.DataExport.exportResultSet(DataExport.java:530)
      at com.isomorphic.rpc.DataExport.exportResultSet(DataExport.java:406)
      at com.isomorphic.rpc.RPCManager.completeResponse(RPCManager.java:1032)
      at com.isomorphic.rpc.RPCManager.send(RPCManager.java:586)
      at com.isomorphic.servlet.IDACall.processRPCTransaction(IDACall.java:173)
      at com.isomorphic.servlet.IDACall.processRequest(IDACall.java:138)
      at com.isomorphic.servlet.IDACall.doPost(IDACall.java:74)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
      at com.isomorphic.servlet.BaseServlet.service(BaseServlet.java:152)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
      at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:487)
      at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:362)
      at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
      at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
      at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:729)
      at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:405)
      at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
      at org.mortbay.jetty.handler.RequestLogHandler.handle(RequestLogHandler.java:49)
      at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
      at org.mortbay.jetty.Server.handle(Server.java:324)
      at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:505)
      at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:843)
      at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:647)
      at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:205)
      at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:380)
      at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:395)
      at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:488)

      Comment


        #4
        Use the latest patched version.

        Comment


          #5
          Problem is in all version, please se the attached project

          Hello,
          I made a simple application for you, to saw how can I reproduce the error. I tried with 3 versions of smarGWT and all give the same errors. Please investigate this because is a bug.
          I attached some files from my project to saw how you can reproduce this bug. If you need the entire application I can sent it, but I cannot attach here. I attached just basic files.

          Thank you,
          Marius.
          Attached Files

          Comment


            #6
            We don't need you to try a bunch of different versions, just the latest patched version from smartclient.com/builds.

            This is always the version to use.

            You continue to show stack traces that indicate you have not tried the latest patched version.

            Comment


              #7
              I tried also with the latest version (04 march 2013). Please look on my code, the error can be reproduced quickly. Please tell me if something is not clear for you.

              Comment


                #8
                If you think you've actually successfully installed the latest build, show a stack trace from that build.

                We won't be trying to run your code. It's not ready-to-run, it's just snippets. It could take a long while to get running, and we haven't even got confirmation that you're using the right build yet, let alone any clear indication that there's a framework bug here.

                Comment


                  #9
                  Hello,
                  I used the latest patch I found (06 march 2013 nightly build).
                  The stacktrace is almost the same with the one I sent on 5th Mar 2013, 05:13
                  Please see below the entire log. Also I attached my entire test application as zip
                  archive. but I remade it in order to be able to attach it here. Please at least look
                  at the code and tell me if is something wrong. The session time-out value is set to 1 minute
                  if after more than one minute you click on refresh button, you can see a message that the session is expired.
                  But if you press on the export button when the session is expired, you will see this error in logs, and
                  the client export a csv file that contains just headers


                  === 2013-03-07 08:40:54,194 [l0-2] INFO IDACall - Performing 1 operation(s)
                  === 2013-03-07 08:40:54,194 [l0-2] DEBUG DeclarativeSecurity - Processing security checks for DataSource null, field null
                  === 2013-03-07 08:40:54,194 [l0-2] DEBUG DeclarativeSecurity - DataSource test is not in the pre-checked list, processing...
                  === 2013-03-07 08:40:54,194 [l0-2] DEBUG AppBase - [builtinApplication.test_fetch] No userTypes defined, allowing anyone access to all operations for this application
                  === 2013-03-07 08:40:54,194 [l0-2] DEBUG AppBase - [builtinApplication.test_fetch] No public zero-argument method named '_test_fetch' found, performing generic datasource operation
                  Execute
                  === 2013-03-07 08:40:54,194 [l0-2] ERROR IDACall - Error executing operation: test_fetch
                  java.lang.NullPointerException
                  at com.isomorphic.rpc.DataExport.exportResultSet(DataExport.java:530)
                  at com.isomorphic.rpc.DataExport.exportResultSet(DataExport.java:406)
                  at com.isomorphic.rpc.RPCManager.completeResponse(RPCManager.java:1033)
                  at com.isomorphic.rpc.RPCManager.send(RPCManager.java:586)
                  at com.isomorphic.servlet.IDACall.processRPCTransaction(IDACall.java:173)
                  at com.isomorphic.servlet.IDACall.processRequest(IDACall.java:138)
                  at com.isomorphic.servlet.IDACall.doPost(IDACall.java:74)
                  at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
                  at com.isomorphic.servlet.BaseServlet.service(BaseServlet.java:152)
                  at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
                  at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:487)
                  at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:362)
                  at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
                  at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
                  at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:729)
                  at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:405)
                  at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
                  at org.mortbay.jetty.handler.RequestLogHandler.handle(RequestLogHandler.java:49)
                  at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
                  at org.mortbay.jetty.Server.handle(Server.java:324)
                  at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:505)
                  at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:843)
                  at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:647)
                  at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:205)
                  at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:380)
                  at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:395)
                  at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:488)
                  === 2013-03-07 08:40:54,194 [l0-2] DEBUG DataExport - Export took 0ms
                  Attached Files

                  Comment


                    #10
                    An export downloads a file. Once we've told the browser to expect a file from the server, there is no way to do normal error handling if some kind of error occurs.

                    If you want to avoid the user encountering this situation, you should do some kind of "ping" request to the server to make sure the session is active (and that your server hasn't crashed) before initiating an export.

                    As far as the stack trace itself, there's no particular reason to try to correct this (it won't arise if you ensure that the session is valid), but for context, it's caused by returning an error response at the DataSource level when exporting has already begun. That's too late to signal an error like session expiry. If you need to signal an error like that, the code needs to be up in the servlet layer, for example, in a subclass of IDACall.

                    Comment

                    Working...
                    X