irmen / Pyrolite

Java and .NET client interface for Pyro5 protocol
MIT License
178 stars 47 forks source link

class java.lang.Integer cannot be cast to class java.lang.String #80

Closed AMJIYU closed 3 years ago

AMJIYU commented 3 years ago

https://github.com/irmen/Pyrolite/tree/master/java/src/main/java/net/razorvine/pyro/serializer ex = new PyroException("["+pythonExceptionType+"] "+(String)args[0]);

run in Windows will trigger error: Exception with custom context application java.lang.ClassCastException: class java.lang.Integer cannot be cast to class java.lang.String (java.lang.Integer and java.lang.String are in module java.base of loader 'bootstrap') net.razorvine.pyro.serializer.PyroExceptionSerpent.FromSerpentDict(PyroExceptionSerpent.java:32) net.razorvine.pyro.serializer.SerpentSerializer$DictConverter.convert(SerpentSerializer.java:58) net.razorvine.serpent.ObjectifyVisitor.visit(ObjectifyVisitor.java:69) net.razorvine.serpent.ast.DictNode.accept(DictNode.java:8) net.razorvine.serpent.ast.Ast.accept(Ast.java:51) net.razorvine.serpent.ast.Ast.getData(Ast.java:45) net.razorvine.pyro.serializer.SerpentSerializer.deserializeData(SerpentSerializer.java:47) net.razorvine.pyro.PyroProxy.internal_call(PyroProxy.java:272) net.razorvine.pyro.PyroProxy.call(PyroProxy.java:178)

(String)args[0] in Compile without error ,but in fact args[0] is not an object and can't cast to string when running

irmen commented 3 years ago

hm, do you have an example of the data you're trying to serialize, that's triggering the issue? @AMJIYU

edit: nevermind, have reproduced it in a test myself.