Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

I need help fixing java.lang.NullPointerException problem

$
0
0
Hi,
I have a client-server app and the following code in the client:

while(true)
 		{
 			try
 			{
 			TableDetails newDetails = (TableDetails) inObject.readObject(); //waits for object from server
                         if (newDetails == null)
                         break;

 				//updateGamesList(newDetails);
 			}catch(Exception ex){ex.printStackTrace();}
 		}

I receive a NullPointerException error and I can't understand why. If the server is not sending anything,
shouldn't the app just wait at readObject, until it receives an Object? And if it's Null, shouldn't the
break statement handle that?
Thanks in advance

Viewing all articles
Browse latest Browse all 51036

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>