diff options
author | slaws <slaws@13f79535-47bb-0310-9956-ffa450edef68> | 2010-06-21 08:53:11 +0000 |
---|---|---|
committer | slaws <slaws@13f79535-47bb-0310-9956-ffa450edef68> | 2010-06-21 08:53:11 +0000 |
commit | 96ddaf81ea67494e4843235c55a27a851213ed9c (patch) | |
tree | 0738eac40399a9ef5b3972341e673510ea82ae13 /sca-java-2.x/trunk/modules/binding-ws/src | |
parent | 99ecf81bd397c49675127d66ac08d6b34c8648e3 (diff) |
BWS_2001 - add a check that the reference binding.ws has an absolute URI
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@956500 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-2.x/trunk/modules/binding-ws/src')
2 files changed, 17 insertions, 0 deletions
diff --git a/sca-java-2.x/trunk/modules/binding-ws/src/main/java/org/apache/tuscany/sca/binding/ws/xml/WebServiceBindingProcessor.java b/sca-java-2.x/trunk/modules/binding-ws/src/main/java/org/apache/tuscany/sca/binding/ws/xml/WebServiceBindingProcessor.java index e288d162d8..9c2bbd6043 100644 --- a/sca-java-2.x/trunk/modules/binding-ws/src/main/java/org/apache/tuscany/sca/binding/ws/xml/WebServiceBindingProcessor.java +++ b/sca-java-2.x/trunk/modules/binding-ws/src/main/java/org/apache/tuscany/sca/binding/ws/xml/WebServiceBindingProcessor.java @@ -22,6 +22,8 @@ package org.apache.tuscany.sca.binding.ws.xml; import static javax.xml.stream.XMLStreamConstants.END_ELEMENT; import static javax.xml.stream.XMLStreamConstants.START_ELEMENT; +import java.net.URI; +import java.net.URISyntaxException; import java.util.Map; import javax.wsdl.Binding; @@ -33,6 +35,7 @@ import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamReader; import javax.xml.stream.XMLStreamWriter; +import org.apache.tuscany.sca.assembly.Reference; import org.apache.tuscany.sca.assembly.xml.PolicySubjectProcessor; import org.apache.tuscany.sca.binding.ws.WebServiceBinding; import org.apache.tuscany.sca.binding.ws.WebServiceBindingFactory; @@ -131,6 +134,18 @@ public class WebServiceBindingProcessor extends BaseStAXArtifactProcessor implem String uri = getURIString(reader, URI); if (uri != null) { wsBinding.setURI(uri); + + if (context.getParentModel() instanceof Reference){ + try { + URI tmpURI = new URI(uri); + + if (!tmpURI.isAbsolute()){ + error(monitor, "URINotAbsolute", reader, uri); + } + } catch (URISyntaxException ex){ + error(monitor, "InvalidURISyntax", reader, ex.getMessage()); + } + } } // Read a qname in the form: diff --git a/sca-java-2.x/trunk/modules/binding-ws/src/main/resources/binding-wsxml-validation-messages.properties b/sca-java-2.x/trunk/modules/binding-ws/src/main/resources/binding-wsxml-validation-messages.properties index 7a6cee4dc5..d8ecef91ef 100644 --- a/sca-java-2.x/trunk/modules/binding-ws/src/main/resources/binding-wsxml-validation-messages.properties +++ b/sca-java-2.x/trunk/modules/binding-ws/src/main/resources/binding-wsxml-validation-messages.properties @@ -25,6 +25,8 @@ WsdlBindingDoesNotMatch = The #wsdl.binding({0}) does not match with the WSDL De WsdlServiceDoesNotMatch = The #wsdl.service({0}) does not match with the WSDL Definitions WsdlPortTypeDoesNotMatch = The #wsdl.port({0}) does not match with the WSDL Definitions WsdliLocationMissingWsdlElement = binding.ws has a @wsdli:wsdlLocation attribute but no @wsdlElement attribute +URINotAbsolute = [BWS20001] The URI value for binding.ws on an SCA reference must be absolute. Non-absolute value found {0} +InvalidURISyntax = The URI value {0} found on binding.ws has invalid syntax |