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

Akira AJISAKA commented on HDFS-6565:
-------------------------------------

Attaching a patch to remove jetty json library from JsonUtil and 
WebHdfsFileSystem.
The way Jackson parse JSON number is different from jetty json:
* Jackson: number -> Integer, Long, or BigInteger (smallest applicable)
* jetty json: number -> Long

so I changed the code for parsing JSON number
{code}
  (Long) m.get("blockId") // doesn't work if m.get("blockId") is Integer
{code}
to
{code}
 ((Number) m.get("blockId")).longValue() // support all classes extends Number
{code}
In addition, the way Jackson parse JSON array is different from jetty json:
* Jackson: array -> ArrayList<Object>
* jetty json: array -> Object[]

so I changed the code for parsing JSON array
{code}
  (Object[]) m.get("locatedBlocks")
{code}
to
{code}
  (List<Object>) m.get("locatedBlocks")
{code}


> Use jackson instead jetty json in hdfs-client
> ---------------------------------------------
>
>                 Key: HDFS-6565
>                 URL: https://issues.apache.org/jira/browse/HDFS-6565
>             Project: Hadoop HDFS
>          Issue Type: Bug
>            Reporter: Haohui Mai
>            Assignee: Akira AJISAKA
>         Attachments: HDFS-6565.patch
>
>
> hdfs-client should use Jackson instead of jetty to parse JSON.



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

Reply via email to