[
https://issues.apache.org/jira/browse/ZOOKEEPER-1224?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13129579#comment-13129579
]
Laxman commented on ZOOKEEPER-1224:
-----------------------------------
Got it. This is not a problem with encoding.
ZooKeeper always deals with byte array as data.
You are using third party library ZKClient. It provides some user friendly APIs
to deal with Objects rather than byte array. This library internally takes care
of serializing the input data and send to ZooKeeper in byte array form. So,
when you serialize a String object it contains some extra binary information
like type info
Reason why this is not happening in cli mode is "In cli mode its directly
persisting the String.getBytes rather than persisting in the serialized form."
> problem across zookeeper clients when reading data written by other clients
> ---------------------------------------------------------------------------
>
> Key: ZOOKEEPER-1224
> URL: https://issues.apache.org/jira/browse/ZOOKEEPER-1224
> Project: ZooKeeper
> Issue Type: Bug
> Components: java client
> Affects Versions: 3.3.0
> Environment: Zookeeper console client (i.e, zkCli.sh )
> and ZkClient
> with 3 zookeeper quorum
> Reporter: amith
> Priority: Minor
> Fix For: 3.5.0
>
> Original Estimate: 672h
> Remaining Estimate: 672h
>
> create a java client
> create a persistent node using that client
> write data into the node
> like..
> ZkClient zk = new ZkClient ( getZKServers () );
> zk.createPersistent ( "/amith" , true );
> zk.writeData ( "/amith", "amith" );
> Object readData = zk.readData ( "/amith" );
> LOGGER.logInfo (readData);
> zk.delete ( "/amith" );
> and try to read the same using ZkCli.sh console client
> [zk: XXX.XXX.XXX.XXX:XXXXX(CONNECTED) 2] get /amith
> ��tamith
> cZxid = 0x100000004
> ctime = Wed Oct 12 10:13:15 CST 2011
> mZxid = 0x100000005
> mtime = Wed Oct 12 10:13:15 CST 2011
> pZxid = 0x100000004
> cversion = 0
> dataVersion = 1
> aclVersion = 0
> ephemeralOwner = 0x0
> dataLength = 12
> numChildren = 0
> data is displayed as ��tamith
> this include some unwanted char
>
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira