1 28 29 package com.caucho.ejb.hessian; 30 31 import com.caucho.hessian.io.JavaDeserializer; 32 33 import java.lang.reflect.Constructor ; 34 35 38 public class ThrowableDeserializer extends JavaDeserializer { 39 private Constructor constructor; 40 41 public ThrowableDeserializer(Class cl) 42 { 43 super(cl); 44 45 try { 46 Constructor zeroArg = cl.getConstructor(new Class [0]); 47 if (zeroArg != null) 48 return; 49 } catch (Exception e) { 50 } 51 52 try { 53 constructor = cl.getConstructor(new Class [] { String .class }); 54 } catch (Exception e) { 55 } 56 } 57 58 protected Object instantiate() 59 throws Exception 60 { 61 if (constructor != null) 62 return constructor.newInstance(new Object [1]); 63 else 64 return super.instantiate(); 65 } 66 } 67 | Popular Tags |