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 ru...@apache.org on 2006/05/04 11:33:25 UTC
svn commit: r399632 -
/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/AxisService2OM.java
Author: ruchithf
Date: Thu May 4 02:33:24 2006
New Revision: 399632
URL: http://svn.apache.org/viewcvs?rev=399632&view=rev
Log:
Fix to handle wsdls with invalid policy refs
Modified:
webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/AxisService2OM.java
Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/AxisService2OM.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/AxisService2OM.java?rev=399632&r1=399631&r2=399632&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/AxisService2OM.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/AxisService2OM.java Thu May 4 02:33:24 2006
@@ -771,7 +771,7 @@
}
private void addPolicy(int type, PolicyInclude policyInclude,
- OMElement element, OMFactory factory) throws XMLStreamException {
+ OMElement element, OMFactory factory) throws Exception {
ArrayList elementList = policyInclude.getPolicyElements(type);
StAXPolicyWriter pwrt = (StAXPolicyWriter) PolicyFactory
.getPolicyWriter(PolicyFactory.StAX_POLICY_WRITER);
@@ -793,12 +793,17 @@
} else if (policyElement instanceof PolicyReference) {
OMNamespace ns = factory.createOMNamespace(PolicyConstants.WS_POLICY_NAMESPACE_URI, PolicyConstants.WS_POLICY_PREFIX);
OMElement refElement = factory.createOMElement(PolicyConstants.WS_POLICY_REFERENCE, ns);
- OMAttribute attribute = factory.createOMAttribute("URI", ns, ((PolicyReference) policyElement).getPolicyURIString());
+ String policyURIString = ((PolicyReference) policyElement).getPolicyURIString();
+ OMAttribute attribute = factory.createOMAttribute("URI", ns, policyURIString);
refElement.addAttribute(attribute);
element.addChild(refElement);
PolicyRegistry reg = policyInclude.getPolicyRegistry();
- Policy p = reg.lookup(((PolicyReference) policyElement).getPolicyURIString());
+ Policy p = reg.lookup(policyURIString);
+
+ if(p == null) {
+ throw new Exception("POlicy not found for uri : " + policyURIString);
+ }
ByteArrayOutputStream baos = new ByteArrayOutputStream();
pwrt.writePolicy(p, baos);