Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I got RuntimeException when try using DefaultCodec.decode volatile key #17

Closed
yheart opened this issue Apr 19, 2010 · 2 comments
Closed

Comments

@yheart
Copy link

yheart commented Apr 19, 2010

I set the value like this:
jredis.set(key,value);
jredis.expire(key, expiretime_seconds);

and when I try to get the value like this:
String value = DefaultCodec.decode(jredis.get(key));

it said :

java.lang.RuntimeException: Error decoding byte[] data to instantiate java object - data at key may not have been of this type or even an object
org.jredis.ri.alphazero.support.DefaultCodec.decode(DefaultCodec.java:218)

so is it a bug or I made someting wrong when I set or get the volatile value? thank you very much~

by the way,I use the lastest jredis source(compile it in eclipse myself) and redis 1.2.6

@yheart
Copy link
Author

yheart commented Apr 19, 2010

I forgot to post another exception:

java.io.StreamCorruptedException: invalid stream header: 79686561
java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:800)
java.io.ObjectInputStream.(ObjectInputStream.java:297)
org.jredis.ri.alphazero.support.DefaultCodec.decode(DefaultCodec.java:201)

@alphazero
Copy link
Owner

Hi,

Its not a bug. You should use the toStr(...) methods to get String and String[]. decode(..) is strictly for serialized java objects that are not either byte[], String, or Number.

/R

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants