• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem with calling serialized class methods.

 
Mark O' Sullivan
Ranch Hand
Posts: 160
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
In network mode.
I have created a Hotel reservation object in the db package of the project. I haven't an issue getting these objects passed across the network. On the client side I create a treemap to hold the these hotel reservation objects and try and populate my Jtable. I have an issue though when when I try and call a method upon the hotel reservation class on the gui side, for example getHotelName() and I receive, "Exception occurred during event dispatching, java.lang.NullPointerException". Is this standard behaviour, for networking? One way around this for me, is because I have business methods in the network, I could just get their values in this layer, and pass strings to gui, instead of objects. The hotel reservation object is serialized.
Have treemap of request numbers to hotel reservation objects on client side:

for each reservation entry try and add it to the jTable

The addHotelReservation is in a different class

error occurs at the getHotelName() point. Any ideas? Is this seen as another call to the network layer by any chance?
Thanks.
 
K. Tsang
Bartender
Posts: 3585
16
Android Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It looks like that your hotelReservation is null from the line


Did you instantiate your hotelReservation variable eg new HotelReservation(....) somewhere in your code? Did you read the data from the db file?

 
Mark O' Sullivan
Ranch Hand
Posts: 160
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Cheers thanks,
ended up being I didn't instantiate my local class that holds the jTable information correctly.
Thanks for your help.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic