File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes NullPointerException? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "NullPointerException?" Watch "NullPointerException?" New topic
Author

NullPointerException?

Layne Lund
Ranch Hand

Joined: Dec 06, 2001
Posts: 3061


The above code produces output such as



What could cause a NullPointerException? allowedFile is a File object, and as you can see it is NOT null. Besides, if it was, the AllowedProperty constructor throws a NullPointerException with a custom message:

Any ideas why I get a NPE?


Java API Documentation
The Java Tutorial
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24183
    
  34

The stack trace says the error occurs in the AllowedProperty constructor at line 53. Show us that whole constructor and point out which is line 53 (the first line in a file is line 1) and I will tell you exactly what the problem is.


[Jess in Action][AskingGoodQuestions]
Layne Lund
Ranch Hand

Joined: Dec 06, 2001
Posts: 3061
Thanks. I figured it out. I'm using Netbeans and it took me to the line in the setUp() method when I double clicked on the JUnit output. No wonder I was confused by that.

Layne
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: NullPointerException?