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

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

Thanks for updating the patch Sathish.

Here you need to reset the out back with System.out
So, you take backup of System.out first and then your code. In finally you just 
reset with System.out again.
{code}
ByteArrayOutputStream bao = new ByteArrayOutputStream();
+    System.setOut(new PrintStream(bao));
+    System.setErr(new PrintStream(bao));
..........
{code}

Above code should be something like this.

{code}
PrintStream psBackup = System.out;
ByteArrayOutputStream bao = new ByteArrayOutputStream();
+    System.setOut(new PrintStream(bao));
+    System.setErr(new PrintStream(bao));

try{
..........
} finally {
      System.setOut(psBackup);
 }
{code}
Otherwise all SOP from next test onwards may go into the above stream set.

Also please keep one empty line gap between testcases.
{code}
    fis.close();
   }
+  /**
+   * Adding as part of jira HDFS-5343
{code}


> When cat command is issued on snapshot files getting unexpected result
> ----------------------------------------------------------------------
>
>                 Key: HDFS-5343
>                 URL: https://issues.apache.org/jira/browse/HDFS-5343
>             Project: Hadoop HDFS
>          Issue Type: Bug
>          Components: hdfs-client
>            Reporter: sathish
>            Assignee: sathish
>         Attachments: HDFS-5343-0003.patch, HDFS-5343-002.patch
>
>
> first if we create one file with some file length and take the snapshot of 
> that file,and again append some data through append method to that file,then 
> if we do cat command operation on snapshot of that file,in general it should 
> dispaly the data what we added with create operation,but it is displaying the 
> total data i.e. create +_ appended data.
> but if we do the same operation and if we read the contents of snapshot file 
> through input stream it is just displaying the data created in snapshoted 
> files.
> in this the behaviour of cat command and reading through inputstream is 
> getting different



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)

Reply via email to