Author: cziegeler Date: Sun Jan 30 10:24:33 2005 New Revision: 149132 URL: http://svn.apache.org/viewcvs?view=rev&rev=149132 Log: <action dev="CZ" type="fix" fixes-bug="32987" due-to="Michal Durdina" due-to-email="[EMAIL PROTECTED]"> Apply patch for a better exception handling in the Meta-InputModule when an input module is not found. </action>
Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/axis/java/org/apache/cocoon/components/axis/SoapServer.java cocoon/branches/BRANCH_2_1_X/src/blocks/axis/java/org/apache/cocoon/components/axis/SoapServerImpl.java cocoon/branches/BRANCH_2_1_X/src/blocks/axis/java/org/apache/cocoon/components/axis/providers/AvalonProvider.java cocoon/branches/BRANCH_2_1_X/src/blocks/axis/java/org/apache/cocoon/reading/AxisRPCReader.java cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/modules/input/AbstractMetaModule.java cocoon/branches/BRANCH_2_1_X/status.xml Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/axis/java/org/apache/cocoon/components/axis/SoapServer.java Url: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/axis/java/org/apache/cocoon/components/axis/SoapServer.java?view=diff&rev=149132&p1=cocoon/branches/BRANCH_2_1_X/src/blocks/axis/java/org/apache/cocoon/components/axis/SoapServer.java&r1=149131&p2=cocoon/branches/BRANCH_2_1_X/src/blocks/axis/java/org/apache/cocoon/components/axis/SoapServer.java&r2=149132 ============================================================================== --- cocoon/branches/BRANCH_2_1_X/src/blocks/axis/java/org/apache/cocoon/components/axis/SoapServer.java (original) +++ cocoon/branches/BRANCH_2_1_X/src/blocks/axis/java/org/apache/cocoon/components/axis/SoapServer.java Sun Jan 30 10:24:33 2005 @@ -45,10 +45,10 @@ * </p> * * @author <a href="mailto:[EMAIL PROTECTED]">Marcus Crafter</a> - * @version CVS $Id: SoapServer.java,v 1.2 2004/03/05 13:01:41 bdelacretaz Exp $ + * @version CVS $Id$ */ -public interface SoapServer extends Component, Startable -{ +public interface SoapServer extends Component, Startable { + /** * Component's ROLE definition */ Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/axis/java/org/apache/cocoon/components/axis/SoapServerImpl.java Url: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/axis/java/org/apache/cocoon/components/axis/SoapServerImpl.java?view=diff&rev=149132&p1=cocoon/branches/BRANCH_2_1_X/src/blocks/axis/java/org/apache/cocoon/components/axis/SoapServerImpl.java&r1=149131&p2=cocoon/branches/BRANCH_2_1_X/src/blocks/axis/java/org/apache/cocoon/components/axis/SoapServerImpl.java&r2=149132 ============================================================================== --- cocoon/branches/BRANCH_2_1_X/src/blocks/axis/java/org/apache/cocoon/components/axis/SoapServerImpl.java (original) +++ cocoon/branches/BRANCH_2_1_X/src/blocks/axis/java/org/apache/cocoon/components/axis/SoapServerImpl.java Sun Jan 30 10:24:33 2005 @@ -1,5 +1,5 @@ /* - * Copyright 1999-2004 The Apache Software Foundation. + * Copyright 1999-2005 The Apache Software Foundation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -88,12 +88,12 @@ * @author <a href="mailto:">Steve Loughran</a> * @author <a href="mailto:[EMAIL PROTECTED]">Doug Davis</a> * - * @version CVS $Id: SoapServerImpl.java,v 1.4 2004/03/28 20:51:24 antonio Exp $ + * @version CVS $Id$ */ public class SoapServerImpl extends AbstractLogEnabled implements SoapServer, Composable, Configurable, Contextualizable, Initializable, - Startable, ThreadSafe -{ + Startable, ThreadSafe { + /** * Constant describing the default location of the server configuration file */ @@ -125,37 +125,29 @@ private WSDDDocument[] m_descriptors; // context reference - private Context m_context; + private Context context; // component manager reference - private ComponentManager m_manager; + private ComponentManager manager; - /** - * Contextualize this Reader. - * - * @param context a <code>Context</code> instance - * @exception ContextException if an error occurs + /* (non-Javadoc) + * @see org.apache.avalon.framework.context.Contextualizable#contextualize(org.apache.avalon.framework.context.Context) */ public void contextualize(final Context context) - throws ContextException - { - m_context = context; + throws ContextException { + this.context = context; } - /** - * Compose this server - * - * @param manager a <code>ComponentManager</code> value - * @exception ComponentException if an error occurs + /* (non-Javadoc) + * @see org.apache.avalon.framework.component.Composable#compose(org.apache.avalon.framework.component.ComponentManager) */ public void compose(ComponentManager manager) - throws ComponentException - { - m_manager = manager; + throws ComponentException { + this.manager = manager; } /** - * Configures this reader. + * Configures this server. * * <p> * Sets the following optional configuration settings: @@ -191,8 +183,7 @@ * @exception ConfigurationException if an error occurs */ public void configure(final Configuration config) - throws ConfigurationException - { + throws ConfigurationException { try { setServerConfig(config); setAttachmentDir(config); @@ -216,22 +207,18 @@ * @exception Exception if an error occurs */ public void setServerConfig(final Configuration config) - throws Exception - { + throws Exception { final Configuration wsdd = config.getChild("server-wsdd"); SourceResolver resolver = null; - try - { - resolver = (SourceResolver) m_manager.lookup(SourceResolver.ROLE); + try { + resolver = (SourceResolver) this.manager.lookup(SourceResolver.ROLE); m_serverWSDD = resolver.resolveURI( wsdd.getAttribute("src", DEFAULT_SERVER_CONFIG) ); - } - finally - { - if (resolver != null) m_manager.release(resolver); + } finally { + this.manager.release(resolver); } } @@ -244,22 +231,19 @@ * @exception ContextException if a context error occurs */ private void setAttachmentDir(final Configuration config) - throws ConfigurationException, ContextException - { + throws ConfigurationException, ContextException { final Configuration dir = config.getChild("attachment-dir"); m_attachmentDir = dir.getAttribute("src", null); - if (m_attachmentDir == null) - { + if (m_attachmentDir == null) { File workDir = - (File) m_context.get(org.apache.cocoon.Constants.CONTEXT_WORK_DIR); + (File) this.context.get(org.apache.cocoon.Constants.CONTEXT_WORK_DIR); File attachmentDir = IOUtils.createFile(workDir, "attachments" + File.separator); m_attachmentDir = IOUtils.getFullFilename(attachmentDir); } - if (getLogger().isDebugEnabled()) - { + if (getLogger().isDebugEnabled()) { getLogger().debug("attachment directory = " + m_attachmentDir); } } @@ -273,22 +257,19 @@ * @exception ContextException if a context error occurs */ private void setJWSDir(final Configuration config) - throws ConfigurationException, ContextException - { + throws ConfigurationException, ContextException { final Configuration dir = config.getChild("jws-dir"); m_jwsClassDir = dir.getAttribute("src", null); - if (m_jwsClassDir == null) - { + if (m_jwsClassDir == null) { File workDir = - (File) m_context.get(org.apache.cocoon.Constants.CONTEXT_WORK_DIR); + (File) this.context.get(org.apache.cocoon.Constants.CONTEXT_WORK_DIR); File jwsClassDir = IOUtils.createFile(workDir, "axis-jws" + File.separator); m_jwsClassDir = IOUtils.getFullFilename(jwsClassDir); } - if (getLogger().isDebugEnabled()) - { + if (getLogger().isDebugEnabled()) { getLogger().debug("jws class directory = " + m_jwsClassDir); } } @@ -300,22 +281,20 @@ * @exception ConfigurationException if an error occurs */ private void setSecurityProvider(final Configuration config) - throws ConfigurationException - { + throws ConfigurationException { final Configuration secProvider = config.getChild("security-provider", false); - if (secProvider != null) - { + if (secProvider != null) { final String attr = secProvider.getAttribute("enabled"); final boolean providerIsEnabled = BooleanUtils.toBoolean(attr); - if (providerIsEnabled) + if (providerIsEnabled) { m_securityProvider = new ServletSecurityProvider(); + } } - if (getLogger().isDebugEnabled()) - { + if (getLogger().isDebugEnabled()) { getLogger().debug("security provider = " + m_securityProvider); } } @@ -327,8 +306,7 @@ * @exception ConfigurationException if an error occurs */ private void setTransportName(final Configuration config) - throws ConfigurationException - { + throws ConfigurationException { final Configuration name = config.getChild("transport"); m_transportName = name.getAttribute("name", HTTPTransport.DEFAULT_TRANSPORT_NAME); @@ -343,24 +321,20 @@ * @exception Exception if an error occurs */ private void setManagedServices(final Configuration config) - throws Exception - { + throws Exception { final Configuration m = config.getChild("managed-services", false); final List descriptors = new ArrayList(); - if (m != null) - { + if (m != null) { SourceResolver resolver = null; DOMParser parser = null; - try - { + try { final Configuration[] services = m.getChildren("descriptor"); - resolver = (SourceResolver) m_manager.lookup(SourceResolver.ROLE); - parser = (DOMParser) m_manager.lookup(DOMParser.ROLE); + resolver = (SourceResolver) this.manager.lookup(SourceResolver.ROLE); + parser = (DOMParser) this.manager.lookup(DOMParser.ROLE); - for (int i = 0; i < services.length; ++i) - { + for (int i = 0; i < services.length; ++i) { final String location = services[i].getAttribute("src"); Source source = resolver.resolveURI(location); @@ -373,11 +347,9 @@ descriptors.add(new WSDDDocument(d)); } - } - finally - { - if (resolver != null) m_manager.release(resolver); - if (parser != null) m_manager.release((Component)parser); + } finally { + this.manager.release(resolver); + this.manager.release((Component)parser); } } @@ -386,39 +358,32 @@ (WSDDDocument[]) descriptors.toArray(new WSDDDocument[]{}); } - /** - * Initialize this reader, creates AXIS server engine. - * - * @exception Exception if an error occurs + /* (non-Javadoc) + * @see org.apache.avalon.framework.activity.Initializable#initialize() */ public void initialize() - throws Exception - { + throws Exception { m_axisServer = createEngine(); - if (getLogger().isDebugEnabled()) - { + if (getLogger().isDebugEnabled()) { getLogger().debug("SoapServerImpl.initialize() complete"); } } /** - * Starts this reader. Deploys all managed services as specified at + * Starts this server. Deploys all managed services as specified at * configuration time. * * @exception Exception if an error occurs */ public void start() - throws Exception - { + throws Exception { // deploy all configured services - for (int i = 0; i < m_descriptors.length; ++i) - { + for (int i = 0; i < m_descriptors.length; ++i) { WSDDDeployment deployment = m_engineConfig.getDeployment(); m_descriptors[i].deploy(deployment); - if (getLogger().isDebugEnabled()) - { + if (getLogger().isDebugEnabled()) { getLogger().debug( "Deployed Descriptor:\n" + XMLUtils.DocumentToString(m_descriptors[i].getDOMDocument()) @@ -426,8 +391,7 @@ } } - if (getLogger().isDebugEnabled()) - { + if (getLogger().isDebugEnabled()) { getLogger().debug("SoapServerImpl.start() complete"); } } @@ -440,31 +404,29 @@ * @exception Exception if an error occurs */ public void stop() - throws Exception - { + throws Exception { WSDDDeployment deployment = m_engineConfig.getDeployment(); WSDDService[] services = deployment.getServices(); // undeploy all deployed services - for (int i = 0; i < services.length; ++i) - { + for (int i = 0; i < services.length; ++i) { deployment.undeployService(services[i].getQName()); - if (getLogger().isDebugEnabled()) - { + if (getLogger().isDebugEnabled()) { getLogger().debug("Undeployed: " + services[i].toString()); } } - if (getLogger().isDebugEnabled()) - { + if (getLogger().isDebugEnabled()) { getLogger().debug("SoapServerImpl.stop() complete"); } } + /* (non-Javadoc) + * @see org.apache.cocoon.components.axis.SoapServer#invoke(org.apache.axis.MessageContext) + */ public void invoke(MessageContext message) - throws Exception - { + throws Exception { m_axisServer.invoke(message); } @@ -478,9 +440,8 @@ public MessageContext createMessageContext( HttpServletRequest req, HttpServletResponse res, - ServletContext con - ) - { + ServletContext con) { + MessageContext msgContext = new MessageContext(m_axisServer); String webInfPath = con.getRealPath("/WEB-INF"); String homeDir = con.getRealPath("/"); @@ -490,7 +451,7 @@ // Add Avalon specifics to MessageContext msgContext.setProperty(LOGGER, getLogger()); - msgContext.setProperty(AvalonProvider.COMPONENT_MANAGER, m_manager); + msgContext.setProperty(AvalonProvider.COMPONENT_MANAGER, this.manager); // Save some HTTP specific info in the bag in case someone needs it msgContext.setProperty(Constants.MC_JWS_CLASSDIR, m_jwsClassDir); @@ -514,19 +475,18 @@ // Save the real path String realpath = con.getRealPath(req.getServletPath()); - if (realpath != null) - { + if (realpath != null) { msgContext.setProperty(Constants.MC_REALPATH, realpath); } msgContext.setProperty(Constants.MC_CONFIGPATH, webInfPath); - if (m_securityProvider != null) + if (m_securityProvider != null) { msgContext.setProperty("securityProvider", m_securityProvider); + } // write out the contents of the message context for debugging purposes - if (getLogger().isDebugEnabled()) - { + if (getLogger().isDebugEnabled()) { debugMessageContext(msgContext); } @@ -538,12 +498,8 @@ * * @param context a <code>MessageContext</code> instance */ - private void debugMessageContext(final MessageContext context) - { - for (final Iterator i = context.getPropertyNames(); - i.hasNext(); - ) - { + private void debugMessageContext(final MessageContext context) { + for (final Iterator i = context.getPropertyNames(); i.hasNext(); ) { final String key = (String) i.next(); getLogger().debug( "MessageContext: Key:" + key + ": Value: " + context.getProperty(key) @@ -557,12 +513,10 @@ * context. */ public AxisServer createEngine() - throws Exception - { + throws Exception { AxisServer engine = AxisServer.getServer(getEngineEnvironment()); - if (getLogger().isDebugEnabled()) - { + if (getLogger().isDebugEnabled()) { getLogger().debug("Axis engine created"); } @@ -570,8 +524,7 @@ } protected Map getEngineEnvironment() - throws Exception - { + throws Exception { Map env = new HashMap(); // use FileProvider directly with a Avalon Source object instead of going @@ -585,33 +538,4 @@ return env; } - - /* - * Helper method to convert a <code>Message</code> structure - * into a <code>String</code>. - * - * @param msg a <code>Message</code> value - * @return a <code>String</code> value - */ - /* FIXME (SM): this method appears to be unused, should we remove it? - private String messageToString(final Message msg) - { - try - { - OutputStream os = new ByteArrayOutputStream(); - msg.writeTo(os); - return os.toString(); - } - catch (Exception e) - { - if (getLogger().isWarnEnabled()) - { - getLogger().warn( - "Warning, could not convert message (" + msg + ") into string", e - ); - } - - return null; - } - } */ } Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/axis/java/org/apache/cocoon/components/axis/providers/AvalonProvider.java Url: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/axis/java/org/apache/cocoon/components/axis/providers/AvalonProvider.java?view=diff&rev=149132&p1=cocoon/branches/BRANCH_2_1_X/src/blocks/axis/java/org/apache/cocoon/components/axis/providers/AvalonProvider.java&r1=149131&p2=cocoon/branches/BRANCH_2_1_X/src/blocks/axis/java/org/apache/cocoon/components/axis/providers/AvalonProvider.java&r2=149132 ============================================================================== --- cocoon/branches/BRANCH_2_1_X/src/blocks/axis/java/org/apache/cocoon/components/axis/providers/AvalonProvider.java (original) +++ cocoon/branches/BRANCH_2_1_X/src/blocks/axis/java/org/apache/cocoon/components/axis/providers/AvalonProvider.java Sun Jan 30 10:24:33 2005 @@ -110,11 +110,8 @@ * @return an object that implements the service * @exception Exception if an error occurs */ - protected Object makeNewServiceObject( - MessageContext msgContext, String role - ) - throws Exception - { + protected Object makeNewServiceObject(MessageContext msgContext, String role) + throws Exception { ComponentManager manager = (ComponentManager) msgContext.getProperty(COMPONENT_MANAGER); @@ -134,8 +131,7 @@ * @exception Exception if an error occurs */ private Object decorate(final Component object, final ComponentManager manager) - throws Exception - { + throws Exception { // obtain a list of all interfaces this object implements Class[] interfaces = object.getClass().getInterfaces(); @@ -160,8 +156,7 @@ * Return the option in the configuration that contains the service class * name. In the Avalon case, it is the ROLE name to lookup. */ - protected String getServiceClassNameOptionName() - { + protected String getServiceClassNameOptionName() { return ROLE; } @@ -175,29 +170,21 @@ * @exception AxisFault if an error occurs */ protected Class getServiceClass( - String role, SOAPService service, MessageContext msgContext - ) - throws AxisFault - { + String role, SOAPService service, MessageContext msgContext) + throws AxisFault { // Assuming ExcaliburComponentManager semantics the ROLE name is // actually the class name, potentially with a variant following // the class name with a '/' separator - try - { + try { int i; if ((i = role.indexOf('/')) != -1) { return Class.forName(role.substring(0, i)); } - else - { - return Class.forName(role); - } - } - catch (ClassNotFoundException e) - { + return Class.forName(role); + } catch (ClassNotFoundException e) { throw new AxisFault("Couldn't create class object for role " + role, e); } } @@ -234,8 +221,8 @@ * on the scope of the service (ie. Request, Session & Application). * </p> */ - final static class Handler implements InvocationHandler - { + final static class Handler implements InvocationHandler { + // Constants describing the ServiceLifecycle.destroy method private final static String SL_DESTROY = "destroy"; private final Class SL_CLASS = ServiceLifecycle.class; @@ -250,8 +237,7 @@ * @param object a <code>Component</code> instance * @param manager a <code>ComponentManager</code> instance */ - public Handler(final Component object, final ComponentManager manager) - { + public Handler(final Component object, final ComponentManager manager) { m_object = object; m_manager = manager; } @@ -274,22 +260,17 @@ * @exception Throwable if an error occurs */ public Object invoke(Object proxy, Method method, Object[] args) - throws Throwable - { + throws Throwable { // if ServiceLifecycle.destroy() called, return to CM - if (method.getDeclaringClass().equals(SL_CLASS)) - { - if (method.getName().equals(SL_DESTROY)) - { + if (method.getDeclaringClass().equals(SL_CLASS)) { + if (method.getName().equals(SL_DESTROY)) { m_manager.release(m_object); } return null; } - else // otherwise pass call to the real object - { - return method.invoke(m_object, args); - } + // otherwise pass call to the real object + return method.invoke(m_object, args); } } } Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/axis/java/org/apache/cocoon/reading/AxisRPCReader.java Url: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/axis/java/org/apache/cocoon/reading/AxisRPCReader.java?view=diff&rev=149132&p1=cocoon/branches/BRANCH_2_1_X/src/blocks/axis/java/org/apache/cocoon/reading/AxisRPCReader.java&r1=149131&p2=cocoon/branches/BRANCH_2_1_X/src/blocks/axis/java/org/apache/cocoon/reading/AxisRPCReader.java&r2=149132 ============================================================================== --- cocoon/branches/BRANCH_2_1_X/src/blocks/axis/java/org/apache/cocoon/reading/AxisRPCReader.java (original) +++ cocoon/branches/BRANCH_2_1_X/src/blocks/axis/java/org/apache/cocoon/reading/AxisRPCReader.java Sun Jan 30 10:24:33 2005 @@ -1,5 +1,5 @@ /* - * Copyright 1999-2004 The Apache Software Foundation. + * Copyright 1999-2005 The Apache Software Foundation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -122,16 +122,13 @@ final SourceResolver resolver, final Map objectModel, final String src, - final Parameters parameters - ) - throws ProcessingException, IOException, SAXException - { + final Parameters parameters) + throws ProcessingException, IOException, SAXException { super.setup(resolver, objectModel, src, parameters); checkHTTPPost(objectModel); - if (getLogger().isDebugEnabled()) - { + if (getLogger().isDebugEnabled()) { getLogger().debug("AxisRPCReader.setup() complete"); } } @@ -143,8 +140,7 @@ * @exception ProcessingException if a non HTTP-POST request has been made. */ private void checkHTTPPost(final Map objectModel) - throws ProcessingException - { + throws ProcessingException { String method = ObjectModelHelper.getRequest(objectModel).getMethod(); if (!"POST".equalsIgnoreCase(method)) @@ -166,8 +162,7 @@ * @exception ProcessingException if a processing error occurs */ public void generate() - throws IOException, SAXException, ProcessingException - { + throws IOException, SAXException, ProcessingException { HttpServletRequest req = (HttpServletRequest) objectModel.get(HttpEnvironment.HTTP_REQUEST_OBJECT); HttpServletResponse res = @@ -179,8 +174,7 @@ MessageContext msgContext = null; Message responseMsg = null; - try - { + try { res.setBufferSize(1024 * 8); // provide performance boost. // Get message context w/ various properties set @@ -194,8 +188,7 @@ req.getHeader(HTTPConstants.HEADER_CONTENT_LOCATION) ); - if (getLogger().isDebugEnabled()) - { + if (getLogger().isDebugEnabled()) { getLogger().debug("Request message:\n" + messageToString(requestMsg)); } @@ -204,8 +197,7 @@ String url = HttpUtils.getRequestURL(req).toString(); msgContext.setProperty(MessageContext.TRANS_URL, url); - try - { + try { // // Save the SOAPAction header in the MessageContext bag. // This will be used to tell the Axis Engine which service @@ -217,8 +209,7 @@ // soapAction = getSoapAction(req); - if (soapAction != null) - { + if (soapAction != null) { msgContext.setUseSOAPAction(true); msgContext.setSOAPActionURI(soapAction); } @@ -227,15 +218,13 @@ msgContext.setSession(new AxisHttpSession(req)); // Invoke the Axis engine... - if(getLogger().isDebugEnabled()) - { + if(getLogger().isDebugEnabled()) { getLogger().debug("Invoking Axis Engine"); } m_server.invoke(msgContext); - if(getLogger().isDebugEnabled()) - { + if(getLogger().isDebugEnabled()) { getLogger().debug("Return from Axis Engine"); } @@ -244,11 +233,8 @@ //tell everyone that something is wrong throw new Exception("no response message"); } - } - catch (AxisFault fault) - { - if (getLogger().isErrorEnabled()) - { + } catch (AxisFault fault) { + if (getLogger().isErrorEnabled()) { getLogger().error("Axis Fault", fault); } @@ -259,14 +245,11 @@ if (responseMsg == null) { responseMsg = new Message(fault); } - } - catch (Exception e) - { + } catch (Exception e) { //other exceptions are internal trouble responseMsg = msgContext.getResponseMessage(); res.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); - if (getLogger().isErrorEnabled()) - { + if (getLogger().isErrorEnabled()) { getLogger().error("Error during SOAP call", e); } if (responseMsg == null) { @@ -275,11 +258,8 @@ responseMsg = new Message(fault); } } - } - catch (AxisFault fault) - { - if (getLogger().isErrorEnabled()) - { + } catch (AxisFault fault) { + if (getLogger().isErrorEnabled()) { getLogger().error("Axis fault occured while perforing request", fault); } processAxisFault(fault); @@ -288,25 +268,20 @@ if( responseMsg == null) { responseMsg = new Message(fault); } - } - catch (Exception e) - { + } catch (Exception e) { throw new ProcessingException("Exception thrown while performing request", e); } // Send response back - if (responseMsg != null) - { - if (getLogger().isDebugEnabled()) - { + if (responseMsg != null) { + if (getLogger().isDebugEnabled()) { getLogger().debug("Sending response:\n" + messageToString(responseMsg)); } sendResponse(getProtocolVersion(req), msgContext.getSOAPConstants(), res, responseMsg); } - if (getLogger().isDebugEnabled()) - { + if (getLogger().isDebugEnabled()) { getLogger().debug("AxisRPCReader.generate() complete"); } } @@ -350,7 +325,7 @@ if (status == HttpServletResponse.SC_UNAUTHORIZED) { // unauth access results in authentication request // TODO: less generic realm choice? - response.setHeader("WWW-Authenticate","Basic realm=\"AXIS\""); + response.setHeader("WWW-Authenticate","Basic realm=\"AXIS\""); } response.setStatus(status); } @@ -361,8 +336,7 @@ * @param af Axis Fault * @return HTTP Status code. */ - protected int getHttpServletResponseStatus(AxisFault af) - { + protected int getHttpServletResponseStatus(AxisFault af) { // This will raise a 401 for both "Unauthenticated" & "Unauthorized"... return af.getFaultCode().getLocalPart().startsWith("Server.Unauth") ? HttpServletResponse.SC_UNAUTHORIZED @@ -382,40 +356,29 @@ final String clientVersion, final SOAPConstants constants, final HttpServletResponse res, - final Message responseMsg - ) - throws AxisFault, IOException - { - if (responseMsg == null) - { + final Message responseMsg) + throws AxisFault, IOException { + if (responseMsg == null) { res.setStatus(HttpServletResponse.SC_NO_CONTENT); - if (getLogger().isDebugEnabled()) - { + if (getLogger().isDebugEnabled()) { getLogger().debug("No axis response, not sending one"); } - } - else - { - if (getLogger().isDebugEnabled()) - { + } else { + if (getLogger().isDebugEnabled()) { getLogger().debug("Returned Content-Type:" + responseMsg.getContentType(constants)); getLogger().debug("Returned Content-Length:" + responseMsg.getContentLength()); } - try - { + try { res.setContentType(responseMsg.getContentType(constants)); responseMsg.writeTo(res.getOutputStream()); - } - catch (SOAPException e) - { + } catch (SOAPException e) { getLogger().error("Exception sending response", e); } } - if (!res.isCommitted()) - { + if (!res.isCommitted()) { res.flushBuffer(); // Force it right now. } } @@ -429,12 +392,10 @@ * @throws AxisFault */ private String getSoapAction(HttpServletRequest req) - throws AxisFault - { + throws AxisFault { String soapAction = req.getHeader(HTTPConstants.HEADER_SOAP_ACTION); - if (getLogger().isDebugEnabled()) - { + if (getLogger().isDebugEnabled()) { getLogger().debug("HEADER_SOAP_ACTION:" + soapAction); } @@ -442,8 +403,7 @@ // Technically, if we don't find this header, we should probably fault. // It's required in the SOAP HTTP binding. // - if (soapAction == null) - { + if (soapAction == null) { throw new AxisFault( "Client.NoSOAPAction", "No SOAPAction header", @@ -461,7 +421,7 @@ * Return the HTTP protocol level 1.1 or 1.0 * by derived class. */ - private String getProtocolVersion(HttpServletRequest req){ + private String getProtocolVersion(HttpServletRequest req) { String ret = HTTPConstants.HEADER_PROTOCOL_V10; String prot = req.getProtocol(); if (prot!= null) { @@ -483,18 +443,13 @@ * @param msg a <code>Message</code> value * @return a <code>String</code> value */ - private String messageToString(final Message msg) - { - try - { + private String messageToString(final Message msg) { + try { OutputStream os = new ByteArrayOutputStream(); msg.writeTo(os); return os.toString(); - } - catch (Exception e) - { - if (getLogger().isWarnEnabled()) - { + } catch (Exception e) { + if (getLogger().isWarnEnabled()) { getLogger().warn( "Warning, could not convert message (" + msg + ") into string", e ); @@ -507,8 +462,7 @@ /** * Dispose this reader. Release all held resources. */ - public void dispose() - { + public void dispose() { manager.release(m_server); } } Modified: cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/modules/input/AbstractMetaModule.java Url: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/modules/input/AbstractMetaModule.java?view=diff&rev=149132&p1=cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/modules/input/AbstractMetaModule.java&r1=149131&p2=cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/modules/input/AbstractMetaModule.java&r2=149132 ============================================================================== --- cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/modules/input/AbstractMetaModule.java (original) +++ cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/modules/input/AbstractMetaModule.java Sun Jan 30 10:24:33 2005 @@ -1,5 +1,5 @@ /* - * Copyright 1999-2004 The Apache Software Foundation. + * Copyright 1999-2005 The Apache Software Foundation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -345,7 +345,7 @@ if (cs.hasComponent(name)) { release = true; try { - input = (InputModule) cs.select(name); + input = (InputModule) cs.select(name); } catch (ComponentException e) { throw new ConfigurationException( "MetaModule unable to create "+ @@ -353,8 +353,7 @@ " specified internal module '"+name+"'", e); } } else { - if (getLogger().isWarnEnabled()) - getLogger().warn("No such InputModule: "+name); + throw new ConfigurationException("MetaModule: No such InputModule: "+name); } } Modified: cocoon/branches/BRANCH_2_1_X/status.xml Url: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/status.xml?view=diff&rev=149132&p1=cocoon/branches/BRANCH_2_1_X/status.xml&r1=149131&p2=cocoon/branches/BRANCH_2_1_X/status.xml&r2=149132 ============================================================================== --- cocoon/branches/BRANCH_2_1_X/status.xml (original) +++ cocoon/branches/BRANCH_2_1_X/status.xml Sun Jan 30 10:24:33 2005 @@ -1,6 +1,6 @@ <?xml version="1.0"?> <!-- - Copyright 1999-2004 The Apache Software Foundation + Copyright 1999-2005 The Apache Software Foundation Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -59,7 +59,7 @@ <!ENTITY ccedil "ç"> ]> -<!-- CVS $Id$ --> +<!-- SVN $Id$ --> <status> <developers> @@ -202,6 +202,9 @@ <changes> <release version="@version@" date="@date@"> + <action dev="CZ" type="fix" fixes-bug="32987" due-to="Michal Durdina" due-to-email="[EMAIL PROTECTED]"> + Apply patch for a better exception handling in the Meta-InputModule when an input module is not found. + </action> <action dev="JH" type="fix" fixes-bug="33097"> Fixed caching of i18n bundles when using multiple locations. </action>