• Post Reply Bookmark Topic Watch Topic
  • New Topic

NullPointer  RSS feed

 
emms quinn
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello all again
Still stuck on this keystore passwords..(think I've been staring at it for too long and need a fresh set of eyes)..but I'm getting there!! Anyway, I'm trying to compare two passwords (keyStorePass and keyStorePass2)as can be seen from the code below. The idea behind it is that a keystore is created and user assigns password to it (in the create()method), then when the user wants to access the same keystore at a later date, they again enter a password (verify()method)which must match up with the origional (arraysAreTheSame()method). But when I'm trying to compare the two in the arraysAreTheSame() method it's not seeing the first value of the origional password, returning a null exception. I would really appreciate any help with how to get over this.

 
Layne Lund
Ranch Hand
Posts: 3061
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think you are making this MUCH more complicated than you need to. You don't need to put the String objects into an array to compare them. Instead, you should use the built-in equals() method, for example:

Of course, this may not solve your problem. However, it WILL simplify your code, and hopefully make it easier to locate the real problem.
[ May 07, 2003: Message edited by: Layne Lund ]
 
Irene Loos
Ranch Hand
Posts: 78
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There are several syntax errors in your code, like

will always be false since you compare to identical objects. You probably wanted it to be:

This will not work

try to do:

This will assign TRUE value to "no" variable.

you probably wanted to do this:

[ May 07, 2003: Message edited by: Irene Loos ]
 
Joel McNary
Bartender
Posts: 1840
Eclipse IDE Java Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Irene Loos:

This will not work

try to do:


Actually, that will work. The boolean value resutned by the comparison is left on top of the stack and is available for assignment.
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!