Details
-
Bug
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
1.0-JSR-6
-
None
-
Windows XP
-
Patch
Description
GroovyScriptEngine does not expose it's ClassLoader and therefore objects created and serialized using the GSE cannot be read back in.
eg.
...
Class objectClass = new GroovyScriptEngine().getClassByName(path);
Object obj = objectClass.newInstance();
XStream xstream = new XStream();
FileOutputStream out = new FileOutputStream(new File("myobj.xml"));
xstream.toXML(obj, out);
...
// input stream defs removed
obj = xstream.fromXML(xmlIn);
... causes com.thoughtworks.xstream.alias.CannotResolveClassException:, even if you set new GroovyClassLoader() as xstream's classloader it still cannot resolve the class.
Exposing the ClassLoader would enable this. Attached is a GSE that allows this.