1 19 20 package com.lutris.airsent.presentation.messenger; 21 22 import com.lutris.logging.*; 23 import com.lutris.appserver.server.httpPresentation.*; 24 import com.lutris.appserver.server.*; 25 import java.io.*; 26 import org.enhydra.xml.xmlc.XMLCUtil; 27 import com.lutris.airsent.presentation.DeviceUtils; 28 import org.enhydra.xml.xmlc.XMLObject; 29 import java.lang.reflect.Method ; 30 31 32 39 public class ErrorHandler implements HttpPresentation { 40 41 47 public void run(HttpPresentationComms comms) 48 throws HttpPresentationException { 49 Class tempClass=null; 50 Object page= null; 51 Method setTextErrorMessage = null; 52 53 try{ 54 Class stringClass=Class.forName("java.lang.String"); 55 tempClass = Class.forName(DeviceUtils.getPageName(comms, "com.lutris.airsent.presentation.messenger.Error")); 56 page= comms.xmlcFactory.create(tempClass); 57 Class [] argTypeArr={stringClass}; 58 setTextErrorMessage = tempClass.getMethod("setTextErrorMessage",argTypeArr); 59 }catch(Exception e){} 60 61 62 try{ 65 if (null != comms.exception) { 66 Enhydra.getLogChannel().write(Logger.DEBUG, 67 "Exception in Airsent", 68 comms.exception); 69 System.out.println("Setting ERROR page.."); 70 Object [] temp={(comms.exception.getMessage())}; 71 setTextErrorMessage.invoke(page,temp); 72 74 } 78 }catch(Exception e){} 79 try { 80 comms.response.writeDOM((XMLObject)page); 81 } catch (Exception ex) { 82 throw new HttpPresentationException(ex); 83 } 84 } 85 86 } 87 88 | Popular Tags |