Author: nbelaevski
Date: 2009-05-03 21:10:22 -0400 (Sun, 03 May 2009)
New Revision: 13995
Modified:
trunk/framework/impl/src/main/java/org/ajax4jsf/application/AjaxStateManager.java
Log:
https://jira.jboss.org/jira/browse/RF-6998
Modified:
trunk/framework/impl/src/main/java/org/ajax4jsf/application/AjaxStateManager.java
===================================================================
---
trunk/framework/impl/src/main/java/org/ajax4jsf/application/AjaxStateManager.java 2009-05-03
23:49:25 UTC (rev 13994)
+++
trunk/framework/impl/src/main/java/org/ajax4jsf/application/AjaxStateManager.java 2009-05-04
01:10:22 UTC (rev 13995)
@@ -326,7 +326,22 @@
return matcher.group(1);
}
- private static final Object handleRestoreState(FacesContext context, Object state) {
+ private static final Map<String,Class<?>> PRIMITIVE_CLASSES =
+ new HashMap<String,Class<?>>(9, 1.0F);
+
+ static {
+ PRIMITIVE_CLASSES.put("boolean", boolean.class);
+ PRIMITIVE_CLASSES.put("byte", byte.class);
+ PRIMITIVE_CLASSES.put("char", char.class);
+ PRIMITIVE_CLASSES.put("short", short.class);
+ PRIMITIVE_CLASSES.put("int", int.class);
+ PRIMITIVE_CLASSES.put("long", long.class);
+ PRIMITIVE_CLASSES.put("float", float.class);
+ PRIMITIVE_CLASSES.put("double", double.class);
+ PRIMITIVE_CLASSES.put("void", void.class);
+ }
+
+ private static final Object handleRestoreState(FacesContext context, Object state) {
if (ContextInitParameters.isSerializeServerState(context)) {
ObjectInputStream ois = null;
try {
@@ -334,8 +349,18 @@
@Override
protected Class<?> resolveClass(ObjectStreamClass desc)
throws IOException, ClassNotFoundException {
- return Class.forName(desc.getName(), true,
- Thread.currentThread().getContextClassLoader());
+ String name = desc.getName();
+ try {
+ return Class.forName(name, true,
+ Thread.currentThread().getContextClassLoader());
+ } catch (ClassNotFoundException cnfe) {
+ Class<?> clazz = PRIMITIVE_CLASSES.get(name);
+ if (clazz != null) {
+ return clazz;
+ } else {
+ throw cnfe;
+ }
+ }
}
};
return ois.readObject();