Message4484

Author chupym
Recipients chupym
Date 2009-04-08.12:29:57
SpamBayes Score 7.805635e-05
Marked as misclassified No
Message-id <1239193798.4.0.217948400711.issue1310@psf.upfronthosting.co.za>
In-reply-to
Content
envoirement:
-define a python class
-attach to self a instance of a normal Java class
-serialize the defined class object using ObjectOutputStream
-deserialize using PythonObjectInputStream
result:
when you try to deserialize u will get an exception telling you that the
simple Java class can not be found in the 'javapackage'.
my quick fix:
I have rewrite the PyJavaType and added the content:
    @Override
    protected Object writeReplace() {
    	if("__builtin__".equals(this.getModule().toString()))
    		return super.writeReplace();
    	return new TypeJavaResolver((Class<?>) javaProxy);
    }

	static class TypeJavaResolver implements Serializable {
		private static final long serialVersionUID = 1L;

		private Class<?> java_class;

		TypeJavaResolver(Class<?> java_class) {
			this.java_class = java_class;
		}

		private Object readResolve() {
			return PyType.fromClass(java_class);
		}
	}
History
Date User Action Args
2009-04-08 12:29:58chupymsetrecipients: + chupym
2009-04-08 12:29:58chupymsetmessageid: <1239193798.4.0.217948400711.issue1310@psf.upfronthosting.co.za>
2009-04-08 12:29:58chupymlinkissue1310 messages
2009-04-08 12:29:57chupymcreate