001: /*
002: * Koala Bean Markup Language - Copyright (C) 1999 Dyade
003: *
004: * Permission is hereby granted, free of charge, to any person obtaining a
005: * copy of this software and associated documentation files
006: * (the "Software"), to deal in the Software without restriction, including
007: * without limitation the rights to use, copy, modify, merge, publish,
008: * distribute, sublicense, and/or sell copies of the Software, and to permit
009: * persons to whom the Software is furnished to do so, subject to the
010: * following conditions:
011: * The above copyright notice and this permission notice shall be included
012: * in all copies or substantial portions of the Software.
013: *
014: * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
015: * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
016: * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
017: * IN NO EVENT SHALL Dyade BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
018: * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
019: * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
020: * DEALINGS IN THE SOFTWARE.
021: *
022: * Except as contained in this notice, the name of Dyade shall not be
023: * used in advertising or otherwise to promote the sale, use or other
024: * dealings in this Software without prior written authorization from
025: * Dyade.
026: *
027: * $Id: KBMLSerializerDefaultErrorHandler.java,v 1.4 2000/07/07 17:52:18 tkormann Exp $
028: * Author: Thierry.Kormann@sophia.inria.fr
029: */
030:
031: package fr.dyade.koala.xml.kbml;
032:
033: import java.beans.*;
034: import java.lang.reflect.*;
035: import java.io.*;
036:
037: /**
038: * The default error handler for the KBMLSerializer that displays
039: * error messages on the standard error output stream.
040: *
041: * @author Thierry.Kormann@sophia.inria.fr
042: */
043: public class KBMLSerializerDefaultErrorHandler implements
044: KBMLSerializer.ErrorHandler {
045:
046: public void instanciateBean(Object bean, IOException ex) {
047: System.err.println("Can't instanciate the bean of "
048: + bean.getClass() + "\n" + ex);
049: }
050:
051: public void instanciateBean(Object bean, IllegalAccessException ex) {
052: System.err.println("Can't instanciate the bean of "
053: + bean.getClass() + "\n" + ex);
054: }
055:
056: public void instanciateBean(Object bean, InstantiationException ex) {
057: System.err.println("Can't instanciate " + bean.getClass()
058: + "\n" + ex);
059: }
060:
061: public void instanciateBean(Object bean, NoSuchMethodError err) {
062: System.err.println("Can't instanciate " + bean.getClass()
063: + "\n" + err);
064: }
065:
066: public void propertyDescriptor(Object bean, PropertyDescriptor pd) {
067: System.err.println("Can't found property descriptor for "
068: + bean.getClass() + "." + pd.getName());
069: }
070:
071: public void introspector(Object bean, IntrospectionException ex) {
072: System.err
073: .println("An error occured while getting the BeanInfo for "
074: + bean.getClass() + "\n" + ex);
075: }
076:
077: public void readMethod(Object bean, PropertyDescriptor pd,
078: IllegalAccessException ex) {
079: System.err
080: .println("Error while trying to get the value for property "
081: + bean.getClass().getName()
082: + ":"
083: + pd.getName() + "\n" + ex);
084: }
085:
086: public void readMethod(Object bean, PropertyDescriptor pd,
087: InvocationTargetException ex) {
088: System.err
089: .println("Error while trying to get the value for property "
090: + bean.getClass().getName()
091: + ":"
092: + pd.getName() + "\n" + ex);
093: }
094:
095: public void propertyEditor(PropertyDescriptor pd,
096: IllegalAccessException ex) {
097: System.err.println("Can't instanciate the property editor for "
098: + "property " + pd.getName() + " of type "
099: + pd.getPropertyType() + "\n" + ex);
100: }
101:
102: public void propertyEditor(PropertyDescriptor pd,
103: InstantiationException ex) {
104: System.err.println("Can't instanciate the property editor for "
105: + "property " + pd.getName() + " of type "
106: + pd.getPropertyType() + "\n" + ex);
107: }
108:
109: public void propertyEditor(PropertyDescriptor pd,
110: NoSuchMethodError err) {
111: System.err.println("Can't instanciate the property editor for "
112: + "property " + pd.getName() + " of type "
113: + pd.getPropertyType() + "\n" + err);
114: }
115:
116: public void propertyEditor(PropertyDescriptor pd, PropertyEditor pe) {
117: System.err.println("The property editor " + pe
118: + " has return null " + " for property " + pd.getName()
119: + " of type " + pd.getPropertyType());
120: }
121: }
|