Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / June 2006

Tip: Looking for answers? Try searching our database.

Null Pointer....

Thread view: 
auduwage@gmail.com - 21 Jun 2006 21:20 GMT
I am getting a NullPointerException and cant find the reason why its
doing... looks to me my typecasting is fine...
Please see error line

public void validate(Object domainObject, String action,
MessageAccumulator errors) throws ApplicationException
   {
       Facility facility = (Facility) domainObject;

       String name = facility.getName();
       String typeIdentifier =
facility.getFacilityType().getTypeIdentifier(); <b>(error line) </b>
       int nameSize = name.length();
       FacilityType facilityType =
facilityTypeDAO.findByTypeIdentifier(typeIdentifier);
       String facilityTypeId = facilityType.getFacilityTypeId();
                         :
                         :
                         :
}

Facility.java -> getFacilityType(),
FacilityType.java -> getTypeIdentifier()

Any help would be great...Thanks all
Mike Schilling - 21 Jun 2006 21:26 GMT
>I am getting a NullPointerException and cant find the reason why its
> doing... looks to me my typecasting is fine...
[quoted text clipped - 8 lines]
>        String typeIdentifier =
> facility.getFacilityType().getTypeIdentifier(); <b>(error line) </b>

Either facility or facility.getFacilityType() is null.  Either use a
debugger or println to determine which.  Type casting is irrelevant.

>        int nameSize = name.length();
>        FacilityType facilityType =
[quoted text clipped - 9 lines]
>
> Any help would be great...Thanks all
lordy - 22 Jun 2006 00:45 GMT
>>        String name = facility.getName();
>>        String typeIdentifier =
>> facility.getFacilityType().getTypeIdentifier(); <b>(error line) </b>
>
> Either facility or facility.getFacilityType() is null.  Either use a
> debugger or println to determine which.

The latter.

Lordy
Mike Schilling - 22 Jun 2006 01:04 GMT
>>>        String name = facility.getName();
>>>        String typeIdentifier =
[quoted text clipped - 4 lines]
>
> The latter.

Yes, of course.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.