aspose file tools
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes  print statements not working in serialization code Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Reply Bookmark " print statements not working in serialization code" Watch " print statements not working in serialization code" New topic
Author

print statements not working in serialization code

navneet kumarbairwal
Greenhorn

Joined: Nov 07, 2011
Posts: 5


[Edit - formatting - MB]
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 16479
    
    2

Your problem is here:


This says: When an exception is thrown, do nothing.

So when an exception is thrown, you have no way of knowing that happened. Except for the indirect clues, like for example a statement not being executed because the statement before it threw an exception.

Replace that code by this more useful code:
Dan Drillich
Ranch Hand

Joined: Jul 09, 2001
Posts: 1121
If you want to see the less intimidating error version, you can use -



It shows -



Regards,
Dan


William Butler Yeats: All life is a preparation for something that probably will never happen. Unless you make it happen.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 56152
    
  13

Dan Drillich wrote:If you want to see the less intimidating error version, you can use -

Not recommended. That "intimidating" error message contains useful information.


[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
Dan Drillich
Ranch Hand

Joined: Jul 09, 2001
Posts: 1121
Thank you Bear - long time no talk ;-).

The following solves the issue -



Regards,
Dan



sai jyothi
Greenhorn

Joined: Jun 28, 2009
Posts: 28
Hi Navneet

When ever you are trying to use the streams it is mandatory to implement Serializable interface.It is a marker interface which doesnt have any members in it.When a java class is to be serialized, you should intimate the java compiler in some way that there is a possibility of serializing this java class.


Regards
Jyothi


scjp5.0 90%
consistent hardwork always gives fruitful results
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: print statements not working in serialization code
 
Similar Threads
Regarding Serialization
Serialization - flush() required after using writeObject()?
SCJP Brainteaser (11)
Getting an exception(Serialization)
runtime exception