[
https://issues.apache.org/jira/browse/HDFS-6305?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13990848#comment-13990848
]
Daryn Sharp commented on HDFS-6305:
-----------------------------------
Rather than change all of the decoding methods (yet), I went the quick route of
converting any non-IOException during decoding to IOExceptions.
{code}
+ catch (Exception e) { // catch json parser errors
+ final IOException ioe =
+ new IOException("Response decoding failure: "+e.toString(), e);
{code}
This also handles the case where the json parser itself throws runtime
exceptions if the json is incomplete or malformed as stressed in the test cases.
> WebHdfs response decoding may throw RuntimeExceptions
> -----------------------------------------------------
>
> Key: HDFS-6305
> URL: https://issues.apache.org/jira/browse/HDFS-6305
> Project: Hadoop HDFS
> Issue Type: Bug
> Components: webhdfs
> Affects Versions: 2.0.0-alpha, 3.0.0
> Reporter: Daryn Sharp
> Assignee: Daryn Sharp
> Priority: Critical
> Attachments: HDFS-6305.patch
>
>
> WebHdfs does not guard against exceptions while decoding the response
> payload. The json parser will throw RunTime exceptions on malformed
> responses. The json decoding routines do not validate the expected fields
> are present which may cause NPEs.
--
This message was sent by Atlassian JIRA
(v6.2#6252)