cziegeler 2002/09/11 23:16:43
Modified: src/java/org/apache/cocoon/components/source/impl
FileSource.java URLFactoryWrapper.java
SourceFactoryWrapper.java
src/java/org/apache/cocoon/components/source
SourceHandlerImpl.java XMLDBSource.java
XMLDBSourceFactory.java
Log:
logging and exception handling update
Revision Changes Path
1.7 +2 -2
xml-cocoon2/src/java/org/apache/cocoon/components/source/impl/FileSource.java
Index: FileSource.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/source/impl/FileSource.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- FileSource.java 19 Aug 2002 07:57:21 -0000 1.6
+++ FileSource.java 12 Sep 2002 06:16:43 -0000 1.7
@@ -284,7 +284,7 @@
out.flush();
out.close();
} catch (IOException ioe) {
- throw new SourceException("Could not copy source : "+ioe.getMessage());
+ throw new SourceException("Could not copy source : "+ioe.getMessage(),
ioe);
}
}
1.3 +1 -2
xml-cocoon2/src/java/org/apache/cocoon/components/source/impl/URLFactoryWrapper.java
Index: URLFactoryWrapper.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/source/impl/URLFactoryWrapper.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- URLFactoryWrapper.java 31 Jul 2002 13:13:25 -0000 1.2
+++ URLFactoryWrapper.java 12 Sep 2002 06:16:43 -0000 1.3
@@ -124,7 +124,6 @@
} catch (ConfigurationException e) {
throw e;
} catch (Exception e) {
- getLogger().error("Could not get URLFactory", e);
throw new ConfigurationException("Could not get parameters because: " +
e.getMessage(), e);
}
1.4 +1 -3
xml-cocoon2/src/java/org/apache/cocoon/components/source/impl/SourceFactoryWrapper.java
Index: SourceFactoryWrapper.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/source/impl/SourceFactoryWrapper.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- SourceFactoryWrapper.java 8 Aug 2002 02:10:40 -0000 1.3
+++ SourceFactoryWrapper.java 12 Sep 2002 06:16:43 -0000 1.4
@@ -121,7 +121,6 @@
} catch (ConfigurationException e) {
throw e;
} catch (Exception e) {
- getLogger().error("Could not get SourceFactory", e);
throw new ConfigurationException("Could not get parameters because: " +
e.getMessage(), e);
}
@@ -172,7 +171,6 @@
try {
source = this.sourceFactory.getSource(currentEnv, location);
} catch (ProcessingException pe) {
- getLogger().error("ProcessingException", pe);
throw new IOException("ProcessingException: " + pe.getMessage());
}
return new CocoonToAvalonSource( source );
1.11 +7 -4
xml-cocoon2/src/java/org/apache/cocoon/components/source/SourceHandlerImpl.java
Index: SourceHandlerImpl.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/source/SourceHandlerImpl.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- SourceHandlerImpl.java 31 Jul 2002 13:13:25 -0000 1.10
+++ SourceHandlerImpl.java 12 Sep 2002 06:16:43 -0000 1.11
@@ -105,7 +105,9 @@
public void configure(final Configuration conf)
throws ConfigurationException {
try {
- getLogger().debug("Getting the SourceFactories");
+ if (this.getLogger().isDebugEnabled()) {
+ getLogger().debug("Getting the SourceFactories");
+ }
HashMap factories = new HashMap();
Configuration[] configs = conf.getChildren("protocol");
SourceFactory sourceFactory = null;
@@ -116,7 +118,9 @@
throw new ConfigurationException("SourceFactory defined twice
for protocol: " + protocol);
}
- getLogger().debug("\tfor protocol: " + protocol + " " +
configs[i].getAttribute("class"));
+ if (this.getLogger().isDebugEnabled()) {
+ getLogger().debug("\tfor protocol: " + protocol + " " +
configs[i].getAttribute("class"));
+ }
sourceFactory = (SourceFactory)
ClassUtils.newInstance(configs[i].getAttribute("class"));
this.init(sourceFactory, configs[i]);
factories.put(protocol, sourceFactory);
@@ -126,7 +130,6 @@
} catch (ConfigurationException e) {
throw e;
} catch (Exception e) {
- getLogger().error("Could not get SourceFactories", e);
throw new ConfigurationException("Could not get parameters because: " +
e.getMessage());
}
1.9 +2 -7
xml-cocoon2/src/java/org/apache/cocoon/components/source/XMLDBSource.java
Index: XMLDBSource.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/source/XMLDBSource.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- XMLDBSource.java 31 Jul 2002 13:13:25 -0000 1.8
+++ XMLDBSource.java 12 Sep 2002 06:16:43 -0000 1.9
@@ -198,10 +198,8 @@
} catch (Exception e) {
- this.log.error("There was a problem setting up the connection");
- this.log.error("Make sure that your driver is available");
throw new ProcessingException("Problem setting up the connection to
XML:DB: "
- + e.getMessage(), e);
+ + e.getMessage() + ". Make sure that your driver is
available.", e);
}
@@ -262,7 +260,6 @@
} catch (XMLDBException xde) {
String error = "Unable to fetch content. Error "
+ xde.errorCode + ": " + xde.getMessage();
- this.log.debug(error, xde);
throw new SAXException(error, xde);
}
}
@@ -332,7 +329,6 @@
collection.close();
} catch (XMLDBException xde) {
String error = "Collection listing failed. Error " + xde.errorCode + ":
" + xde.getMessage();
- this.log.debug(error, xde);
throw new SAXException(error, xde);
}
}
@@ -386,7 +382,6 @@
handler.endDocument();
} catch (XMLDBException xde) {
String error = "Query failed. Error " + xde.errorCode + ": " +
xde.getMessage();
- this.log.debug(error, xde);
throw new SAXException(error, xde);
}
}
1.6 +1 -7
xml-cocoon2/src/java/org/apache/cocoon/components/source/XMLDBSourceFactory.java
Index: XMLDBSourceFactory.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/source/XMLDBSourceFactory.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- XMLDBSourceFactory.java 31 Jul 2002 13:13:25 -0000 1.5
+++ XMLDBSourceFactory.java 12 Sep 2002 06:16:43 -0000 1.6
@@ -133,12 +133,8 @@
int end = location.indexOf(':', start);
if (start == -1 || end == -1) {
- if (this.getLogger().isWarnEnabled()) {
- this.getLogger().warn("Mispelled XML:DB URL. " +
- "The syntax is \"xmldb:databasetype://host/collection/resource\"");
throw new MalformedURLException("Mispelled XML:DB URL. " +
"The syntax is \"xmldb:databasetype://host/collection/resource\"");
- }
}
String type = location.substring(start, end);
@@ -146,8 +142,6 @@
driver = (String)driverMap.get(type);
if (driver == null) {
- this.getLogger().error("Unable to find a driver for the \"" +
- type + " \" database type, please check the configuration");
throw new ProcessingException("Unable to find a driver for the \"" +
type + " \" database type, please check the configuration");
}
----------------------------------------------------------------------
In case of troubles, e-mail: [EMAIL PROTECTED]
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]