Look at line 19 of ServiceImpl.java

I can't tell you what it is because your pasted code doesn't include  
file names or line numbers.

If it doesn't jump out at you from that, then paste the code here.  
Make sure you point out which line is line 19...


On 2 Oct 2009, at 18:00, Isaac Truett wrote:

>
> Well, that could be a perfectly valid argument if stacktraces were
> capable of lying. Something's null. Denial won't get you anywhere.
> Something on line 19 is null. Use your debugger and find out what,
> then trace backwards until you find where/why. Or attack it from the
> other direction: start with a blank slate and add code piece by piece
> until you reproduce the problem. The last thing you changed is
> probably the culprit.
>
>
>
> On Fri, Oct 2, 2009 at 12:50 PM, The Coder <thales...@gmail.com>  
> wrote:
>>
>> Its not null. Observe it:
>>
>> Client-Side:
>>
>> 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);
>>
>> Null? Where? Its instantiate and populated with Person!
>>
>>
>> On 1 out, 13:38, Isaac Truett <itru...@gmail.com> wrote:
>>> 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 <thales...@gmail.com>  
>>> wrote:
>>>
>>>> I have two Entities. Car and Person. Car have aListof 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;
>>>>        privateList<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!
>>>
>>
>
> >

-- 
Bill Michell
billmich...@gmail.com





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

Reply via email to