butlermh 02/02/05 07:30:14 Modified: src/java/org/apache/cocoon/components/deli DeliImpl.java Log: Better exception handling attempt 2 Revision Changes Path 1.15 +29 -39 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.14 retrieving revision 1.15 diff -u -r1.14 -r1.15 --- DeliImpl.java 5 Feb 2002 12:11:07 -0000 1.14 +++ DeliImpl.java 5 Feb 2002 15:30:14 -0000 1.15 @@ -114,7 +114,7 @@ * A Delivery Context Library for CC/PP and UAProf</a>. * * @author <a href="mailto:[EMAIL PROTECTED]">Mark H. Butler</a> - * @version CVS $ $ $Date: 2002/02/05 12:11:07 $ + * @version CVS $ $ $Date: 2002/02/05 15:30:14 $ */ public final class DeliImpl @@ -148,44 +148,38 @@ /** Contextualize this class */ public void contextualize(Context context) throws ContextException { - 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); - } + org.apache.cocoon.environment.Context ctx = (org.apache.cocoon.environment.Context) context.get(Constants.CONTEXT_ENVIRONMENT_CONTEXT); + this.servletContext = new CocoonServletContext(ctx); } /** Compose this class */ - public void compose(ComponentManager manager) + public void compose(ComponentManager manager) throws ComponentException { - try { - this.manager = manager; - this.parser = (Parser)this.manager.lookup(Parser.ROLE); - } catch (Exception e) { - getLogger().error("DELI Exception: ", e); - } + this.manager = manager; + try { + this.parser = (Parser)this.manager.lookup(Parser.ROLE); + } catch (ComponentException e) { + getLogger().error("DELI Exception while creating parser: ", e); + throw 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); - } } /** * Initialize */ - public void initialize() + public void initialize() throws Exception { - try { + try { this.workspace = new Workspace(this.servletContext, this.deliConfig); - } catch (Exception e) { - getLogger().error("DELI Exception: ", e); - } + } catch (Exception e) { + getLogger().error("DELI Exception while creating workspace: ", e); + throw e; + } } /** Dispose of this class */ @@ -208,14 +202,14 @@ */ public Profile getProfile(Request theRequest) throws IOException, ServletException, Exception { - try { + 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; - } + } catch (Exception e) { + getLogger().error("DELI Exception while retrieving profile: ", e); + throw e; + } } /** Convert a profile stored as a vector of profile attributes @@ -224,8 +218,9 @@ *@param theProfile The profile as a vector of profile attributes. *@return The DOM tree. */ - public Document getUACapabilities(Profile theProfile) { - try { + public Document getUACapabilities(Profile theProfile) + throws Exception { + try { Document document; Element rootElement; Element attributeNode; @@ -260,20 +255,15 @@ } } return document; - } catch (Exception e) { - getLogger().error("DELI Exception: ", e); - return null; - } + } catch (Exception e) { + getLogger().error("DELI Exception while converting profile to DOM fragment: ", e); + throw e; + } } public Document getUACapabilities(Request theRequest) throws IOException, Exception { - try { return this.getUACapabilities(this.getProfile(theRequest)); - } catch (Exception e) { - getLogger().error("DELI Exception: ", e); - return null; - } } /**
---------------------------------------------------------------------- In case of troubles, e-mail: [EMAIL PROTECTED] To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]