Tsz-wo Sze created HDFS-17848:
---------------------------------

             Summary: OIV should not use PrintStream
                 Key: HDFS-17848
                 URL: https://issues.apache.org/jira/browse/HDFS-17848
             Project: Hadoop HDFS
          Issue Type: Improvement
          Components: command
            Reporter: Tsz-wo Sze


The problem reported by HDFS-17847 actually is due to the use of PrintStream in 
OIV.
{quote}... Unlike other output streams, a PrintStream never throws an 
IOException; instead, exceptional situations merely set an internal flag that 
can be tested via the checkError method. ...
{quote} - [https://docs.oracle.com/javase/8/docs/api/java/io/PrintStream.html]

As described in the javadoc above, PrintStream never throws an IOException. 
HDFS-17847 has proposed a quick fix by calling the checkError method. However, 
the checkError method does not tell the detail of the error.

In the use case of OIV, it is better to use a class which throws IOException on 
failures. A potential replacement is 
[OutputStreamWriter|https://docs.oracle.com/javase/8/docs/api/java/io/OutputStreamWriter.html].



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to