Bug on language compatibility for string value
lanore Jun 17, 2014 11:45 PMHello, we are trying to use infinispan with c++ and java clients,
but having problem with handling string value.
(with 6.0.2.Final version of infinispan and c++ hotrod connector)
The string value set by java(possibly unicode encoded Korean) is not correctly fetched with c++ client and visa versa.
Here is what we have been found so far.
1. C++ marshaller is not compatible with java default marshaller.
Java marshaller is based on JBoss River Marshaller which put few bytes header for string object,
while C++ marshaller doesn't use any header.
-> We have resolved this issue by changing the c++ marshaller.
2. unicode encoded Korean is not correctly marshalled on unmarshalled with c++ hotrod connector
We are struggling with handling Korean string, so far the problem is not solved.
While debugging, we found that JBoss River Marshaller is using 'org.jboss.marshalling.UTFUtil.writeUTFBytes()' method for marshalling String object,
and the comment of the method is 'Write the modified UTF-8 form of the given string to the given output.'
Is this because of UTFUtil.writeUTFBytes method is writing modified UTF-8 string?
The modified UTF-8 format is standard? or just optimized format in JBoss?
Here is the test code
using namespace infinispan::hotrod; int main(int argc, char** argv){ ConfigurationBuilder builder; builder.addServer().host("127.0.0.1").port(11222); RemoteCacheManager cacheManager(builder.build(), false); HR_SHARED_PTR<RiverMarshaller<key_t>> keyMarshaller(new RiverMarshaller<key_t>); HR_SHARED_PTR<RiverMarshaller<value_t>> valueMarshaller(new RiverMarshaller<value_t>); RemoteCache<key_t, value_t> cache = cacheManager.getCache<key_t, value_t>(keyMarshaller, valueMarshaller, "Janggi", true); try { cacheManager.start(); std::string key("key"); auto rv = cache.get(std::string(key)); if (NULL == rv) { std::cout << "NOT FOUND" << std::endl; } else { std::cout << *rv << std::endl; delete rv; } } catch (HotRodClientException& e) { std::cout << e.what() << std::endl; } cacheManager.stop(); }
and the screen shot of result is attached
Thanks,
Bingu Shim
-
screenshot.cpp.png 1.8 KB
-
screenshot.java.png 1.6 KB