You are viewing a plain text version of this content. The canonical link for it is here.
Posted to hdfs-issues@hadoop.apache.org by "Tsz-wo Sze (Jira)" <ji...@apache.org> on 2025/10/20 19:10:00 UTC

[jira] [Created] (HDFS-17848) OIV should not use PrintStream

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: hdfs-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: hdfs-issues-help@hadoop.apache.org