You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by bu...@apache.org on 2002/02/05 11:10:45 UTC
cvs commit: xml-cocoon2/src/java/org/apache/cocoon/components/deli DeliImpl.java
butlermh 02/02/05 02:10:45
Modified: src/java/org/apache/cocoon/components/deli DeliImpl.java
Log:
Added better exception handling.
Revision Changes Path
1.13 +43 -13 xml-cocoon2/src/java/org/apache/cocoon/components/deli/DeliImpl.java
Index: DeliImpl.java
===================================================================
RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/deli/DeliImpl.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- DeliImpl.java 4 Feb 2002 12:22:21 -0000 1.12
+++ DeliImpl.java 5 Feb 2002 10:10:45 -0000 1.13
@@ -1,4 +1,4 @@
-/*
+*
* The Apache Software License, Version 1.1
*
*
@@ -53,7 +53,6 @@
* <http://www.apache.org/>.
*/
-
package org.apache.cocoon.components.deli;
import org.apache.avalon.framework.activity.Initializable;
@@ -115,7 +114,7 @@
* A Delivery Context Library for CC/PP and UAProf</a>.
*
* @author <a href="mailto:marbut@hplb.hpl.hp.com">Mark H. Butler</a>
- * @version CVS $Id: DeliImpl.java,v 1.12 2002/02/04 12:22:21 cziegeler Exp $
+ * @version CVS $ $ $Date: 2002/02/05 10:10:45 $
*/
public final class DeliImpl
@@ -149,20 +148,32 @@
/** Contextualize this class */
public void contextualize(Context context)
throws ContextException {
- org.apache.cocoon.environment.Context ctx = (org.apache.cocoon.environment.Context) context.get(Constants.CONTEXT_ENVIRONMENT_CONTEXT);
- this.servletContext = new CocoonServletContext(ctx);
+ try {
+ org.apache.cocoon.environment.Context ctx = (org.apache.cocoon.environment.Context) context.get(Constants.CONTEXT_ENVIRONMENT_CONTEXT);
+ this.servletContext = new CocoonServletContext(ctx);
+ } catch (Exception e) {
+ getLogger().error("DELI Exception: ", e);
+ }
}
/** Compose this class */
public void compose(ComponentManager manager)
throws ComponentException {
- this.manager = manager;
- this.parser = (Parser)this.manager.lookup(Parser.ROLE);
+ try {
+ this.manager = manager;
+ this.parser = (Parser)this.manager.lookup(Parser.ROLE);
+ } catch (Exception e) {
+ getLogger().error("DELI Exception: ", e);
+ }
}
/** Configure this class */
public void parameterize(Parameters params) {
+ try {
this.deliConfig = params.getParameter("deli-config-file", this.deliConfig);
+ } catch (Exception e) {
+ getLogger().error("DELI Exception: ", e);
+ }
}
/**
@@ -170,12 +181,16 @@
*/
public void initialize()
throws Exception {
- this.workspace = new Workspace(this.servletContext, this.deliConfig);
+ try {
+ this.workspace = new Workspace(this.servletContext, this.deliConfig);
+ } catch (Exception e) {
+ getLogger().error("DELI Exception: ", e);
+ }
}
/** Dispose of this class */
public void dispose() {
- this.manager.release(parser);
+ if (parser != null) this.manager.release((Component)parser);
this.parser = null;
}
@@ -193,9 +208,14 @@
*/
public Profile getProfile(Request theRequest)
throws IOException, ServletException, Exception {
- CocoonServletRequest servletRequest = new CocoonServletRequest(theRequest);
- Profile theProfile = new Profile(this.workspace, (HttpServletRequest) servletRequest);
- return theProfile;
+ try {
+ CocoonServletRequest servletRequest = new CocoonServletRequest(theRequest);
+ Profile theProfile = new Profile(this.workspace, (HttpServletRequest) servletRequest);
+ return theProfile;
+ } catch (Exception e) {
+ getLogger().error("DELI Exception: ", e);
+ return null;
+ }
}
/** Convert a profile stored as a vector of profile attributes
@@ -205,6 +225,7 @@
*@return The DOM tree.
*/
public Document getUACapabilities(Profile theProfile) {
+ try {
Document document;
Element rootElement;
Element attributeNode;
@@ -239,11 +260,20 @@
}
}
return document;
+ } catch (Exception e) {
+ getLogger().error("DELI Exception: ", e);
+ return null;
+ }
}
public Document getUACapabilities(Request theRequest)
throws IOException, Exception {
- return this.getUACapabilities(this.getProfile(theRequest));
+ try {
+ return this.getUACapabilities(this.getProfile(theRequest));
+ } catch (Exception e) {
+ getLogger().error("DELI Exception: ", e);
+ return null;
+ }
}
/**
----------------------------------------------------------------------
In case of troubles, e-mail: webmaster@xml.apache.org
To unsubscribe, e-mail: cocoon-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: cocoon-cvs-help@xml.apache.org
RE: cvs commit: xml-cocoon2/src/java/org/apache/cocoon/components/deli DeliImpl.java
Posted by Carsten Ziegeler <cz...@s-und-n.de>.
Hi Mark,
I'm not sure if the exception handling introduced by this check-in is
really better. In my eyes its worse as now possible exceptions during
configuration and contextualization are ignored.
What do you think?
Carsten
> -----Original Message-----
> From: butlermh@apache.org [mailto:butlermh@apache.org]
> Sent: Tuesday, February 05, 2002 11:11 AM
> To: xml-cocoon2-cvs@apache.org
> Subject: cvs commit:
> xml-cocoon2/src/java/org/apache/cocoon/components/deli DeliImpl.java
>
>
> butlermh 02/02/05 02:10:45
>
> Modified: src/java/org/apache/cocoon/components/deli DeliImpl.java
> Log:
> Added better exception handling.
>
---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org