wood burning stoves*
The moose likes Beginning Java and the fly likes Finishing Driver Help, Null error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Finishing Driver Help, Null error" Watch "Finishing Driver Help, Null error" New topic
Author

Finishing Driver Help, Null error

Nolan Ryno
Greenhorn

Joined: Apr 13, 2012
Posts: 7

---------------------------------------------------------------------------------------------------------------------------

--------------------------------------------------------------------------------------------------------------



During the last lines of my Driver, when i call for encryptedPassword.getPassword it should display an encrypted password and mess up the password. But instead it displays null, and i have no idea why. Also I don't know what to do to make the user enter the password and be able to Prompt the user to re-enter the password and tell them whether or not they entered it correctly, thats why i have question marks. If anyone could give me a little help that would be great because i'm stuck and have been trying to figure out the answer..
Greg Brannon
Bartender

Joined: Oct 24, 2010
Posts: 557
If the logic is returning null, then it must be null. Can you find where you've changed the password to something other than null, either through a setter or a constructor? Review lines 7 - 10 of your Driver class to see if you've coded what you meant to. Those lines just look odd to me, the root cause of the problem you're having could be somewhere else.


Learning Java using Eclipse on OpenSUSE 11.2
Linux user#: 501795
Nolan Ryno
Greenhorn

Joined: Apr 13, 2012
Posts: 7
I fixed it so that it was this.password=password; on the Password class. I'm suppose to do all this in the driverclass Driver

Methods

public static void main(String[] args):

Arguments:
String[] args
Return:
None



Behavior:

Allows the user to input a user name and password

Uses the password to instantiate a new Password reference, which points to a EncryptedPassword object

Calls the getPassword, getEncryptionMethod, and toString methods of the newly instantiated object, and prints the information to the screen

Prompt the user to re-enter the password and tell them whether or not they entered it correctly

Uses the user name and password to instantiate a new Password reference, which points to a UserNamePassword object

Calls the getPassword, getEncryptionMethod, and toString methods of the newly instantiated object, and prints the information to the screen

Prompt the user to re-enter the password and tell them whether or not they entered it correctly

Uses the password to instantiate a new EncryptedPassword reference, which points to an EncryptedPassword object

Calls the getPassword, getEncryptionMethod, and toString methods of the newly instantiated object, and prints the information to the screen

Prompt the user to re-enter the password and tell them whether or not they entered it correctly

Uses the user name and password to instantiate a new UserNamePassword reference, which points to a UserNamePassword object

Calls the getPassword, getEncryptionMethod, and toString methods of the newly instantiated object, and prints the information to the screen
Prompt the user to re-enter the user name and password and tell them whether or not they entered them correctly
top

----------------------------------------------------------------------------------------------------------------------------------------------------------------------
But overall i do not know where to start. I think my code is messed up, but i'm not sure if i made a mistake. Overall I'm so stressed out that its ridiculous. I do not even know where to start and could use some help..
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 36514
    
  16
Why are you hiding static fields? Remember, fields are not polymorphic, so the EncryptedPassword class has two fields called ENCRYPTION_METHOD. There is a design error there.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Finishing Driver Help, Null error
 
Similar Threads
Java Password Generator with Abstract classes
Trouble running example from Hibernate Made Easy, p. 156
if i store a password data from jsp to the database how to hide it from others seeing
what's wrong
The value for the useBean class attribute "..." is invalid.