[ 
https://issues.apache.org/jira/browse/HDFS-12442?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Rushabh S Shah updated HDFS-12442:
----------------------------------
    Description: 
Was going through {{JsonUtilClient#toBlockLocation}} code.
Below is the relevant code snippet.
{code:title=JsonUtilClient.java|borderStyle=solid}
 /** Convert a Json map to BlockLocation. **/
  static BlockLocation toBlockLocation(Map<?, ?> m)
      throws IOException{
    ...
    ...  
    boolean corrupt = Boolean.
        getBoolean(m.get("corrupt").toString());
    ...
    ...
  }
{code}
According to java docs for {{Boolean#getBoolean}}
{noformat}
Returns true if and only if the system property named by the argument exists 
and is equal to the string "true". 
{noformat}
I assume, the map value for key {{corrupt}} will be populated with either 
{{true}} or {{false}}.
On the client side, {{Boolean#getBoolean}} will look for system property for 
true or false.
So it will always return false unless the system property is set for true or 
false.

  was:
Was going through {{JsonUtilClient#toBlockLocation}}
Below is the relevant code snippet.
{code:title=JsonUtilClient.java|borderStyle=solid}
 /** Convert a Json map to BlockLocation. **/
  static BlockLocation toBlockLocation(Map<?, ?> m)
      throws IOException{
    ...
    ...  
    boolean corrupt = Boolean.
        getBoolean(m.get("corrupt").toString());
    ...
    ...
  }
{code}
According to java docs for {{Boolean#getBoolean}}
{noformat}
Returns true if and only if the system property named by the argument exists 
and is equal to the string "true". 
{noformat}
I assume, the map value for key {{corrupt}} will be populated with either 
{{true}} or {{false}}.
On the client side, {{Boolean#getBoolean}} will look for system property for 
true or false.
So it will always return false unless the system property is set for true or 
false.


> WebHdfsFileSystem#getFileBlockLocations will always return 
> BlockLocation#corrupt as false
> -----------------------------------------------------------------------------------------
>
>                 Key: HDFS-12442
>                 URL: https://issues.apache.org/jira/browse/HDFS-12442
>             Project: Hadoop HDFS
>          Issue Type: Bug
>          Components: webhdfs
>    Affects Versions: 2.9.0, 3.0.0-alpha2
>            Reporter: Rushabh S Shah
>            Assignee: Rushabh S Shah
>            Priority: Critical
>
> Was going through {{JsonUtilClient#toBlockLocation}} code.
> Below is the relevant code snippet.
> {code:title=JsonUtilClient.java|borderStyle=solid}
>  /** Convert a Json map to BlockLocation. **/
>   static BlockLocation toBlockLocation(Map<?, ?> m)
>       throws IOException{
>     ...
>     ...  
>     boolean corrupt = Boolean.
>         getBoolean(m.get("corrupt").toString());
>     ...
>     ...
>   }
> {code}
> According to java docs for {{Boolean#getBoolean}}
> {noformat}
> Returns true if and only if the system property named by the argument exists 
> and is equal to the string "true". 
> {noformat}
> I assume, the map value for key {{corrupt}} will be populated with either 
> {{true}} or {{false}}.
> On the client side, {{Boolean#getBoolean}} will look for system property for 
> true or false.
> So it will always return false unless the system property is set for true or 
> false.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to