Giter Club home page Giter Club logo

Comments (10)

jcoleman avatar jcoleman commented on May 21, 2024

I don't see any reason there could possible be an NPE on that line. What is the original value and the new value? If you look at that line of code it seems impossible to come up with a way that you could get an NPE. At least, assuming it isn't getting thrown by and equals() implementation or something like that.

from tomcat-redis-session-manager.

ajstokar avatar ajstokar commented on May 21, 2024

original value is null, new value is an instance of MenuItem. I have no idea either. Pretty weird.

from tomcat-redis-session-manager.

jcoleman avatar jcoleman commented on May 21, 2024

Could you step through in a debugger by any chance and see exactly what
expression is triggering the NPE?

On Fri, Oct 12, 2012 at 10:56 AM, ajstokar [email protected] wrote:

original value is null, new value is an instance of MenuItem. I have no
idea either. Pretty weird.


Reply to this email directly or view it on GitHubhttps://github.com//issues/13#issuecomment-9379106.

from tomcat-redis-session-manager.

ajstokar avatar ajstokar commented on May 21, 2024

if ( value == null && oldValue != null
|| oldValue == null && value != null
|| !value.getClass().isInstance(oldValue)
|| !value.equals(oldValue) )

So if value AND oldValue are both null, the 3rd or statement will run and throw the exception. I think you need one more check if both of these are null, then just skip the if statement.

from tomcat-redis-session-manager.

jcoleman avatar jcoleman commented on May 21, 2024

Ah yes, something didn't feel entirely right about that, but somehow I
missed that.

On Fri, Oct 12, 2012 at 11:21 AM, ajstokar [email protected] wrote:

if ( value == null && oldValue != null
|| oldValue == null && value != null
|| !value.getClass().isInstance(oldValue)
|| !value.equals(oldValue) )

So if value AND oldValue are both null, the 3rd or statement will run and
throw the exception. I think you need one more check if both of these are
null, then just skip the if statement.


Reply to this email directly or view it on GitHubhttps://github.com//issues/13#issuecomment-9379879.

from tomcat-redis-session-manager.

ajstokar avatar ajstokar commented on May 21, 2024

Actually, you should probably still update the changeAttributes hash in this case. If I do setAttribute(key,null), I would expect it to behave the same as removeAttribute(key), right?

from tomcat-redis-session-manager.

jcoleman avatar jcoleman commented on May 21, 2024

If the old value is null as well, then nothing's changed right? Presumable
someone could argue about whether or not there's a difference between not
having the key and having the key be null, but I don't think we need to
worry about that unless someone has a reason to do so.

On Fri, Oct 12, 2012 at 11:25 AM, ajstokar [email protected] wrote:

Actually, you should probably still update the changeAttributes hash in
this case. If I do setAttribute(key,null), I would expect it to behave the
same as removeAttribute(key), right?


Reply to this email directly or view it on GitHubhttps://github.com//issues/13#issuecomment-9379994.

from tomcat-redis-session-manager.

jcoleman avatar jcoleman commented on May 21, 2024

BTW, I have a new build, but could you test it and ensure it works for you
before I release it? (I'm not set up right now to run Tomcat)

JAR: http://cl.ly/0K1L2E2i3u0Z

On Fri, Oct 12, 2012 at 11:27 AM, James Coleman [email protected] wrote:

If the old value is null as well, then nothing's changed right? Presumable
someone could argue about whether or not there's a difference between not
having the key and having the key be null, but I don't think we need to
worry about that unless someone has a reason to do so.

On Fri, Oct 12, 2012 at 11:25 AM, ajstokar [email protected]:

Actually, you should probably still update the changeAttributes hash in
this case. If I do setAttribute(key,null), I would expect it to behave the
same as removeAttribute(key), right?


Reply to this email directly or view it on GitHubhttps://github.com//issues/13#issuecomment-9379994.

from tomcat-redis-session-manager.

ajstokar avatar ajstokar commented on May 21, 2024

Works! Thanks for the quick fix.

from tomcat-redis-session-manager.

jcoleman avatar jcoleman commented on May 21, 2024

All right. I'll release the official fix sometime this weekend.

On Fri, Oct 12, 2012 at 11:32 AM, ajstokar [email protected] wrote:

Works! Thanks for the quick fix.


Reply to this email directly or view it on GitHubhttps://github.com//issues/13#issuecomment-9380213.

from tomcat-redis-session-manager.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.