[ 
https://issues.apache.org/jira/browse/HDFS-2364?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13115324#comment-13115324
 ] 

Uma Maheswara Rao G commented on HDFS-2364:
-------------------------------------------

Here to solve this issue, there are two options.
1) we can completely use other writers.
2) We can use checkError for checking any errors while flusing the data..etc.
   If we find some error, we can directly throw IOException.

Thanks
Uma
                
> metaSave API is using Printwriter, It will eat all the IOExceptions.
> --------------------------------------------------------------------
>
>                 Key: HDFS-2364
>                 URL: https://issues.apache.org/jira/browse/HDFS-2364
>             Project: Hadoop HDFS
>          Issue Type: Sub-task
>          Components: name-node
>            Reporter: Uma Maheswara Rao G
>            Assignee: Uma Maheswara Rao G
>
> It is important to note that
> PrintStream and PrintWriter do not throw IOExceptions! IOException is a
> non-Runtime exception, which means that your code must catch them or declare 
> it
> can throw them.
> The creators of Java realized that System.out and System.err would be very
> heavily used, and did not want to force inclusion of exception handling every 
> time
> you wanted to write System.out.println(4).
> Therefore, PrintStream and PrintWriter catch their own exceptions and set an
> error flag. If you are using one of these classes for real output in your 
> program
> (not merely using System.out.println()) you should call checkError() to see
> if an error has occurred.
> Because of this behavior, PrintStream and PrintWriter are not well suited for
> use other than System.out and System.err!
> Ref: http://www.cs.usfca.edu/~parrt/doc/java/JavaIO-notes.pdf

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to