Click here to Skip to main content
15,867,686 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Doing project development, there have been a problem, java exception handling. There is a Swing project, business documents related to the operation code and message operations, which made ​​me feel IOException handling very confused.

        File operations, I want to read the configuration file, and either read or type of configuration file conversion involves IOException, how should I handle better, are each delivered to the front, it gives an error message? . Packets, the abnormal yet.

        There, Hiberante in HibernateException is a runtime exception, no catch, but if I swing the connection process using the database hibernate, and hibernate configuration files lost, I do not know the front desk do not mistake? And general web project, you need to capture this anomaly?

        As an excellent GUI software, it is inevitable that some configuration. If we deliberately do something malicious hands, modify some configuration files, then this software will be able to do without crash?

        Hope to have experience in the development of expert advice given, be grateful.
Posted
Comments
Maciej Los 27-Feb-14 2:31am    
I think, it's not well formed question. You'll never get an answer. Please, be more specific and provide more details about your issue. Post sample code.
Member 10629059 6-Mar-14 2:48am    
Tnank you.

Usually, you can use "try.. catch..." to handle unexpected issues, such as I/O operation, invalid data type etc. because you don't know what will happen. Probably network disconnection, invalid file name and so on. But you'd better make some protection programmatically. For example, check the pointer in case of NULL exception; check the network status in case of disconnection exception.
 
Share this answer
 
Comments
Member 10629059 6-Mar-14 3:12am    
Thank your very much
 
Share this answer
 
Comments
Member 10629059 6-Mar-14 3:12am    
Thank you.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900