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

Jun Rao commented on KAFKA-1405:
--------------------------------

Vadim,

Thanks for reporting this. Yes, overriding JSON.globalNumberParser is not 
ideal. Are you sure JSON is going to be deprecated in scala 2.11? The api is 
still there.

http://www.scala-lang.org/api/2.11.0-M3/index.html#scala.util.parsing.json.JSON$

If JSON is still supported in scala 2.11, maybe we can see if there is a way to 
fix JSON.globalNumberParser. Could we just override the global value each time 
we do parsing and reset it back to the original value when done?

As for dragging in lift-json, this is also possible, but we have to be a bit 
careful. So, we need to know that the library is well maintained and has a good 
history of providing backward compatible releases. Currently, the consumer 
client depends on json parsing. Any jar compatibility issue could affect the 
consumer applications.

> Global JSON.globalNumberParser screws up other libraries
> --------------------------------------------------------
>
>                 Key: KAFKA-1405
>                 URL: https://issues.apache.org/jira/browse/KAFKA-1405
>             Project: Kafka
>          Issue Type: Bug
>    Affects Versions: 0.8.0
>            Reporter: Vadim Chekan
>              Labels: json
>
> I'm getting exception "kafka.common.ConsumerRebalanceFailedException" but it 
> only happens when I do a call to "scala/pickling" serialization library. What 
> the connection you might ask? The underly exception is 
> "ZookeeperConsumerConnector:76, exception during rebalance 
> kafka.common.KafkaException: Failed to parse the broker info from zookeeper: 
> {"jmx_port":-1,"timestamp":"1397514497053","host":"xxx","version":1,"port":9092}
> Caused by: java.lang.ClassCastException: java.lang.Double cannot be cast to 
> java.lang.Integer"
> A little bit looking at  kafka code lead me to this line:
> In 
> https://github.com/apache/kafka/blob/0.8.0/core/src/main/scala/kafka/utils/Json.scala#L27
> there is JSON.globalNumberParser redefined. It is terrible idea to change 
> global variable. This JSON library is used by other libraries and this global 
> assignment messes it up.
> My 5-minutes research shows that scala's JSON library was considered almost 
> of demo quality and most people prefer ligt-json implementation.
> https://groups.google.com/forum/#!topic/scala-user/P7-8PEUUj6A
> Also it is my understanding, that scala JSON is deprecated in scala-2.11, so 
> this change is needed anyway.
> If no objections to this ticket in general, I can work on a patch to use 3rd 
> party JSON library usage in kafka. Pleas let me know...



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

Reply via email to