You are viewing a plain text version of this content. The canonical link for it is here.
Posted to woden-dev@ws.apache.org by John Kaputin <KA...@uk.ibm.com> on 2007/01/02 10:25:55 UTC

Re: NPE occurs after schema validation has reported the error

I like this idea of checking rules based on preconditions. Post-M7 we will
be reviewing the validation architecture to make it more easily extensible
for validating user defined extensions and adding the remaining WSDL 2.0
validation - I think that activity should address Arthur's suggestion too.

John Kaputin



                                                                           
             "Arthur Ryman"                                                
             <arthur.ryman@gma                                             
             il.com>                                                    To 
                                       woden-dev@ws.apache.org             
             29/12/2006 15:18                                           cc 
                                                                           
                                                                   Subject 
             Please respond to         Re: NPE occurs after schema         
             woden-dev@ws.apac         validation has reported the error   
                  he.org                                                   
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           




John et al,

This issue comes up in other contexts. The general issue is that some
validation rules have  preconditions. This means it doesn't make sense
to check the rule unless the precondition is satisfied.

To make progress we can assume that the schema validation is a
precondition for the other rules.

I think ultimately the WSDL 2.0 spec should include the preconditions
but that is not guaranteed to happen.

Woden should implement its own precondition architecture. The general
approach would be to describe the set of all rules using a dependency
graph (directed acyclic). Woden should execute the rules ordered by a
"topological" sort, whichs means that all preconditions get evaluated
before a rule. Each rule should set a boolean flag when it is executed
to indicate that it is satisfied. Only execute a rule if all
preconditions are true. Set the flag to false if any precondition is
false.

Thoughts?

-- Arthur

On 12/28/06, Lawrence Mandel <lm...@ca.ibm.com> wrote:
> John,
>
> +1. I thought I had already implemented that check (but I guess not).
> Please open a Jira and let's get this fixed. You're welcome to assign
this
> to me if you like. I'm still hoping to find some time next week to get
> through my Jira pile.
>
> Lawrence
>
>
>
>
> John Kaputin <KA...@uk.ibm.com>
> 12/28/2006 07:12 AM
> Please respond to
> woden-dev@ws.apache.org
>
>
> To
> woden-dev@ws.apache.org
> cc
>
> Subject
> NPE occurs after schema validation has reported the error
>
>
>
>
>
>
>
> 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: woden-dev-unsubscribe@ws.apache.org
> For additional commands, e-mail: woden-dev-help@ws.apache.org
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: woden-dev-unsubscribe@ws.apache.org
> For additional commands, e-mail: woden-dev-help@ws.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: woden-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: woden-dev-help@ws.apache.org




---------------------------------------------------------------------
To unsubscribe, e-mail: woden-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: woden-dev-help@ws.apache.org