[infinispan-issues] [JBoss JIRA] (ISPN-6071) NullPointerException when executing RemoveExpiredCommand

Dan Berindei (JIRA) issues at jboss.org
Tue Apr 5 11:20:00 EDT 2016


     [ https://issues.jboss.org/browse/ISPN-6071?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Dan Berindei updated ISPN-6071:
-------------------------------
    Description: 
I'm running Infinispan 8.0.2 in a clustered environment with a replicated cache with a single file cache store. I'm seeing some NullPointerExceptions when Infinispan executes the RemoveExpiredCommand. Here's a snippet from the stack trace:

{noformat}
ISPN000136: Error executing command RemoveExpiredCommand, writing keys [...large key here...]
...
Caused by: java.lang.NullPointerException: null
	at org.infinispan.commands.write.RemoveExpiredCommand.setParameters(RemoveExpiredCommand.java:142)
{noformat}

Here's RemoveExpiredCommand#setParameters(...):
{code}   @Override
   public void setParameters(int commandId, Object[] args) {
      if (commandId != COMMAND_ID) throw new IllegalStateException("Invalid method id");
      int i = 0;
      commandInvocationId = (CommandInvocationId) args[i++];
      key = args[i++];
      value = args[i++];
      lifespan = (long) args[i++];
   }{code}

Line 142 is the cast of assignment of {{args\[3\]}} to primitive type long, which is causing the NPE. lifespan is actually a Long, not a long, and the {{perform()}} method seems to anticipate null lifespans at line 72:
{code}         // If the provided lifespan is null, that means it is a store removal command, so we can't compare lifespan
         if (lifespan == null) {}{code}

Could this be fixed by simply changing the cast at line 142 from (long) to (Long)?

  was:
I'm running Infinispan 8.0.2 in a clustered environment with a replicated cache with a single file cache store. I'm seeing some NullPointerExceptions when Infinispan executes the RemoveExpiredCommand. Here's a snippet from the stack trace:

{{ISPN000136: Error executing command RemoveExpiredCommand, writing keys [...large key here...]
...
Caused by: java.lang.NullPointerException: null
	at org.infinispan.commands.write.RemoveExpiredCommand.setParameters(RemoveExpiredCommand.java:142)}}

Here's RemoveExpiredCommand#setParameters(...):
{{   @Override
   public void setParameters(int commandId, Object[] args) {
      if (commandId != COMMAND_ID) throw new IllegalStateException("Invalid method id");
      int i = 0;
      commandInvocationId = (CommandInvocationId) args[i++];
      key = args[i++];
      value = args[i++];
      lifespan = (long) args[i++];
   }}}

Line 142 is the cast of assignment of args[3] to primitive type long, which is causing the NPE. lifespan is actually a Long, not a long, and the #perform() method seems to anticipate null lifespans at line 72:
{{         // If the provided lifespan is null, that means it is a store removal command, so we can't compare lifespan
         if (lifespan == null) {}}

Could this be fixed by simply changing the cast at line 142 from (long) to (Long)?



> NullPointerException when executing RemoveExpiredCommand
> --------------------------------------------------------
>
>                 Key: ISPN-6071
>                 URL: https://issues.jboss.org/browse/ISPN-6071
>             Project: Infinispan
>          Issue Type: Bug
>          Components: Expiration
>    Affects Versions: 8.0.2.Final
>            Reporter: Jason Hoetger
>            Assignee: William Burns
>             Fix For: 9.0.0.Alpha1, 8.1.4.Final, 8.2.2.Final
>
>
> I'm running Infinispan 8.0.2 in a clustered environment with a replicated cache with a single file cache store. I'm seeing some NullPointerExceptions when Infinispan executes the RemoveExpiredCommand. Here's a snippet from the stack trace:
> {noformat}
> ISPN000136: Error executing command RemoveExpiredCommand, writing keys [...large key here...]
> ...
> Caused by: java.lang.NullPointerException: null
> 	at org.infinispan.commands.write.RemoveExpiredCommand.setParameters(RemoveExpiredCommand.java:142)
> {noformat}
> Here's RemoveExpiredCommand#setParameters(...):
> {code}   @Override
>    public void setParameters(int commandId, Object[] args) {
>       if (commandId != COMMAND_ID) throw new IllegalStateException("Invalid method id");
>       int i = 0;
>       commandInvocationId = (CommandInvocationId) args[i++];
>       key = args[i++];
>       value = args[i++];
>       lifespan = (long) args[i++];
>    }{code}
> Line 142 is the cast of assignment of {{args\[3\]}} to primitive type long, which is causing the NPE. lifespan is actually a Long, not a long, and the {{perform()}} method seems to anticipate null lifespans at line 72:
> {code}         // If the provided lifespan is null, that means it is a store removal command, so we can't compare lifespan
>          if (lifespan == null) {}{code}
> Could this be fixed by simply changing the cast at line 142 from (long) to (Long)?



--
This message was sent by Atlassian JIRA
(v6.4.11#64026)


More information about the infinispan-issues mailing list