You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ode.apache.org by "Hudson (JIRA)" <ji...@apache.org> on 2015/06/09 18:31:02 UTC

[jira] [Commented] (ODE-1019) Schema load exception is not handled for captureSchema

    [ https://issues.apache.org/jira/browse/ODE-1019?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14579176#comment-14579176 ] 

Hudson commented on ODE-1019:
-----------------------------

SUCCESS: Integrated in ODE-trunk-jdk6 #847 (See [https://builds.apache.org/job/ODE-trunk-jdk6/847/])
fixes ODE-1019. (vanto: rev 7812077ce9df8a0e440d203de30282d415169cb3)
* utils/src/main/java/org/apache/ode/utils/xsd/XSUtils.java
* utils/src/main/java/org/apache/ode/utils/xsd/XsdMessages.java
* utils/src/main/java/org/apache/ode/utils/xsd/XsdException.java
* utils/src/test/java/org/apache/ode/utils/xsd/SchemaCaptureTest.java


> Schema load exception is not handled for captureSchema
> ------------------------------------------------------
>
>                 Key: ODE-1019
>                 URL: https://issues.apache.org/jira/browse/ODE-1019
>             Project: ODE
>          Issue Type: Bug
>          Components: Deployment
>    Affects Versions: 1.3.6
>            Reporter: Igor Vorobiov
>            Priority: Minor
>             Fix For: 1.3.7, 1.4
>
>         Attachments: LoggingDOMErrorHandler.java, SchemaCaptureTest.java
>
>
> There is the method for wsdl schema parsing(org.apache.ode.utils.xsd.XSUtils.captureSchema(LSInput, XMLEntityResolver)) where schema load exceptions and errors are handled incorrectly. 
> First case when we receive model but there were errors during parsing:
> {code}
> XSModel model = schemaLoader.load(input);
> if (model != null && errors.size() != 0) { // TODO: throw Exception}
> {code}
> The question is do we need to throw Exception in this case.
> Second case when exceptions were thrown during parsing in xerces:
> {code:title=org.apache.xerces.impl.xs.XMLSchemaLoader.load(LSInput)|borderStyle=solid}    
>     public XSModel load(LSInput is) {
>         try {
>             Grammar g = loadGrammar(dom2xmlInputSource(is));
>             return ((XSGrammar) g).toXSModel();
>         } catch (Exception e) {
>             reportDOMFatalError(e); // will be printed as System.err
> 	    //reportDOMFatalError=>fErrorHandler.getErrorHandler().handleError(error);
>             return null;
>         }
>     }
> {code}
> Fix for the second case can be handler creation which implements DOMErrorHandler and collects all exceptions in handleError(DOMError error) method.
> schemaLoader should be configured with this handler:
> {code}
> LoggingDOMErrorHandler deh = new LoggingDOMErrorHandler(__log);
> schemaLoader.setParameter(Constants.DOM_ERROR_HANDLER, deh);
> {code}
> And after load schema call we can check exceptions size like it is done for errors:
> {code}
> ArrayList<Exception> exceptions = deh.getExceptions();
> XSModel model = schemaLoader.load(input);
> if (exceptions.size() != 0) { // TODO: throw Exception}
> {code}
> Attached test to reproduce second case and exception handler class.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)