hadoop-common-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Yi Liu (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HADOOP-10662) NullPointerException in CryptoInputStream while wrapped stream is not ByteBufferReadable. Add tests using normal stream.
Date Thu, 05 Jun 2014 00:51:01 GMT

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

Yi Liu commented on HADOOP-10662:
---------------------------------

Hi Alejandro, Thanks for review and investigation on this. Actually in the earliest version
of my local patch, I did as your suggestion. But it had issue and I found it in test cases.

{quote}
Under what circumstances you would have an InputStream that implements ByteBufferReadable
but does not support the read(ByteBuffer) operation?
{quote}
In Hadoop, there are many layers of InputStream. Even some {{InputStream}} implements {{ByteBufferReadable}},
but whether it support {{read(ByteBuffer)}} is decided by its wrapped underlying streams.


I use {{FSDataInputStream}} as example, absolutely it implements {{ByteBufferReadable}}, but
it's a high layer wrapper, that doesn't mean it supports {{read(ByteBuffer)}}, let’s look
at its implementation:

{code}
@Override
public int read(ByteBuffer buf) throws IOException {
  if (in instanceof ByteBufferReadable) {
    return ((ByteBufferReadable)in).read(buf);
  }

  throw new UnsupportedOperationException("Byte-buffer read unsupported by input stream");
}
{code}

We can see it depends on the implementation of its wrapped input stream.

In our testcases and also test cases in HDFS-6405, we cover different environments(HDFS, local
FS) and different streams type. We can find this scenario in {{TestCryptoStreamsForLocalFS}}.


> NullPointerException in CryptoInputStream while wrapped stream is not ByteBufferReadable.
Add tests using normal stream.
> ------------------------------------------------------------------------------------------------------------------------
>
>                 Key: HADOOP-10662
>                 URL: https://issues.apache.org/jira/browse/HADOOP-10662
>             Project: Hadoop Common
>          Issue Type: Sub-task
>          Components: security
>    Affects Versions: fs-encryption (HADOOP-10150 and HDFS-6134)
>            Reporter: Yi Liu
>            Assignee: Yi Liu
>             Fix For: fs-encryption (HADOOP-10150 and HDFS-6134)
>
>         Attachments: HADOOP-10662.patch
>
>
> NullPointerException in CryptoInputStream while wrapped stream is not ByteBufferReadable.

> Add tests for crypto streams using normal stream which does not support the additional
interfaces that the Hadoop FileSystem streams implement (Seekable, PositionedReadable, ByteBufferReadable,
HasFileDescriptor, CanSetDropBehind, CanSetReadahead, HasEnhancedByteBufferAccess, Syncable,
CanSetDropBehind).



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Mime
View raw message