juergen 01/09/01 10:03:54
Modified: src/share/org/apache/slide/common NamespaceException.java
NestedSlideException.java SlideException.java
Log:
add the possibility to trace each creation of a SlideException via the logger.
Revision Changes Path
1.3 +22 -20
jakarta-slide/src/share/org/apache/slide/common/NamespaceException.java
Index: NamespaceException.java
===================================================================
RCS file:
/home/cvs/jakarta-slide/src/share/org/apache/slide/common/NamespaceException.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- NamespaceException.java 2000/09/26 02:44:05 1.2
+++ NamespaceException.java 2001/09/01 17:03:53 1.3
@@ -1,13 +1,13 @@
/*
- * $Header:
/home/cvs/jakarta-slide/src/share/org/apache/slide/common/NamespaceException.java,v
1.2 2000/09/26 02:44:05 remm Exp $
- * $Revision: 1.2 $
- * $Date: 2000/09/26 02:44:05 $
+ * $Header:
/home/cvs/jakarta-slide/src/share/org/apache/slide/common/NamespaceException.java,v
1.3 2001/09/01 17:03:53 juergen Exp $
+ * $Revision: 1.3 $
+ * $Date: 2001/09/01 17:03:53 $
*
* ====================================================================
*
* The Apache Software License, Version 1.1
*
- * Copyright (c) 1999 The Apache Software Foundation. All rights
+ * Copyright (c) 1999 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -15,7 +15,7 @@
* are met:
*
* 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
+ * notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
@@ -23,15 +23,15 @@
* distribution.
*
* 3. The end-user documentation included with the redistribution, if
- * any, must include the following acknowlegement:
- * "This product includes software developed by the
+ * any, must include the following acknowlegement:
+ * "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowlegement may appear in the software itself,
* if and wherever such third-party acknowlegements normally appear.
*
* 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
* Foundation" must not be used to endorse or promote products derived
- * from this software without prior written permission. For written
+ * from this software without prior written permission. For written
* permission, please contact [EMAIL PROTECTED]
*
* 5. Products derived from this software may not be called "Apache"
@@ -59,7 +59,7 @@
*
* [Additional notices, if required by prior licensing conditions]
*
- */
+ */
package org.apache.slide.common;
@@ -68,9 +68,9 @@
/**
* Namespace exception.
- *
+ *
* @author <a href="mailto:[EMAIL PROTECTED]">Remy Maucherat</a>
- * @version $Revision: 1.2 $
+ * @version $Revision: 1.3 $
*/
public class NamespaceException extends SlideException {
@@ -80,7 +80,7 @@
/**
* Constructor.
- *
+ *
* @param message Exception message
*/
public NamespaceException(String message) {
@@ -103,15 +103,17 @@
/**
* Displays the exception message.
- *
+ *
* @return String Message
*/
public String toString() {
String result = new String();
- Enumeration list = exceptions.elements();
- while (list.hasMoreElements()) {
- SlideException e = (SlideException) list.nextElement();
- result = result + e.getMessage() + "\n";
+ if( exceptions != null ) {
+ Enumeration list = exceptions.elements();
+ while (list.hasMoreElements()) {
+ SlideException e = (SlideException) list.nextElement();
+ result = result + e.getMessage() + "\n";
+ }
}
return result;
}
@@ -122,7 +124,7 @@
/**
* Add an exception to the nested exception.
- *
+ *
* @param exception Exception to be added
*/
void addException(SlideException exception) {
@@ -132,8 +134,8 @@
/**
* Returns true if no exceptions have been put in this exception.
- *
- * @return boolean
+ *
+ * @return boolean
*/
boolean isEmpty() {
return exceptions.isEmpty();
1.3 +10 -8
jakarta-slide/src/share/org/apache/slide/common/NestedSlideException.java
Index: NestedSlideException.java
===================================================================
RCS file:
/home/cvs/jakarta-slide/src/share/org/apache/slide/common/NestedSlideException.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- NestedSlideException.java 2001/07/24 09:27:18 1.2
+++ NestedSlideException.java 2001/09/01 17:03:53 1.3
@@ -1,7 +1,7 @@
/*
- * $Header:
/home/cvs/jakarta-slide/src/share/org/apache/slide/common/NestedSlideException.java,v
1.2 2001/07/24 09:27:18 juergen Exp $
- * $Revision: 1.2 $
- * $Date: 2001/07/24 09:27:18 $
+ * $Header:
/home/cvs/jakarta-slide/src/share/org/apache/slide/common/NestedSlideException.java,v
1.3 2001/09/01 17:03:53 juergen Exp $
+ * $Revision: 1.3 $
+ * $Date: 2001/09/01 17:03:53 $
*
* ====================================================================
*
@@ -70,7 +70,7 @@
* Nested Slide exception.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Remy Maucherat</a>
- * @version $Revision: 1.2 $
+ * @version $Revision: 1.3 $
*/
public class NestedSlideException extends SlideException {
@@ -161,10 +161,12 @@
*/
public String toString() {
String result = new String();
- Enumeration list = exceptions.elements();
- while (list.hasMoreElements()) {
- SlideException e = (SlideException) list.nextElement();
- result = result + e.getMessage() + "\n";
+ if( exceptions != null ) {
+ Enumeration list = exceptions.elements();
+ while (list.hasMoreElements()) {
+ SlideException e = (SlideException) list.nextElement();
+ result = result + e.getMessage() + "\n";
+ }
}
return result;
}
1.5 +28 -13
jakarta-slide/src/share/org/apache/slide/common/SlideException.java
Index: SlideException.java
===================================================================
RCS file:
/home/cvs/jakarta-slide/src/share/org/apache/slide/common/SlideException.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- SlideException.java 2000/09/26 02:44:07 1.4
+++ SlideException.java 2001/09/01 17:03:53 1.5
@@ -1,13 +1,13 @@
/*
- * $Header:
/home/cvs/jakarta-slide/src/share/org/apache/slide/common/SlideException.java,v 1.4
2000/09/26 02:44:07 remm Exp $
- * $Revision: 1.4 $
- * $Date: 2000/09/26 02:44:07 $
+ * $Header:
/home/cvs/jakarta-slide/src/share/org/apache/slide/common/SlideException.java,v 1.5
2001/09/01 17:03:53 juergen Exp $
+ * $Revision: 1.5 $
+ * $Date: 2001/09/01 17:03:53 $
*
* ====================================================================
*
* The Apache Software License, Version 1.1
*
- * Copyright (c) 1999 The Apache Software Foundation. All rights
+ * Copyright (c) 1999 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -15,7 +15,7 @@
* are met:
*
* 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
+ * notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
@@ -23,15 +23,15 @@
* distribution.
*
* 3. The end-user documentation included with the redistribution, if
- * any, must include the following acknowlegement:
- * "This product includes software developed by the
+ * any, must include the following acknowlegement:
+ * "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowlegement may appear in the software itself,
* if and wherever such third-party acknowlegements normally appear.
*
* 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
* Foundation" must not be used to endorse or promote products derived
- * from this software without prior written permission. For written
+ * from this software without prior written permission. For written
* permission, please contact [EMAIL PROTECTED]
*
* 5. Products derived from this software may not be called "Apache"
@@ -59,25 +59,36 @@
*
* [Additional notices, if required by prior licensing conditions]
*
- */
+ */
package org.apache.slide.common;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+
+import org.apache.slide.common.Domain;
+import org.apache.slide.util.logger.Logger;
+
+
/**
* Exception supertype for all Slide components.
- *
+ *
* @author <a href="mailto:[EMAIL PROTECTED]">Remy Maucherat</a>
- * @version $Revision: 1.4 $
+ * @version $Revision: 1.5 $
*/
public class SlideException extends Exception {
+ private static final String CHANNEL = "org.apache.slide.common.SlideException";
+ private static final int DEBUG = Logger.DEBUG;
+ private static Logger LOGGER = Domain.getLogger();
+
// ----------------------------------------------------------- Constructors
/**
* SlideException with logging.
- *
+ *
* @param message Exception message
*/
public SlideException(String message) {
@@ -87,7 +98,7 @@
/**
* SlideException with or without logging.
- *
+ *
* @param message Exception message
* @param showTrace Defines whether or not something is logged
*/
@@ -96,6 +107,10 @@
if (showTrace) {
Domain.warn(message);
}
+
+ StringWriter sw = new StringWriter();
+ printStackTrace( new PrintWriter(sw, true) ); //autoFlush=true
+ LOGGER.log( sw.toString(), CHANNEL, DEBUG );
}
}