You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by gd...@apache.org on 2002/09/18 22:04:50 UTC
cvs commit: xml-axis/java/src/org/apache/axis/deployment/wsdd WSDDNonFatalException.java WSDDDeployment.java WSDDService.java
gdaniels 2002/09/18 13:04:50
Modified: java/src/org/apache/axis/deployment/wsdd WSDDDeployment.java
WSDDService.java
Added: java/src/org/apache/axis/deployment/wsdd
WSDDNonFatalException.java
Log:
Don't die when a non-fatal WSDD exception (such as a bad type mapping)
occurs. Instead, just log the error and continue without deploying the
bad typemapping, or any service which uses such a typemapping.
Fixes bug http://nagoya.apache.org/bugzilla/show_bug.cgi?id=12737
Revision Changes Path
1.47 +20 -6 xml-axis/java/src/org/apache/axis/deployment/wsdd/WSDDDeployment.java
Index: WSDDDeployment.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/deployment/wsdd/WSDDDeployment.java,v
retrieving revision 1.46
retrieving revision 1.47
diff -u -r1.46 -r1.47
--- WSDDDeployment.java 18 Sep 2002 19:12:36 -0000 1.46
+++ WSDDDeployment.java 18 Sep 2002 20:04:50 -0000 1.47
@@ -240,14 +240,28 @@
elements = getChildElements(e, ELEM_WSDD_SERVICE);
for (i = 0; i < elements.length; i++) {
- WSDDService service = new WSDDService(elements[i]);
- deployService(service);
+ try {
+ WSDDService service = new WSDDService(elements[i]);
+ deployService(service);
+ } catch (WSDDNonFatalException ex) {
+ // If it's non-fatal, just keep on going
+ } catch (WSDDException ex) {
+ // otherwise throw it upwards
+ throw ex;
+ }
}
elements = getChildElements(e, ELEM_WSDD_TYPEMAPPING);
for (i = 0; i < elements.length; i++) {
- WSDDTypeMapping mapping = new WSDDTypeMapping(elements[i]);
- deployTypeMapping(mapping);
+ try {
+ WSDDTypeMapping mapping = new WSDDTypeMapping(elements[i]);
+ deployTypeMapping(mapping);
+ } catch (WSDDNonFatalException ex) {
+ // If it's non-fatal, just keep on going
+ } catch (WSDDException ex) {
+ // otherwise throw it upwards
+ throw ex;
+ }
}
elements = getChildElements(e, ELEM_WSDD_BEANMAPPING);
@@ -347,8 +361,8 @@
tm.register( mapping.getLanguageSpecificType(), mapping.getQName(), ser, deser);
//log.debug("registered");
} catch (ClassNotFoundException e) {
- log.info(Messages.getMessage("unabletoDeployTypemapping00", mapping.getQName().toString()), e);
- throw new WSDDException(e);
+ log.error(Messages.getMessage("unabletoDeployTypemapping00", mapping.getQName().toString()), e);
+ throw new WSDDNonFatalException(e);
} catch (Exception e) {
throw new WSDDException(e);
}
1.94 +7 -10 xml-axis/java/src/org/apache/axis/deployment/wsdd/WSDDService.java
Index: WSDDService.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/deployment/wsdd/WSDDService.java,v
retrieving revision 1.93
retrieving revision 1.94
diff -u -r1.93 -r1.94
--- WSDDService.java 18 Sep 2002 19:12:36 -0000 1.93
+++ WSDDService.java 18 Sep 2002 20:04:50 -0000 1.94
@@ -75,7 +75,6 @@
import org.apache.axis.enum.Style;
import org.apache.axis.handlers.soap.SOAPService;
import org.apache.axis.providers.java.JavaProvider;
-import org.apache.axis.utils.JavaUtils;
import org.apache.axis.utils.Messages;
import org.apache.axis.utils.XMLUtils;
import org.w3c.dom.Element;
@@ -88,8 +87,6 @@
import java.util.ArrayList;
import java.util.StringTokenizer;
import java.util.Vector;
-import java.util.List;
-import java.util.Iterator;
/**
* A service represented in WSDD.
@@ -240,14 +237,14 @@
/**
* Initialize a TypeMappingRegistry with the
- * WSDDTypeMappings.
+ * WSDDTypeMappings.
* Note: Extensions of WSDDService may override
* initTMR to popluate the tmr with different
* type mappings.
*/
protected void initTMR() throws WSDDException
{
- // If not created, construct a tmr
+ // If not created, construct a tmr
// and populate it with the type mappings.
if (tmr == null) {
tmr = new TypeMappingRegistryImpl();
@@ -538,8 +535,8 @@
}
tm.register( mapping.getLanguageSpecificType(), mapping.getQName(), ser, deser);
} catch (ClassNotFoundException e) {
- log.info(Messages.getMessage("unabletoDeployTypemapping00", mapping.getQName().toString()), e);
- throw new WSDDException(e);
+ log.error(Messages.getMessage("unabletoDeployTypemapping00", mapping.getQName().toString()), e);
+ throw new WSDDNonFatalException(e);
} catch (Exception e) {
throw new WSDDException(e);
}
@@ -564,7 +561,7 @@
attrs.addAttribute("", ATTR_STYLE, ATTR_STYLE,
"CDATA", style.getName());
}
-
+
if (streaming) {
attrs.addAttribute("", ATTR_STREAMING, ATTR_STREAMING,
"CDATA", "on");
@@ -612,7 +609,7 @@
_wsddHIchain.writeToContext(context);
}
-
+
context.endElement();
@@ -660,7 +657,7 @@
// If type mapping registry not initialized yet, return null.
if (tmr == null) {
return null;
- }
+ }
return (TypeMapping) tmr.getTypeMapping(encodingStyle);
}
}
1.1 xml-axis/java/src/org/apache/axis/deployment/wsdd/WSDDNonFatalException.java
Index: WSDDNonFatalException.java
===================================================================
/*
* The Apache Software License, Version 1.1
*
*
* Copyright (c) 2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Axis" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
/**
* A non-fatal WSDD exception (bad type mapping, for instance)
*
* @author Glen Daniels (gdaniels@apache.org)
*/
package org.apache.axis.deployment.wsdd;
public class WSDDNonFatalException extends WSDDException {
public WSDDNonFatalException(String msg) {
super(msg);
}
public WSDDNonFatalException(Exception e) {
super(e);
}
}