Author: sagara
Date: Tue Nov 15 01:20:54 2011
New Revision: 1201993
URL: http://svn.apache.org/viewvc?rev=1201993&view=rev
Log:
Applied the patch for AXIS2-4859.
Modified:
axis/axis2/java/core/trunk/modules/adb-codegen/src/org/apache/axis2/schema/CompilerOptions.java
axis/axis2/java/core/trunk/modules/adb-codegen/src/org/apache/axis2/schema/ExtensionUtility.java
axis/axis2/java/core/trunk/modules/adb-codegen/src/org/apache/axis2/schema/SchemaConstants.java
axis/axis2/java/core/trunk/modules/adb-codegen/src/org/apache/axis2/schema/template/ADBBeanTemplate-bean.xsl
axis/axis2/java/core/trunk/modules/adb-codegen/src/org/apache/axis2/schema/template/ADBBeanTemplate-helpermode.xsl
axis/axis2/java/core/trunk/modules/adb-codegen/src/org/apache/axis2/schema/writer/JavaBeanWriter.java
axis/axis2/java/core/trunk/modules/codegen/src/org/apache/axis2/wsdl/WSDL2Code.java
axis/axis2/java/core/trunk/modules/codegen/src/org/apache/axis2/wsdl/i18n/resource.properties
Modified:
axis/axis2/java/core/trunk/modules/adb-codegen/src/org/apache/axis2/schema/CompilerOptions.java
URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/adb-codegen/src/org/apache/axis2/schema/CompilerOptions.java?rev=1201993&r1=1201992&r2=1201993&view=diff
==============================================================================
---
axis/axis2/java/core/trunk/modules/adb-codegen/src/org/apache/axis2/schema/CompilerOptions.java
(original)
+++
axis/axis2/java/core/trunk/modules/adb-codegen/src/org/apache/axis2/schema/CompilerOptions.java
Tue Nov 15 01:20:54 2011
@@ -204,4 +204,18 @@ public class CompilerOptions {
public void setUseWrapperClasses(boolean useWrapperClasses) {
this.isUseWrapperClasses = useWrapperClasses;
}
+
+ /**
+ * Should unexpected elements be ignored (log warning) instead of
+ * creating an exception?
+ */
+ private boolean isIgnoreUnexpected;
+
+ public boolean isIgnoreUnexpected() {
+ return isIgnoreUnexpected;
+ }
+
+ public void setIgnoreUnexpected(boolean isIgnoreUnexpected) {
+ this.isIgnoreUnexpected = isIgnoreUnexpected;
+ }
}
Modified:
axis/axis2/java/core/trunk/modules/adb-codegen/src/org/apache/axis2/schema/ExtensionUtility.java
URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/adb-codegen/src/org/apache/axis2/schema/ExtensionUtility.java?rev=1201993&r1=1201992&r2=1201993&view=diff
==============================================================================
---
axis/axis2/java/core/trunk/modules/adb-codegen/src/org/apache/axis2/schema/ExtensionUtility.java
(original)
+++
axis/axis2/java/core/trunk/modules/adb-codegen/src/org/apache/axis2/schema/ExtensionUtility.java
Tue Nov 15 01:20:54 2011
@@ -606,6 +606,10 @@ public class ExtensionUtility {
if
(propertyMap.containsKey(SchemaConstants.SchemaCompilerArguments.USE_WRAPPER_CLASSES)){
options.setUseWrapperClasses(true);
}
+
+ if
(propertyMap.containsKey(SchemaConstants.SchemaCompilerArguments.IGNORE_UNEXPECTED)){
+ options.setIgnoreUnexpected(true);
+ }
//set helper mode
//this becomes effective only if the classes are unpacked
Modified:
axis/axis2/java/core/trunk/modules/adb-codegen/src/org/apache/axis2/schema/SchemaConstants.java
URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/adb-codegen/src/org/apache/axis2/schema/SchemaConstants.java?rev=1201993&r1=1201992&r2=1201993&view=diff
==============================================================================
---
axis/axis2/java/core/trunk/modules/adb-codegen/src/org/apache/axis2/schema/SchemaConstants.java
(original)
+++
axis/axis2/java/core/trunk/modules/adb-codegen/src/org/apache/axis2/schema/SchemaConstants.java
Tue Nov 15 01:20:54 2011
@@ -166,6 +166,8 @@ public class SchemaConstants {
public static final String OFF_STRICT_VALIDATION = "osv";
// this option is used to use Wrapper classes for primitives
public static final String USE_WRAPPER_CLASSES = "uwc";
+ // This option logs warnings instead of throwing exceptions for
unexpected elements
+ public static final String IGNORE_UNEXPECTED = "iu";
}
Modified:
axis/axis2/java/core/trunk/modules/adb-codegen/src/org/apache/axis2/schema/template/ADBBeanTemplate-bean.xsl
URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/adb-codegen/src/org/apache/axis2/schema/template/ADBBeanTemplate-bean.xsl?rev=1201993&r1=1201992&r2=1201993&view=diff
==============================================================================
---
axis/axis2/java/core/trunk/modules/adb-codegen/src/org/apache/axis2/schema/template/ADBBeanTemplate-bean.xsl
(original)
+++
axis/axis2/java/core/trunk/modules/adb-codegen/src/org/apache/axis2/schema/template/ADBBeanTemplate-bean.xsl
Tue Nov 15 01:20:54 2011
@@ -39,6 +39,7 @@
<xsl:variable name="particleClass" select="@particleClass"/>
<xsl:variable name="hasParticleType" select="@hasParticleType"/>
<xsl:variable name="usewrapperclasses" select="@usewrapperclasses"/>
+ <xsl:variable name="ignoreunexpected" select="@ignoreunexpected"/>
<!-- write the class header. this should be done only when unwrapped
-->
@@ -1923,6 +1924,7 @@
* Factory class that keeps the parse method
*/
public static class Factory{
+ private static org.apache.commons.logging.Log log =
org.apache.commons.logging.LogFactory.getLog(Factory.class);
<!-- generate some utility factory methods here we must add these
methods to a factory class
since otherwise it gives a compilation exception in jdk 1.4 -->
@@ -2173,6 +2175,7 @@
</xsl:if>
int event;
+ javax.xml.namespace.QName currentQName = null;
java.lang.String nillableValue = null;
java.lang.String prefix ="";
java.lang.String namespaceuri ="";
@@ -2181,6 +2184,7 @@
while (!reader.isStartElement() &&
!reader.isEndElement())
reader.next();
+ currentQName = reader.getName();
<xsl:if test="@nillable">
nillableValue =
reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance","nil");
if ("true".equals(nillableValue) ||
"1".equals(nillableValue)){
@@ -3127,7 +3131,7 @@
inside the sequce class -->
<xsl:if test="$ordered and $min!=0 and
not($particleClassType)">
else{
- // A start element we are not expecting
indicates an invalid parameter was passed
+ // 1 - A start element we are not
expecting indicates an invalid parameter was passed
throw new
org.apache.axis2.databinding.ADBException("Unexpected subelement " +
reader.getName());
}
</xsl:if>
@@ -3143,17 +3147,40 @@
reader.next();
<xsl:if test="not($particleClass)">
if (reader.isStartElement())
- // A start element we are not expecting
indicates a trailing invalid property
- throw new
org.apache.axis2.databinding.ADBException("Unexpected subelement " +
reader.getName());
+ // 2 - A start element we are not expecting
indicates a trailing invalid property
+ <xsl:if test="$ignoreunexpected">
+ {
+ log.warn("Unexpected subelement " +
reader.getLocalName());
+ // consume everything, ending on the
current element's endtag
+ while (!(reader.isEndElement() &&
reader.getName().equals(currentQName))) {
+ reader.next();
+ }
+ }
+ </xsl:if>
+ <xsl:if test="not($ignoreunexpected)">
+ throw new
org.apache.axis2.databinding.ADBException("Unexpected subelement " +
reader.getName());
+ </xsl:if>
</xsl:if>
</xsl:if>
<xsl:if test="property[not(@attribute)]"> <!-- this
if is needed to skip all this when there are no propoerties-->
<xsl:if test="$unordered and not($particleClass)">
- <xsl:if test="not(property/enumFacet) and
not($choice or $hasParticleType)">
+ <xsl:if test="not(property/enumFacet) and
not($hasParticleType)">
else{
- // A start element we are not
expecting indicates an invalid parameter was passed
- throw new
org.apache.axis2.databinding.ADBException("Unexpected subelement " +
reader.getName());
+ // 3 - A start element we are not
expecting indicates an invalid parameter was passed
+ <xsl:if test="$ignoreunexpected">
+ log.warn("Unexpected subelement "
+ reader.getLocalName());
+ // consume everything, ending on
the unexpected subelement's endtag
+ javax.xml.namespace.QName subQName
= reader.getName();
+ while (!(reader.isEndElement()
&& reader.getName().equals(subQName))) {
+ reader.next();
+ }
+ // skip past this extra element
completely
+ reader.next();
+ </xsl:if>
+ <xsl:if test="not($ignoreunexpected)">
+ throw new
org.apache.axis2.databinding.ADBException("Unexpected subelement " +
reader.getName());
+ </xsl:if>
}
</xsl:if>
} else {
Modified:
axis/axis2/java/core/trunk/modules/adb-codegen/src/org/apache/axis2/schema/template/ADBBeanTemplate-helpermode.xsl
URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/adb-codegen/src/org/apache/axis2/schema/template/ADBBeanTemplate-helpermode.xsl?rev=1201993&r1=1201992&r2=1201993&view=diff
==============================================================================
---
axis/axis2/java/core/trunk/modules/adb-codegen/src/org/apache/axis2/schema/template/ADBBeanTemplate-helpermode.xsl
(original)
+++
axis/axis2/java/core/trunk/modules/adb-codegen/src/org/apache/axis2/schema/template/ADBBeanTemplate-helpermode.xsl
Tue Nov 15 01:20:54 2011
@@ -35,6 +35,7 @@
<xsl:variable name="restriction" select="@restriction"/>
<xsl:variable name="mapperClass" select="@mapperClass"/>
<xsl:variable name="usewrapperclasses" select="@usewrapperclasses"/>
+ <xsl:variable name="ignoreunexpected" select="@ignoreunexpected"/>
<xsl:variable name="package" select="@package"/>
<xsl:variable name="helpername"><xsl:value-of
select="$name"/>Helper</xsl:variable>
@@ -1400,12 +1401,14 @@ public <xsl:if test="not(@unwrapped) or
<xsl:if test="not(property/enumFacet)"><xsl:value-of
select="$fullyQualifiedName"/> object = new <xsl:value-of
select="$fullyQualifiedName"/>();</xsl:if>
<xsl:if test="property/enumFacet"><xsl:value-of select="$name"/>
object = null;</xsl:if>
int event;
+ javax.xml.namespace.QName currentQName;
java.lang.String nillableValue = null;
try {
<!-- Advance to our start element, or if we are a complex
type, to our first property start element or the outer end element if no
properties -->
while (!reader.isStartElement() &&
!reader.isEndElement())
reader.next();
+ currentQName = reader.getName();
<xsl:if test="@nillable">
nillableValue =
reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance","nil");
if ("true".equals(nillableValue) ||
"1".equals(nillableValue)){
@@ -2039,7 +2042,7 @@ public <xsl:if test="not(@unwrapped) or
</xsl:if>
<xsl:if test="$ordered and $min!=0">
else{
- // A start element we are not expecting
indicates an invalid parameter was passed
+ // 1 - A start element we are not
expecting indicates an invalid parameter was passed
throw new
org.apache.axis2.databinding.ADBException("Unexpected subelement " +
reader.getLocalName());
}
</xsl:if>
@@ -2049,16 +2052,39 @@ public <xsl:if test="not(@unwrapped) or
while (!reader.isStartElement() &&
!reader.isEndElement())
reader.next();
if (reader.isStartElement())
- // A start element we are not expecting
indicates a trailing invalid property
- throw new
org.apache.axis2.databinding.ADBException("Unexpected subelement " +
reader.getLocalName());
+ // 2 - A start element we are not expecting
indicates a trailing invalid property
+ <xsl:if test="$ignoreunexpected">
+ {
+ log.warn("Unexpected subelement " +
reader.getLocalName());
+ // consume everything, ending on the
current element's endtag
+ while (!(reader.isEndElement() &&
reader.getName().equals(currentQName))) {
+ reader.next();
+ }
+ }
+ </xsl:if>
+ <xsl:if test="not($ignoreunexpected)">
+ throw new
org.apache.axis2.databinding.ADBException("Unexpected subelement " +
reader.getLocalName());
+ </xsl:if>
</xsl:if>
<xsl:if test="property[not(@attribute)]"> <!-- this
if is needed to skip all this when there are no propoerties-->
<xsl:if test="$unordered">
<xsl:if test="not(property/enumFacet)">
else{
- // A start element we are not
expecting indicates an invalid parameter was passed
- throw new
org.apache.axis2.databinding.ADBException("Unexpected subelement " +
reader.getLocalName());
+ // 3 - A start element we are not
expecting indicates an invalid parameter was passed
+ <xsl:if test="$ignoreunexpected">
+ log.warn("Unexpected subelement "
+ reader.getLocalName());
+ // consume everything, ending on
the unexpected subelement's endtag
+ javax.xml.namespace.QName subQName
= reader.getName();
+ while (!(reader.isEndElement()
&& reader.getName().equals(subQName))) {
+ reader.next();
+ }
+ // skip past this extra element
completely
+ reader.next();
+ </xsl:if>
+ <xsl:if test="not($ignoreunexpected)">
+ throw new
org.apache.axis2.databinding.ADBException("Unexpected subelement " +
reader.getLocalName());
+ </xsl:if>
}
</xsl:if>
} else reader.next(); <!-- At neither a start
nor an end element, skip it -->
Modified:
axis/axis2/java/core/trunk/modules/adb-codegen/src/org/apache/axis2/schema/writer/JavaBeanWriter.java
URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/adb-codegen/src/org/apache/axis2/schema/writer/JavaBeanWriter.java?rev=1201993&r1=1201992&r2=1201993&view=diff
==============================================================================
---
axis/axis2/java/core/trunk/modules/adb-codegen/src/org/apache/axis2/schema/writer/JavaBeanWriter.java
(original)
+++
axis/axis2/java/core/trunk/modules/adb-codegen/src/org/apache/axis2/schema/writer/JavaBeanWriter.java
Tue Nov 15 01:20:54 2011
@@ -107,6 +107,8 @@ public class JavaBeanWriter implements B
private boolean isSuppressPrefixesMode = false;
+ private boolean isIgnoreUnexpected = false;
+
/**
* package for the mapping class
*/
@@ -170,6 +172,7 @@ public class JavaBeanWriter implements B
packageName = options.getPackageName();
writeClasses = options.isWriteOutput();
isUseWrapperClasses = options.isUseWrapperClasses();
+ isIgnoreUnexpected = options.isIgnoreUnexpected();
if (!writeClasses) {
wrapClasses = false;
@@ -552,6 +555,10 @@ public class JavaBeanWriter implements B
XSLTUtils.addAttribute(model, "usewrapperclasses", "yes", rootElt);
}
+ if (isIgnoreUnexpected) {
+ XSLTUtils.addAttribute(model, "ignoreunexpected", "yes", rootElt);
+ }
+
if (metainf.isExtension()) {
XSLTUtils.addAttribute(model, "extension", metainf
.getExtensionClassName(), rootElt);
Modified:
axis/axis2/java/core/trunk/modules/codegen/src/org/apache/axis2/wsdl/WSDL2Code.java
URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/codegen/src/org/apache/axis2/wsdl/WSDL2Code.java?rev=1201993&r1=1201992&r2=1201993&view=diff
==============================================================================
---
axis/axis2/java/core/trunk/modules/codegen/src/org/apache/axis2/wsdl/WSDL2Code.java
(original)
+++
axis/axis2/java/core/trunk/modules/codegen/src/org/apache/axis2/wsdl/WSDL2Code.java
Tue Nov 15 01:20:54 2011
@@ -51,7 +51,7 @@ public class WSDL2Code {
System.out.println(CodegenMessages.getMessage("wsdl2code.arg"));
System.out.println(CodegenMessages.getMessage("wsdl2code.arg1"));
- for (int i = 2; i <= 49; i++) {
+ for (int i = 2; i <= 50; i++) {
System.out.println(" " +
CodegenMessages.getMessage("wsdl2code.arg" + i));
}
}
Modified:
axis/axis2/java/core/trunk/modules/codegen/src/org/apache/axis2/wsdl/i18n/resource.properties
URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/codegen/src/org/apache/axis2/wsdl/i18n/resource.properties?rev=1201993&r1=1201992&r2=1201993&view=diff
==============================================================================
---
axis/axis2/java/core/trunk/modules/codegen/src/org/apache/axis2/wsdl/i18n/resource.properties
(original)
+++
axis/axis2/java/core/trunk/modules/codegen/src/org/apache/axis2/wsdl/i18n/resource.properties
Tue Nov 15 01:20:54 2011
@@ -73,17 +73,18 @@ wsdl2code.arg35=
wsdl2code.arg36= \t\t\t they have to generate
the xmlbeans code seperately with the scomp command comes with the
wsdl2code.arg37= \t\t\t xmlbeans distribution
and replace the Axis2 generated classes with correct classes
wsdl2code.arg38= \t\t\t -EbindingFileName <path>
(for jaxbri) - specify the file path for the episode file
-wsdl2code.arg39= --noBuildXML Don't generate the build.xml in the
output directory
-wsdl2code.arg40= --noWSDL Don't generate WSDL's in the
resources directory
-wsdl2code.arg41= --noMessageReceiver Don't generate a MessageReceiver in
the generated sources
-wsdl2code.arg42= --http-proxy-host <host> Proxy host address if you are
behind a firewall
-wsdl2code.arg43= --http-proxy-port <port> Proxy port address if you are
behind a firewall
-wsdl2code.arg44= -ep <package-name-list> Exclude packages - these packages
are deleted after code generation
-wsdl2code.arg45= -sin <interface-name> Skeleton interface name - used to
specify a name for skeleton interface other than the default one
-wsdl2code.arg46= -scn <class-name> Skeleton class name - used to
specify a name for skeleton class other than the default one
-wsdl2code.arg47= -oaa <override-absolute-address> -change the absolute http
addresses to local file addresses generated by wsdl2java tool
-wsdl2code.arg48= -ebc <exception-base-class> -generated Exceptions are
inherited from this exception rather than the java.lang.Exception class
-wsdl2code.arg49= -uon <use-operation-name> -by default the first letter of
the generated method name changeed to lowercase. This option stops that and
make it same as operation name
+wsdl2code.arg39= \t\t\t -Eiu (for ADB) - Ignore
Unexpected elements instead of throwing ADBException
+wsdl2code.arg40= --noBuildXML Don't generate the build.xml in the
output directory
+wsdl2code.arg41= --noWSDL Don't generate WSDL's in the
resources directory
+wsdl2code.arg42= --noMessageReceiver Don't generate a MessageReceiver in
the generated sources
+wsdl2code.arg43= --http-proxy-host <host> Proxy host address if you are
behind a firewall
+wsdl2code.arg44= --http-proxy-port <port> Proxy port address if you are
behind a firewall
+wsdl2code.arg45= -ep <package-name-list> Exclude packages - these packages
are deleted after code generation
+wsdl2code.arg46= -sin <interface-name> Skeleton interface name - used to
specify a name for skeleton interface other than the default one
+wsdl2code.arg47= -scn <class-name> Skeleton class name - used to
specify a name for skeleton class other than the default one
+wsdl2code.arg48= -oaa <override-absolute-address> -change the absolute http
addresses to local file addresses generated by wsdl2java tool
+wsdl2code.arg49= -ebc <exception-base-class> -generated Exceptions are
inherited from this exception rather than the java.lang.Exception class
+wsdl2code.arg50= -uon <use-operation-name> -by default the first letter of
the generated method name changeed to lowercase. This option stops that and
make it same as operation name
################## prop file loader #################################
propfileload.frameworkMismatch=Number of frameworks and extension names do not
match!