aspose file tools
The moose likes Java in General and the fly likes Why Would new Date Cause an Exception Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Java in General
Reply Bookmark "Why Would new Date Cause an Exception" Watch "Why Would new Date Cause an Exception" New topic
Author

Why Would new Date Cause an Exception

Steve Dyke
Ranch Hand

Joined: Nov 16, 2004
Posts: 1254
Has any one got an idea why the last line of code in my example would cause a NullPointerException?

Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 32654
    
    4
I can't see how Date date = new Date() could cause a NullPointerException. Are you sure it's occurring there? The Documentation doesn't say anything about Exceptions.
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19216

It's definitely not that line that's throwing the exception. Can you post the entire stack trace?


SCJP 1.4 - SCJP 6 - SCWCD 5
How To Ask Questions How To Answer Questions
Mike Simmons
Ranch Hand

Joined: Mar 05, 2008
Posts: 2778
    
    2
Or, if the stack trace really does appear to be pointing at that line, I think you need to double-check whether the class files being executed were really compiled from the same version of the code as what you're looking at. This can result in misleading error messages.
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: Why Would new Date Cause an Exception
 
Similar Threads
accessing input text field in controller class
Error in IBM Rational Tool
Could not invoke suite() method !!
Some help with basic design
templates