DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUGĀ· RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT <http://issues.apache.org/bugzilla/show_bug.cgi?id=36113>. ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED ANDĀ· INSERTED IN THE BUG DATABASE.
http://issues.apache.org/bugzilla/show_bug.cgi?id=36113 Summary: Session persistence for objects with primitive types Product: Tomcat 5 Version: Unknown Platform: All OS/Version: other Status: NEW Severity: normal Priority: P2 Component: Catalina AssignedTo: tomcat-dev@jakarta.apache.org ReportedBy: [EMAIL PROTECTED] When there is a primitive data type (like int or boolean) contained in an object which is stored in a session, a persistence will fail when reading back the session data. This is caused by a bug in org.apache.catalina.util.CustomObjectInputStream, which does not care for primitive types, as ObjectInputstream is doing since JDK1.4 The following code is copied from the SUN Java sources and works correctly: /** table mapping primitive type names to corresponding class objects */ private static final HashMap primClasses = new HashMap(8, 1.0F); static { primClasses.put("boolean", boolean.class); primClasses.put("byte", byte.class); primClasses.put("char", char.class); primClasses.put("short", short.class); primClasses.put("int", int.class); primClasses.put("long", long.class); primClasses.put("float", float.class); primClasses.put("double", double.class); primClasses.put("void", void.class); } public Class resolveClass(ObjectStreamClass classDesc) throws ClassNotFoundException, IOException { try { return Class.forName(classDesc.getName(), false, classLoader); } catch (ClassNotFoundException ex) { Class cl = (Class) primClasses.get(classDesc.getName ()); if (cl != null) { return cl; } else { throw ex; } } } This leads to the ability to store any primitive type (like a castor object) inside a persisted session. Maybe somebody can commit this to the tomcat trunk. Thanks, Marcus -- Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the assignee for the bug, or are watching the assignee. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]