Issue1310

classification
Title: Serialization problem for wrapped Java objects
Type: behaviour Severity: normal
Components: Core Versions: 2.5b1
Milestone:
process
Status: closed Resolution: duplicate
Dependencies: Superseder:
Assigned To: Nosy List: chupym, pjenvey
Priority: Keywords:

Created on 2009-04-08.12:29:58 by chupym, last changed 2009-06-22.02:18:58 by pjenvey.

Messages
msg4484 (view) Author: Nistor Gabriel (chupym) Date: 2009-04-08.12:29:57
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);
		}
	}
msg4489 (view) Author: Philip Jenvey (pjenvey) Date: 2009-04-08.18:50:44
This sounds like a duplicate of #1282, which was fixed

Can you try reproducing this and #1311 on trunk?
msg4849 (view) Author: Philip Jenvey (pjenvey) Date: 2009-06-22.02:18:58
This is definitely a dupe of #1282, closing out
History
Date User Action Args
2009-06-22 02:18:58pjenveysetstatus: open -> closed
resolution: duplicate
messages: + msg4849
2009-04-08 18:50:46pjenveysetnosy: + pjenvey
messages: + msg4489
2009-04-08 12:29:58chupymcreate