Lawrence (and others),
I did some testing with the Woden DOM implementation which does schema
validation via Xerces and noticed a potential NPE problem.

Currently, our DOMWSDLReader logic does these validation steps in sequence:
   perform schema validation and report any schema errors (during the
   Xerces XML parsing)
   perform Document validation (i.e. the non-schema rules that apply to the
   WSDL infoset)
   if Document validation passes, perform Component validation (i.e. the
   non-schema rules that apply to the WSDL component model)

A null pointer exception occurs if you read a WSDL document that has no
target namespace attribute. The schema validation does report the missing
TNS, but the Document validation is performed anyway and throws a NPE with
this code in method testAssertionDescription0025:

    URI targetNS = descElement.getTargetNamespace();
    if(!targetNS.isAbsolute()) ...  <-NPE

This is just one example, but there may be similar potential NPEs.

A solution would be to check if any schema validation errors have been
reported and if so, don't perform any non-schema validation (i.e. don't
invoke Document and Component validation).

Alternatively, we need to include the appropriate null checks in the
Document and Component validation code to avoid such NPEs, but then we're
duplicating some of the schema rule checking anyway and we still need to
decide how to handle a null value. For example, the code could just remain
silent on the missing value and assume than XML parser's schema validation
has already reported the error. Or we could detect somehow if schema
validation is being done and if not, report a suitable error.

I think I prefer the first solution - if the WSDL is not schema valid, then
don't do any further non-schema validation. Any thoughts?


John Kaputin


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

Reply via email to