Because a pointer referenced on line 19 was null.

http://publicint.blogspot.com/2009/04/nullpointerexception.html


On Thu, Oct 1, 2009 at 11:56 AM, The Coder <[email protected]> wrote:
>
> I have two Entities. Car and Person. Car have a List of Person. Its
> just for example the problem. Well, we have it:
>
> --
>
> package br.com.oxylabtech.client.model;
>
> public class Car implements IsSerializable {
>
>        // Attributes
>        private String name;
>        private String type;
>        private List<Person> personList;
>
>        // G&S [omitted]
>
> package br.com.oxylabtech.client.model;
>
> public class Person implements IsSerializable {
>
>        // Attributes
>        private String name;
>
>        // G&S [omitted]
>
> --
>
> Then i have a page with a form that fills the Car and Person data,
> something like it:
>
> --
>
> Car car = new Car();
> List<Person> listPerson = new ArrayList<Person>();
>
> car.setName("Ferrari");
> car.setType("Sport");
>
> Person personDriver = new Person();
> personDriver.setName("James");
>
> person personPassenger = new Person();
> personPassenger.setName("Victoria");
>
> listPerson.add(personDriver);
> listPerson.add(personPassenger);
>
> car.setPersonList(listPerson);
>
> --
>
> After, i need to save in the DB. I need to send to the server side
> correct? Then, i have a service for it. Lets see:
>
> --
>
> dbService.save(car, new AsyncCallback<Boolean>() {
>
>                                        public void onFailure(Throwable 
> caught) {
>                                                
> CustomWidgets.createDialogBox("Ops!!"); //This is a Custom
> DialogBox()
>                                        }
>
>                                        public void onSuccess(Boolean result) {
>                                                if (result) {
>                                                        
> CustomWidgets.createDialogBox("Yeah!");
>                                                } else {
>                                                        
> CustomWidgets.createDialogBox("Problem!");
>                                                }
>                                        }
>                                });
>
> --
>
> But before the save, i want to see the Car and the Persons info. The
> server side code is simple.
>
> --
>
> public Boolean save(Car car) {
>                try {
>                        System.out.println("Car name: " + car.getNoma());
>                        System.out.println("Car type: " + car.getType());
>                        System.out.println(" ");
>
>                        for (Person person : car.getPersonList()) {
>                                System.out.println("Person: " + 
> person.getNome());
>                        }
>                        return true;
>                } catch (Exception e) {
>                        e.printStackTrace();
>                        return false;
>                }
>        }
>
> --
>
> But it occour:
>
> --
>
> Car Name: Ferrari
> Car Type: Sport
>
> java.lang.NullPointerException
>        at br.com.oxylabtech.server.dbService.save(ServiceImpl.java:19)
>        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>
> --
>
> Why? Thankx!
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to