taoensso / nippy

The fastest serialization library for Clojure
https://www.taoensso.com/nippy
Eclipse Public License 1.0
1.04k stars 60 forks source link

Avoid exception when thawing nested map with unknown java class #123

Closed setzer22 closed 4 years ago

setzer22 commented 4 years ago

In my application, I serialize nested maps with mixed Clojure/Java objects and send them over the network. The receiving application must then de-serialize the whole nested structure.

There is a problem, however, when the code sending the message, probably by mistake, includes a Java class that is not in the classpath of the JVM on the receiving end. The call to thaw returns an exception and I can't recover anything of the message.

Is there a way I can partially recover the thawed object? This would allow me to do some error handling on the receiving end, because I cannot rely on the sending application not including any unkown Java class and crashing the system.

To clarify, I would like to send the following structure:

{:key1 "a"
 :key2 (some.java.Class. "bug")}

and at least recover something like:

{:key1 "a"
 :key2 nil }

Thanks!

setzer22 commented 4 years ago

Sorry, I was confused. I see this was already implemented.

I'm closing the issue.