hadoop-hdfs-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Walter Su (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HDFS-9410) TestDFSAdminWithHA#tearDown may throw NPE
Date Wed, 11 Nov 2015 08:43:10 GMT

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

Walter Su commented on HDFS-9410:

Fortunately we fork a JVM for each test class. I think we still need to fix this to avoid
System.out pollution in other test cases in same class.
It's just I think can we backup {{originOut}} at class level?
  private static final PrintStream originOut = System.out;
  private static final PrintStream originErr = System.err;
And I really don't trust {{System.err.flush();}} won't throw any unexpected runtime exception.
So I think can we put the restore code in a "finally\{ //here \}"?

Just some thought, if you don't agree. Anyway, the patch looks good to me.

> TestDFSAdminWithHA#tearDown may throw NPE
> -----------------------------------------
>                 Key: HDFS-9410
>                 URL: https://issues.apache.org/jira/browse/HDFS-9410
>             Project: Hadoop HDFS
>          Issue Type: Test
>          Components: HDFS
>            Reporter: Xiao Chen
>            Assignee: Xiao Chen
>            Priority: Minor
>         Attachments: HDFS-9410.001.patch
> If for any reason {{setUpHaCluster}} fails before storing {{System.out}} and {{System.err}}
as member variables {{originOut}} and {{originErr}}, then in {{tearDown}} {{System.out}} and
{{System.err}} are set to null. This could cause all following tests to fail when calling

This message was sent by Atlassian JIRA

View raw message