1 16 package org.directwebremoting.convert; 17 18 import java.beans.IntrospectionException ; 19 import java.beans.PropertyDescriptor ; 20 import java.util.Map ; 21 22 import org.directwebremoting.extend.MarshallException; 23 import org.directwebremoting.impl.PropertyDescriptorProperty; 24 25 29 public class ExceptionConverter extends BeanConverter 30 { 31 34 public Map getPropertyMapFromClass(Class type, boolean readRequired, boolean writeRequired) throws MarshallException 35 { 36 Map descriptors = super.getPropertyMapFromClass(type, readRequired, writeRequired); 37 descriptors.put("javaClassName", new PlainProperty("javaClassName", type.getName())); 38 39 try 42 { 43 fixMissingThrowableProperty(descriptors, "message", "getMessage"); 44 fixMissingThrowableProperty(descriptors, "cause", "getCause"); 45 } 46 catch (IntrospectionException ex) 47 { 48 throw new MarshallException(type, ex); 49 } 50 51 return descriptors; 52 } 53 54 62 protected void fixMissingThrowableProperty(Map descriptors, String name, String readMethodName) throws IntrospectionException  63 { 64 if (!descriptors.containsKey(name) && isAllowedByIncludeExcludeRules(name)) 65 { 66 PropertyDescriptor descriptor = new PropertyDescriptor (name, Throwable .class, readMethodName, null); 67 descriptors.put(name, new PropertyDescriptorProperty(descriptor)); 68 } 69 } 70 } 71
| Popular Tags
|