Author: djencks Date: Fri Feb 4 20:15:00 2005 New Revision: 151477 URL: http://svn.apache.org/viewcvs?view=rev&rev=151477 Log: Related to GERONIMO-383. If there is something with the right name for our deployment descriptor, throw an exception if we can't parse it
Modified: geronimo/trunk/modules/client-builder/src/java/org/apache/geronimo/client/builder/AppClientModuleBuilder.java geronimo/trunk/modules/connector-builder/src/java/org/apache/geronimo/connector/deployment/ConnectorModuleBuilder.java geronimo/trunk/modules/j2ee-builder/src/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilder.java geronimo/trunk/modules/jetty-builder/src/java/org/apache/geronimo/jetty/deployment/JettyModuleBuilder.java Modified: geronimo/trunk/modules/client-builder/src/java/org/apache/geronimo/client/builder/AppClientModuleBuilder.java URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/client-builder/src/java/org/apache/geronimo/client/builder/AppClientModuleBuilder.java?view=diff&r1=151476&r2=151477 ============================================================================== --- geronimo/trunk/modules/client-builder/src/java/org/apache/geronimo/client/builder/AppClientModuleBuilder.java (original) +++ geronimo/trunk/modules/client-builder/src/java/org/apache/geronimo/client/builder/AppClientModuleBuilder.java Fri Feb 4 20:15:00 2005 @@ -140,15 +140,18 @@ // read in the entire specDD as a string, we need this for getDeploymentDescriptor // on the J2ee management object specDD = DeploymentUtil.readAll(specDDUrl); - + } catch (Exception e) { + //no application-client.xml, not for us. + return null; + } + //we found application-client.xml, if it won't parse it's an error. + try { // parse it XmlObject xmlObject = SchemaConversionUtils.parse(specDD); ApplicationClientDocument appClientDoc = SchemaConversionUtils.convertToApplicationClientSchema(xmlObject); appClient = appClientDoc.getApplicationClient(); } catch (XmlException e) { throw new DeploymentException("Unable to parse application-client.xml", e); - } catch (Exception e) { - return null; } // parse vendor dd Modified: geronimo/trunk/modules/connector-builder/src/java/org/apache/geronimo/connector/deployment/ConnectorModuleBuilder.java URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/connector-builder/src/java/org/apache/geronimo/connector/deployment/ConnectorModuleBuilder.java?view=diff&r1=151476&r2=151477 ============================================================================== --- geronimo/trunk/modules/connector-builder/src/java/org/apache/geronimo/connector/deployment/ConnectorModuleBuilder.java (original) +++ geronimo/trunk/modules/connector-builder/src/java/org/apache/geronimo/connector/deployment/ConnectorModuleBuilder.java Fri Feb 4 20:15:00 2005 @@ -161,15 +161,19 @@ // read in the entire specDD as a string, we need this for getDeploymentDescriptor // on the J2ee management object specDD = DeploymentUtil.readAll(specDDUrl); - + } catch (Exception e) { + //no ra.xml, not for us. + return null; + } + //we found ra.xml, if it won't parse it's an error. + try { // parse it XmlObject xmlObject = SchemaConversionUtils.parse(specDD); ConnectorDocument connectorDoc = SchemaConversionUtils.convertToConnectorSchema(xmlObject); connector = connectorDoc.getConnector(); - } catch (Exception e) { - return null; + } catch (XmlException e) { + throw new DeploymentException("Could not parse ra.xml descriptor", e); } - GerConnectorType gerConnector = null; try { // load the geronimo-application-client.xml from either the supplied plan or from the earFile Modified: geronimo/trunk/modules/j2ee-builder/src/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilder.java URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/j2ee-builder/src/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilder.java?view=diff&r1=151476&r2=151477 ============================================================================== --- geronimo/trunk/modules/j2ee-builder/src/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilder.java (original) +++ geronimo/trunk/modules/j2ee-builder/src/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilder.java Fri Feb 4 20:15:00 2005 @@ -143,16 +143,21 @@ } private Object getEarPlan(File planFile, JarFile earFile) throws DeploymentException { + String specDD; ApplicationType application; try { URL applicationXmlUrl = DeploymentUtil.createJarURL(earFile, "META-INF/application.xml"); - XmlObject xmlObject = SchemaConversionUtils.parse(applicationXmlUrl); - application = SchemaConversionUtils.convertToApplicationSchema(xmlObject).getApplication(); + specDD = DeploymentUtil.readAll(applicationXmlUrl); } catch (Exception e) { + //no application.xml, not for us return null; } - if (application == null) { - return null; + //we found something called application.xml in the right place, if we can't parse it it's an error + try { + XmlObject xmlObject = SchemaConversionUtils.parse(specDD); + application = SchemaConversionUtils.convertToApplicationSchema(xmlObject).getApplication(); + } catch (XmlException e) { + throw new DeploymentException("Could not parse application.xml", e); } GerApplicationType gerApplication = null; Modified: geronimo/trunk/modules/jetty-builder/src/java/org/apache/geronimo/jetty/deployment/JettyModuleBuilder.java URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/jetty-builder/src/java/org/apache/geronimo/jetty/deployment/JettyModuleBuilder.java?view=diff&r1=151476&r2=151477 ============================================================================== --- geronimo/trunk/modules/jetty-builder/src/java/org/apache/geronimo/jetty/deployment/JettyModuleBuilder.java (original) +++ geronimo/trunk/modules/jetty-builder/src/java/org/apache/geronimo/jetty/deployment/JettyModuleBuilder.java Fri Feb 4 20:15:00 2005 @@ -173,17 +173,19 @@ // read in the entire specDD as a string, we need this for getDeploymentDescriptor // on the J2ee management object specDD = DeploymentUtil.readAll(specDDUrl); - + } catch (Exception e) { + //no web.xml, not for us + return null; + } + //we found web.xml, if it won't parse that's an error. + try { // parse it XmlObject parsed = SchemaConversionUtils.parse(specDD); WebAppDocument webAppDoc = SchemaConversionUtils.convertToServletSchema(parsed); webApp = webAppDoc.getWebApp(); } catch (XmlException xmle) { throw new DeploymentException("Error parsing web.xml", xmle); - } catch (Exception e) { - return null; } - check(webApp); // parse vendor dd