aspose file tools*
The moose likes Beginning Java and the fly likes condition seems to fail even if its true.. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "condition seems to fail even if its true.." Watch "condition seems to fail even if its true.." New topic
Author

condition seems to fail even if its true..

Accela Moon
Greenhorn

Joined: Apr 11, 2004
Posts: 20


The code is not yet complete, so I set the authCheck in the method for testing. For some reason, it keeps saying login error all the time even if I made sure the condition is true.. simply true. Anyone know wus wrong?
[ April 15, 2004: Message edited by: Accela Moon ]
Tobias Hess
Ranch Hand

Joined: Apr 06, 2004
Posts: 55

This needs braces, like here:
Accela Moon
Greenhorn

Joined: Apr 11, 2004
Posts: 20
Yes, thanks.. you're right. But it doesn't make a difference..
C. Nimo
Ranch Hand

Joined: Mar 23, 2004
Posts: 82
Hi.
Your if statement checks the following:

are you sure that at the time of this check authCheck is true?
Nimo.
Accela Moon
Greenhorn

Joined: Apr 11, 2004
Posts: 20
Yup, its true.. strange, when I use admin as username and password, it works. The previous variation of this code compared user input with that, but I've edited it out.. is there a chance this might be the compiler's fault and not the code?
C. Nimo
Ranch Hand

Joined: Mar 23, 2004
Posts: 82
Well, there's always a chance for that.
Delete all your *.class files and try again?
Use your IDE's debugger or SOP the values at critical points.
Cheers.
Nimo
Accela Moon
Greenhorn

Joined: Apr 11, 2004
Posts: 20
I know the problem, in the main below, my friend created an object from another class which wasn't supposed to be there thus ended up using the method there instead. Didn't notice.. Thanks anyways.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: condition seems to fail even if its true..