Originally posted by revathy oday:
string filename is getting null pointer exception...
as in stack what i provided..i need to catch the error with some error messages.
i havent idea of how to do...please help me..
Originally posted by jiju ka:
Read your article and I agree with it.
In the current application I am working we are avoiding NullPointerException by a different technique. Within the application we are keeping a standard such that every reference should have a valid value. For example
an array reference should atleast be initialized to a zero length array,
A String should be an empty String at the least, etc. Further the standard is insisting that the developer should not do any str == null checks. But in reality we have lot of NullPointerException suppressed or ignored leading to inconsistent application state.
I see this approach in our application as a myth rather than a standard.
Our application is build on top of java sun libraries. As long as java sun libraries are not implementing this standard, our application cannot. Otherwise the developer need to be very accurate in identifying what is Sun provided or not.
What is your opinion on this standard?
perhaps that question could be asked in a separate thread in intermediate or advanced? As far as we know the original poster here is still trying to understand the basics; let's not distract too much from that.
The same question about nullPointerException have advanced and basic aspects. Depending on where it is posted (basic, intermediate or advanced) the responders determine the level. Is it agreeable to post the same question in multiple forums? What the user intends is from a set of different solutions which is the best solution.