glassfish
  1. glassfish
  2. GLASSFISH-19957

asadmin list-batch-job-executions with a wrong instance id throws null pointer exceptions

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 4.0_b79
    • Fix Version/s: 4.0_b83
    • Component/s: batch
    • Labels:
      None

      Description

      Tested with Glassfish4.0 build 80

      1) Run asadmin list-batch-job-executions -i <SOME_ID>

      SOME_ID is a non-existing instance id.

      Issue--> Throws Null pointer exceptions in the logs.

      [2013-03-20T15:07:33.578+0530] [glassfish 4.0] [WARNING] [] [] [tid: _ThreadID=43 _ThreadName=admin-listener(5)] [timeMillis: 1363772253578] [levelValue: 900] [[
      Exception during command
      java.lang.NullPointerException
      at com.ibm.jbatch.container.api.impl.JobOperatorImpl.getJobExecutions(JobOperatorImpl.java:174)
      at org.glassfish.batch.ListBatchJobExecutions.getJobExecutionForInstance(ListBatchJobExecutions.java:182)
      at org.glassfish.batch.ListBatchJobExecutions.executeCommand(ListBatchJobExecutions.java:120)
      at org.glassfish.batch.AbstractListCommand.execute(AbstractListCommand.java:99)
      at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:527)
      at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:523)
      at java.security.AccessController.doPrivileged(Native Method)
      at javax.security.auth.Subject.doAs(Subject.java:356)
      at com.sun.enterprise.v3.admin.CommandRunnerImpl$2.execute(CommandRunnerImpl.java:522)
      at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:546)
      at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1423)
      at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1500(CommandRunnerImpl.java:108)
      at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1761)
      at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1674)
      at org.glassfish.admin.rest.resources.admin.CommandResource.executeCommand(CommandResource.java:396)
      at org.glassfish.admin.rest.resources.admin.CommandResource.execCommandSimpInMultOut(CommandResource.java:234)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:601)
      at org.glassfish.jersey.server.model.internal.ResourceMethodInvocationHandlerFactory$1.invoke(ResourceMethodInvocationHandlerFactory.java:81)
      at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.invoke(AbstractJavaResourceMethodDispatcher.java:125)
      at org.glassfish.jersey.server.model.internal.JavaResourceMethodDispatcherProvider$ResponseOutInvoker.doDispatch(JavaResourceMethodDispatcherProvider.java:152)
      at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.dispatch(AbstractJavaResourceMethodDispatcher.java:91)
      at org.glassfish.jersey.server.model.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:350)
      at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:345)
      at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:102)
      at org.glassfish.jersey.server.ServerRuntime$1.run(ServerRuntime.java:214)
      at org.glassfish.jersey.internal.Errors$1.call(Errors.java:207)
      at org.glassfish.jersey.internal.Errors$1.call(Errors.java:203)
      at org.glassfish.jersey.internal.Errors.process(Errors.java:251)
      at org.glassfish.jersey.internal.Errors.process(Errors.java:233)
      at org.glassfish.jersey.internal.Errors.process(Errors.java:203)
      at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:317)
      at org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:190)
      at org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:865)
      at org.glassfish.jersey.grizzly2.httpserver.GrizzlyHttpContainer.service(GrizzlyHttpContainer.java:325)
      at org.glassfish.admin.rest.adapter.JerseyContainerCommandService$3.service(JerseyContainerCommandService.java:161)
      at org.glassfish.admin.rest.adapter.RestAdapter.service(RestAdapter.java:181)
      at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:246)
      at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:191)
      at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:168)
      at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:189)
      at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
      at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:288)
      at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:206)
      at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:136)
      at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:114)
      at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
      at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:838)
      at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:113)
      at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:115)
      at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:55)
      at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:135)
      at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:564)
      at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:544)
      at java.lang.Thread.run(Thread.java:722)
      ]]

        Activity

        Hide
        Mahesh Kannan added a comment -

        This is really a RI bug as can be seen below:

        java.lang.NullPointerException
        at com.ibm.jbatch.container.api.impl.JobOperatorImpl.getJobExecutions(JobOperatorImpl.java:167)
        at org.glassfish.batch.ListBatchJobExecutions.getJobExecutionForInstance(ListBatchJobExecutions.java:183)

        Show
        Mahesh Kannan added a comment - This is really a RI bug as can be seen below: java.lang.NullPointerException at com.ibm.jbatch.container.api.impl.JobOperatorImpl.getJobExecutions(JobOperatorImpl.java:167) at org.glassfish.batch.ListBatchJobExecutions.getJobExecutionForInstance(ListBatchJobExecutions.java:183)
        Hide
        ScottKurz added a comment -

        I'm wondering if this is a valid testcase.

        The API doesn't give you a way to new up a JobInstance... you have to get one from another JobOperator method.

        So how did you go about passing a JobInstance with "non-existing instance id" to
        getJobExecutions() ?

        Show
        ScottKurz added a comment - I'm wondering if this is a valid testcase. The API doesn't give you a way to new up a JobInstance... you have to get one from another JobOperator method. So how did you go about passing a JobInstance with "non-existing instance id" to getJobExecutions() ?
        Hide
        Mahesh Kannan added a comment -

        Scott,
        I think the submitter is expecting (at the minimum a) NoSuchJobInstanceException from getJobExecutions(instanceId).
        Is it possible for

        com.ibm.jbatch.container.api.impl.JobOperatorImpl.getJobExecutions(JobOperatorImpl.java:174)

        to throw NoSuchJobInstanceException?

        Show
        Mahesh Kannan added a comment - Scott, I think the submitter is expecting (at the minimum a) NoSuchJobInstanceException from getJobExecutions(instanceId). Is it possible for com.ibm.jbatch.container.api.impl.JobOperatorImpl.getJobExecutions(JobOperatorImpl.java:174) to throw NoSuchJobInstanceException?
        Hide
        ScottKurz added a comment -

        Mahesh,

        I'm not saying we've proven it's OK to throw an NPE... but I'd like to ask for more details on the test.

        The spec API provides methods:
        public List<JobExecution> getJobExecutions(JobInstance instance)
        public JobExecution getJobExecution(long executionId)

        but there is no:
        List<JobExecution> getJobExecutions(long instanceId)

        Did you just new up a JobInstance with an invalid instanceId?

        Show
        ScottKurz added a comment - Mahesh, I'm not saying we've proven it's OK to throw an NPE... but I'd like to ask for more details on the test. The spec API provides methods: public List<JobExecution> getJobExecutions(JobInstance instance) public JobExecution getJobExecution(long executionId) but there is no: List<JobExecution> getJobExecutions(long instanceId) Did you just new up a JobInstance with an invalid instanceId?
        Hide
        Mahesh Kannan added a comment -

        OK, this is not an RI bug but actually a bug in ListBatchJobExecutions command.

        It is actually passing a null jobInstance to BatchRuntime.getJobOperator().getJobExecutions(jobInstance) when an invalid instanceId is passed.

        Removing the 'Batch RI' prefix

        Show
        Mahesh Kannan added a comment - OK, this is not an RI bug but actually a bug in ListBatchJobExecutions command. It is actually passing a null jobInstance to BatchRuntime.getJobOperator().getJobExecutions(jobInstance) when an invalid instanceId is passed. Removing the 'Batch RI' prefix
        Hide
        Mahesh Kannan added a comment -

        svn commit -m "Integrate b22 jars. Also Fix for 19957. QL Passed"
        Sending appserver/batch/glassfish-batch-commands/src/main/java/org/glassfish/batch/AbstractListCommand.java
        Sending appserver/batch/glassfish-batch-commands/src/main/java/org/glassfish/batch/ListBatchJobExecutions.java
        Sending appserver/pom.xml
        Transmitting file data ...
        Committed revision 61030.

        Show
        Mahesh Kannan added a comment - svn commit -m "Integrate b22 jars. Also Fix for 19957. QL Passed" Sending appserver/batch/glassfish-batch-commands/src/main/java/org/glassfish/batch/AbstractListCommand.java Sending appserver/batch/glassfish-batch-commands/src/main/java/org/glassfish/batch/ListBatchJobExecutions.java Sending appserver/pom.xml Transmitting file data ... Committed revision 61030.

          People

          • Assignee:
            Mahesh Kannan
            Reporter:
            arunkumar_s
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: