Author: jkaputin
Date: Mon Aug  6 04:11:52 2007
New Revision: 563107

URL: http://svn.apache.org/viewvc?view=rev&rev=563107
Log:
WODEN-3
Changed Schema-1066 message to include schema
component local name. Thanks to Dan Harvey for
contributing this fix.

Modified:
    incubator/woden/trunk/java/src/org/apache/woden/internal/Messages.properties
    
incubator/woden/trunk/java/src/org/apache/woden/internal/wsdl20/validation/WSDLDocumentValidator.java
    
incubator/woden/trunk/java/test/org/apache/woden/internal/wsdl20/validation/WSDLDocumentValidatorTest.java

Modified: 
incubator/woden/trunk/java/src/org/apache/woden/internal/Messages.properties
URL: 
http://svn.apache.org/viewvc/incubator/woden/trunk/java/src/org/apache/woden/internal/Messages.properties?view=diff&rev=563107&r1=563106&r2=563107
==============================================================================
--- 
incubator/woden/trunk/java/src/org/apache/woden/internal/Messages.properties 
(original)
+++ 
incubator/woden/trunk/java/src/org/apache/woden/internal/Messages.properties 
Mon Aug  6 04:11:52 2007
@@ -140,8 +140,8 @@
 MessageLabel-1058 = 
 MessageLabel-1058.assertion =  If the messageLabel attribute information item  
of a binding fault reference element information item  is absent then there 
MUST be a unique placeholder message with {direction} equal to the message 
direction.
 
-Schema-1066 = A component in the XML Schema namespace ''{0}'' has been 
referenced but this namespace is not available. In order to reference 
components from a XML Schema namespace the namespace must be imported or 
defined inline.
-Schema-1066.assertion = A WSDL 2.0 document MUST NOT refer to XML Schema 
components in a given namespace unless an xs:import or xs:schema element 
information item for that namespace is present or the namespace is the XML 
Schema namespace which contains built-in types as defined in XML Schema Part 2: 
Datatypes Second Edition [XML Schema: Datatypes].
+Schema-1066 = The schema component ''{0}'' in the namespace ''{1}'' cannot be 
referenced unless this namespace is imported by an xs:import element or is the 
target namespace of an inlined xs:schema element.
+Schema-1066.assertion = A WSDL 2.0 document MUST NOT refer to XML Schema 
components in a given namespace UNLESS an xs:import or xs:schema element 
information item for that namespace is present OR the namespace is the XML 
Schema namespace, http://www.w3.org/2001/XMLSchema, which contains built-in 
types as defined in XML Schema Part 2: Datatypes Second Edition [XML Schema: 
Datatypes].
 
 Schema-1069 = The XML schema imported from ''{0}'' must specify a target 
namespace.
 Schema-1069.assertion = The referenced schema MUST contain a targetNamespace 
attribute information item on its xs:schema element information item.

Modified: 
incubator/woden/trunk/java/src/org/apache/woden/internal/wsdl20/validation/WSDLDocumentValidator.java
URL: 
http://svn.apache.org/viewvc/incubator/woden/trunk/java/src/org/apache/woden/internal/wsdl20/validation/WSDLDocumentValidator.java?view=diff&rev=563107&r1=563106&r2=563107
==============================================================================
--- 
incubator/woden/trunk/java/src/org/apache/woden/internal/wsdl20/validation/WSDLDocumentValidator.java
 (original)
+++ 
incubator/woden/trunk/java/src/org/apache/woden/internal/wsdl20/validation/WSDLDocumentValidator.java
 Mon Aug  6 04:11:52 2007
@@ -179,7 +179,7 @@
        for(int j = 0; j < numFaultElements; j++)
        {
          InterfaceFaultElement faultElement = faultElements[j];
-         if(!testAssertionSchema1066(descElement, 
faultElement.getElementName().getNamespaceURI(), errorReporter))
+         if(!testAssertionSchema1066(descElement, 
faultElement.getElementName(), errorReporter))
            isValid = false;
          }  
        return isValid;
@@ -414,15 +414,19 @@
    * @return True if the assertion passes, false otherwise.
    * @throws WSDLException
    */
-  protected boolean testAssertionSchema1066(DescriptionElement descElement, 
String namespace, ErrorReporter errorReporter) throws WSDLException
+  protected boolean testAssertionSchema1066(DescriptionElement descElement, 
QName qualifiedName, ErrorReporter errorReporter) throws WSDLException
   {
-       // If the namespace is null it can't be checked.
-    if(namespace != null && !namespace.equals(Constants.TYPE_XSD_2001))
+       // If the qualifiedName is null it can't be checked.
+    if(qualifiedName != null && 
!qualifiedName.getNamespaceURI().equals(Constants.TYPE_XSD_2001))
     {
+      //Get the namespace and the local name from the qualified name.
+      String namespace = qualifiedName.getNamespaceURI();
+         String localname = qualifiedName.getLocalPart();      
+
       TypesElement types = descElement.getTypesElement();
       if(types == null)
       {
-       errorReporter.reportError(new ErrorLocatorImpl(), "Schema-1066", new 
Object[]{namespace}, ErrorReporter.SEVERITY_ERROR);
+       errorReporter.reportError(new ErrorLocatorImpl(), "Schema-1066", new 
Object[]{localname, namespace}, ErrorReporter.SEVERITY_ERROR);
         return false;
       }
       Schema[] schemas = types.getSchemas();
@@ -444,7 +448,7 @@
       }
       if(schemaNotFound)
       {
-        errorReporter.reportError(new ErrorLocatorImpl(), "Schema-1066", new 
Object[]{namespace}, ErrorReporter.SEVERITY_ERROR);
+        errorReporter.reportError(new ErrorLocatorImpl(), "Schema-1066", new 
Object[]{localname, namespace}, ErrorReporter.SEVERITY_ERROR);
        return false;
       } 
     }

Modified: 
incubator/woden/trunk/java/test/org/apache/woden/internal/wsdl20/validation/WSDLDocumentValidatorTest.java
URL: 
http://svn.apache.org/viewvc/incubator/woden/trunk/java/test/org/apache/woden/internal/wsdl20/validation/WSDLDocumentValidatorTest.java?view=diff&rev=563107&r1=563106&r2=563107
==============================================================================
--- 
incubator/woden/trunk/java/test/org/apache/woden/internal/wsdl20/validation/WSDLDocumentValidatorTest.java
 (original)
+++ 
incubator/woden/trunk/java/test/org/apache/woden/internal/wsdl20/validation/WSDLDocumentValidatorTest.java
 Mon Aug  6 04:11:52 2007
@@ -1041,7 +1041,7 @@
       TypesElement types = descElem.getTypesElement();
       types.addSchema(schema);
       
-         if(!val.testAssertionSchema1066(descElem, "http://www.sample.org";, 
reporter))
+         if(!val.testAssertionSchema1066(descElem, new 
QName("http://www.sample.org";, "myElement"), reporter))
          {
            fail("The testAssertionSchema1066 method returned false for a 
namespace that has been defined inline.");
          }
@@ -1063,7 +1063,7 @@
       importedSchema.setNamespace(schemaNS);
       typesImported.addSchema(importedSchema);
       
-         if(!val.testAssertionSchema1066(descElem, "http://www.sample.org";, 
reporter))
+         if(!val.testAssertionSchema1066(descElem, new 
QName("http://www.sample.org";, "myElement"), reporter))
          {
            fail("The testAssertionSchema1066 method returned false for a 
namespace that has been imported.");
          }
@@ -1080,7 +1080,7 @@
       DescriptionElement descElem = new DescriptionImpl();
       //descElem.setTypesElement(types);
       
-         if(!val.testAssertionSchema1066(descElem, Constants.TYPE_XSD_2001, 
reporter))
+         if(!val.testAssertionSchema1066(descElem, new 
QName(Constants.TYPE_XSD_2001, "myElement"), reporter))
          {
            fail("The testAssertionSchema1066 method returned false for the XML 
Schema namespace.");
          }
@@ -1098,7 +1098,7 @@
       DescriptionElement descElem = new DescriptionImpl();
       //descElem.setTypesElement(types);
       
-         if(val.testAssertionSchema1066(descElem, "http://www.sample2.org";, 
reporter))
+         if(val.testAssertionSchema1066(descElem, new 
QName("http://www.sample2.org";, "myElement"), reporter))
          {
            fail("The testAssertionSchema1066 method returned true for a 
namespace that is not available..");
          }
@@ -1122,7 +1122,7 @@
       inlinedSchema2.setNamespace(schemaNS);
       typesImported.addSchema(inlinedSchema2);
       
-         if(!val.testAssertionSchema1066(descElem, "http://www.sample.org";, 
reporter))
+         if(!val.testAssertionSchema1066(descElem, new 
QName("http://www.sample.org";, "myElement"), reporter))
          {
            fail("The testAssertionSchema1066 method returned false for a 
namespace that has been imported.");
          }



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to