You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@servicemix.apache.org by "Michal (JIRA)" <ji...@apache.org> on 2006/09/18 16:52:23 UTC

[jira] Commented: (SM-525) Enhancement to ValidateComponent to implement a complete and flexible error handling scheme for schema validation

    [ https://issues.apache.org/activemq/browse/SM-525?page=comments#action_36966 ] 
            
Michal commented on SM-525:
---------------------------

I have concern about thread-safety for this extension.
I have tried this new component and there is one problem - AggregatingErrorHandler accumulates errors. 'Clean' method should resolve the problem however, this handler is not thread safe.

My proposal is to inject ErrorHandlerFactory (creates messageawareerrorhandler) to validatecomponent. Factory method would be invoked on each validation request - factory would need to create error handler for one time usage only.

 What do you think?

> Enhancement to ValidateComponent to implement a complete and flexible error handling scheme for schema validation
> -----------------------------------------------------------------------------------------------------------------
>
>                 Key: SM-525
>                 URL: https://issues.apache.org/activemq/browse/SM-525
>             Project: ServiceMix
>          Issue Type: Improvement
>          Components: servicemix-components
>         Environment: Ubuntu Linux 5.10, Windows XP SP2, ServiceMix HEAD
>            Reporter: Grant McDonald
>         Assigned To: Grant McDonald
>             Fix For: 3.0
>
>         Attachments: servicemix-components.zip
>
>   Original Estimate: 30 minutes
>  Remaining Estimate: 30 minutes
>
> The purpose of this enchancement was to provide the following:
> 1) Allow error messages to be captured by the ValidateComponent and sent back as the content of a fault message;
> 2) Preserve existing functionality; and
> 3) Provide a framework for extending the functionality
> It was noted that the existing functionality only dealt with simple case valid or not valid schemas.  It was decided to make the standard component more extensible and functional and as such this code is being contributed back to the ServiceMix project.  To this end the following changes have been made and are available in the attached zip file:
> 1) Added MessageAwareErrorHandler interface - this interface extends the org.xml.sax.ErrorHandler interface and adds contracts for determining if the error handler has errors, whether it captures messages from the validator, and what message formats it supports.
> 2) Refactored CountingErrorHandler to extend from MessageAwareErrorHandler and implement the above mentioned methods
> 3) Created MessageAggregatingErrorHandler - this class aggregates all warning, error and fatal error messages into an XML format (via CDATA).  It provides the ability to set the root document path and namespace via configuration and supports DOMSource, StringSource and String formats for the encapsulated data.
> 4) modified ValidateComponent - added errorHandler property to facilitate dependency injection, with a default value of CountingErrorHandler to preserve existing functionality.  Refactored the handling of validation errors to use the new interfaces.  errorHandlers which do not support the capturing of messages will use the previous method of sending the DOMResult back as the fault message content.  errorHandlers which do support the capture of messages will send the error message xml back as the fault message content.  The src document is now set as a property on the fault message.
> Additionally, a null pointer check was added to the init on the schemaResource.getURL() method call.
> A testcase has been added to ValidationTest and the example.xml in the validation test/resources package demonstrates the configuration of this functionality.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://issues.apache.org/activemq/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira