You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-dev@xerces.apache.org by "Gerardo Corro (JIRA)" <xe...@xml.apache.org> on 2007/07/03 17:11:04 UTC

[jira] Created: (XERCESJ-1258) Performance issue

Performance issue
-----------------

                 Key: XERCESJ-1258
                 URL: https://issues.apache.org/jira/browse/XERCESJ-1258
             Project: Xerces2-J
          Issue Type: Bug
          Components: SAX
    Affects Versions: 2.6.2
         Environment: AIX
            Reporter: Gerardo Corro
            Priority: Blocker
             Fix For: 2.6.2


The following snippet cuases tremendous CPU consumption, one xml file of 1Mb size and schema size of 33kb can take up to one hour to be validated.

This problem does not occur in windows, but happens in AIX.

 private boolean validateXmlVsSchema(String SchemaUrl, String xmlString) throws ValidationException, SAXParseException, UnhandleableException {

File schema = new File(SchemaUrl);
log.debug("The schema is being searched at: " + SchemaUrl);
if ( !schema.exists() ) {
throw new UnhandleableException(ValidatorConstants.SCHEMA_NO T_FOUND_EXCEPTION,
new Exception(ValidatorConstants.SCHEMA_NOT_FOUND_EXCE PTION));
}

SAXParser parser = new SAXParser();
try{
parser.setFeature("http://xml.org/sax/features/validation", true);
parser.setFeature("http://apache.org/xml/features/validation/schema", true);
parser.setFeature("http://apache.org/xml/features/validation/schema-full-checking", true);
parser.setProperty("http://apache.org/xml/properties/schema/external-noNamespaceSchemaLocation", SchemaUrl );
Validator handler = new Validator();
parser.setErrorHandler(handler);
InputStream is = new ByteArrayInputStream( xmlString.getBytes("UTF-8"));
parser.parse(new InputSource(is));
if(handler.validationError==true){
log.error(clazzName + "-> " + ValidatorConstants.SCHEMA_VALIDATION_ERROR + ": " + handler.validationError +
"" + handler.saxParseException.getMessage(), handler.saxParseException);
throw handler.saxParseException;
} else {
log.debug(clazzName + "-> " + ValidatorConstants.DOCUMENT_VALIDATED );
return true;
}
} catch( java.io.UTFDataFormatException utfex){
log.info(clazzName + "-> Wrong utf: " + utfex.getMessage(), utfex );
} catch(java.io.IOException ioe){
log.error(clazzName + "-> IOException " + ioe.getMessage(), ioe);
throw new ValidationException(ValidatorConstants.SCHEMA_VALI DATION_EXCEPTION, ioe);
} catch (SAXParseException e) {
log.error(clazzName + "-> SAXParseException " + e.getMessage(), e);
throw e;
} catch (SAXNotRecognizedException e) {
log.error(clazzName + "-> SAXNotRecognizedException " + e.getMessage(), e);
throw new ValidationException(ValidatorConstants.SCHEMA_VALI DATION_EXCEPTION, e);
} catch (SAXNotSupportedException e) {
log.error(clazzName + "-> SAXNotSupportedException " + e.getMessage(), e);
throw new ValidationException(ValidatorConstants.SCHEMA_VALI DATION_EXCEPTION, e);
} catch (SAXException e) {
log.error(clazzName + "-> SAXException " + e.getMessage(), e);
throw new ValidationException(ValidatorConstants.SCHEMA_VALI DATION_EXCEPTION, e);
}
return true;
}


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Commented: (XERCESJ-1258) Performance issue

Posted by "Michael Glavassevich (JIRA)" <xe...@xml.apache.org>.
    [ https://issues.apache.org/jira/browse/XERCESJ-1258?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12509906 ] 

Michael Glavassevich commented on XERCESJ-1258:
-----------------------------------------------

Xerces 2.6.2 is a very old release.  We've made many performance improvements and bug fixes since then.  Please check whether this is still an issue with the latest Gump build [1].  If the problem still exists you should attach a complete test case (including the XML document and schema) to this JIRA issue so that we can reproduce it.

[1] http://vmgump.apache.org/gump/public-jars/xml-xerces2/jars/

> Performance issue
> -----------------
>
>                 Key: XERCESJ-1258
>                 URL: https://issues.apache.org/jira/browse/XERCESJ-1258
>             Project: Xerces2-J
>          Issue Type: Bug
>          Components: XML Schema Structures
>    Affects Versions: 2.6.2
>         Environment: AIX
>            Reporter: Gerardo Corro
>            Priority: Blocker
>
> The following snippet cuases tremendous CPU consumption, one xml file of 1Mb size and schema size of 33kb can take up to one hour to be validated.
> This problem does not occur in windows, but happens in AIX.
>  private boolean validateXmlVsSchema(String SchemaUrl, String xmlString) throws ValidationException, SAXParseException, UnhandleableException {
> File schema = new File(SchemaUrl);
> log.debug("The schema is being searched at: " + SchemaUrl);
> if ( !schema.exists() ) {
> throw new UnhandleableException(ValidatorConstants.SCHEMA_NO T_FOUND_EXCEPTION,
> new Exception(ValidatorConstants.SCHEMA_NOT_FOUND_EXCE PTION));
> }
> SAXParser parser = new SAXParser();
> try{
> parser.setFeature("http://xml.org/sax/features/validation", true);
> parser.setFeature("http://apache.org/xml/features/validation/schema", true);
> parser.setFeature("http://apache.org/xml/features/validation/schema-full-checking", true);
> parser.setProperty("http://apache.org/xml/properties/schema/external-noNamespaceSchemaLocation", SchemaUrl );
> Validator handler = new Validator();
> parser.setErrorHandler(handler);
> InputStream is = new ByteArrayInputStream( xmlString.getBytes("UTF-8"));
> parser.parse(new InputSource(is));
> if(handler.validationError==true){
> log.error(clazzName + "-> " + ValidatorConstants.SCHEMA_VALIDATION_ERROR + ": " + handler.validationError +
> "" + handler.saxParseException.getMessage(), handler.saxParseException);
> throw handler.saxParseException;
> } else {
> log.debug(clazzName + "-> " + ValidatorConstants.DOCUMENT_VALIDATED );
> return true;
> }
> } catch( java.io.UTFDataFormatException utfex){
> log.info(clazzName + "-> Wrong utf: " + utfex.getMessage(), utfex );
> } catch(java.io.IOException ioe){
> log.error(clazzName + "-> IOException " + ioe.getMessage(), ioe);
> throw new ValidationException(ValidatorConstants.SCHEMA_VALI DATION_EXCEPTION, ioe);
> } catch (SAXParseException e) {
> log.error(clazzName + "-> SAXParseException " + e.getMessage(), e);
> throw e;
> } catch (SAXNotRecognizedException e) {
> log.error(clazzName + "-> SAXNotRecognizedException " + e.getMessage(), e);
> throw new ValidationException(ValidatorConstants.SCHEMA_VALI DATION_EXCEPTION, e);
> } catch (SAXNotSupportedException e) {
> log.error(clazzName + "-> SAXNotSupportedException " + e.getMessage(), e);
> throw new ValidationException(ValidatorConstants.SCHEMA_VALI DATION_EXCEPTION, e);
> } catch (SAXException e) {
> log.error(clazzName + "-> SAXException " + e.getMessage(), e);
> throw new ValidationException(ValidatorConstants.SCHEMA_VALI DATION_EXCEPTION, e);
> }
> return true;
> }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Updated: (XERCESJ-1258) Performance issue

Posted by "Gerardo Corro (JIRA)" <xe...@xml.apache.org>.
     [ https://issues.apache.org/jira/browse/XERCESJ-1258?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Gerardo Corro updated XERCESJ-1258:
-----------------------------------

    Component/s:     (was: SAX)
                 JAXP (javax.xml.validation)

> Performance issue
> -----------------
>
>                 Key: XERCESJ-1258
>                 URL: https://issues.apache.org/jira/browse/XERCESJ-1258
>             Project: Xerces2-J
>          Issue Type: Bug
>          Components: JAXP (javax.xml.validation)
>    Affects Versions: 2.6.2
>         Environment: AIX
>            Reporter: Gerardo Corro
>            Priority: Blocker
>             Fix For: 2.6.2
>
>
> The following snippet cuases tremendous CPU consumption, one xml file of 1Mb size and schema size of 33kb can take up to one hour to be validated.
> This problem does not occur in windows, but happens in AIX.
>  private boolean validateXmlVsSchema(String SchemaUrl, String xmlString) throws ValidationException, SAXParseException, UnhandleableException {
> File schema = new File(SchemaUrl);
> log.debug("The schema is being searched at: " + SchemaUrl);
> if ( !schema.exists() ) {
> throw new UnhandleableException(ValidatorConstants.SCHEMA_NO T_FOUND_EXCEPTION,
> new Exception(ValidatorConstants.SCHEMA_NOT_FOUND_EXCE PTION));
> }
> SAXParser parser = new SAXParser();
> try{
> parser.setFeature("http://xml.org/sax/features/validation", true);
> parser.setFeature("http://apache.org/xml/features/validation/schema", true);
> parser.setFeature("http://apache.org/xml/features/validation/schema-full-checking", true);
> parser.setProperty("http://apache.org/xml/properties/schema/external-noNamespaceSchemaLocation", SchemaUrl );
> Validator handler = new Validator();
> parser.setErrorHandler(handler);
> InputStream is = new ByteArrayInputStream( xmlString.getBytes("UTF-8"));
> parser.parse(new InputSource(is));
> if(handler.validationError==true){
> log.error(clazzName + "-> " + ValidatorConstants.SCHEMA_VALIDATION_ERROR + ": " + handler.validationError +
> "" + handler.saxParseException.getMessage(), handler.saxParseException);
> throw handler.saxParseException;
> } else {
> log.debug(clazzName + "-> " + ValidatorConstants.DOCUMENT_VALIDATED );
> return true;
> }
> } catch( java.io.UTFDataFormatException utfex){
> log.info(clazzName + "-> Wrong utf: " + utfex.getMessage(), utfex );
> } catch(java.io.IOException ioe){
> log.error(clazzName + "-> IOException " + ioe.getMessage(), ioe);
> throw new ValidationException(ValidatorConstants.SCHEMA_VALI DATION_EXCEPTION, ioe);
> } catch (SAXParseException e) {
> log.error(clazzName + "-> SAXParseException " + e.getMessage(), e);
> throw e;
> } catch (SAXNotRecognizedException e) {
> log.error(clazzName + "-> SAXNotRecognizedException " + e.getMessage(), e);
> throw new ValidationException(ValidatorConstants.SCHEMA_VALI DATION_EXCEPTION, e);
> } catch (SAXNotSupportedException e) {
> log.error(clazzName + "-> SAXNotSupportedException " + e.getMessage(), e);
> throw new ValidationException(ValidatorConstants.SCHEMA_VALI DATION_EXCEPTION, e);
> } catch (SAXException e) {
> log.error(clazzName + "-> SAXException " + e.getMessage(), e);
> throw new ValidationException(ValidatorConstants.SCHEMA_VALI DATION_EXCEPTION, e);
> }
> return true;
> }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Updated: (XERCESJ-1258) Performance issue

Posted by "Michael Glavassevich (JIRA)" <xe...@xml.apache.org>.
     [ https://issues.apache.org/jira/browse/XERCESJ-1258?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Michael Glavassevich updated XERCESJ-1258:
------------------------------------------

      Component/s:     (was: JAXP (javax.xml.validation))
                   XML Schema Structures
    Fix Version/s:     (was: 2.6.2)

> Performance issue
> -----------------
>
>                 Key: XERCESJ-1258
>                 URL: https://issues.apache.org/jira/browse/XERCESJ-1258
>             Project: Xerces2-J
>          Issue Type: Bug
>          Components: XML Schema Structures
>    Affects Versions: 2.6.2
>         Environment: AIX
>            Reporter: Gerardo Corro
>            Priority: Blocker
>
> The following snippet cuases tremendous CPU consumption, one xml file of 1Mb size and schema size of 33kb can take up to one hour to be validated.
> This problem does not occur in windows, but happens in AIX.
>  private boolean validateXmlVsSchema(String SchemaUrl, String xmlString) throws ValidationException, SAXParseException, UnhandleableException {
> File schema = new File(SchemaUrl);
> log.debug("The schema is being searched at: " + SchemaUrl);
> if ( !schema.exists() ) {
> throw new UnhandleableException(ValidatorConstants.SCHEMA_NO T_FOUND_EXCEPTION,
> new Exception(ValidatorConstants.SCHEMA_NOT_FOUND_EXCE PTION));
> }
> SAXParser parser = new SAXParser();
> try{
> parser.setFeature("http://xml.org/sax/features/validation", true);
> parser.setFeature("http://apache.org/xml/features/validation/schema", true);
> parser.setFeature("http://apache.org/xml/features/validation/schema-full-checking", true);
> parser.setProperty("http://apache.org/xml/properties/schema/external-noNamespaceSchemaLocation", SchemaUrl );
> Validator handler = new Validator();
> parser.setErrorHandler(handler);
> InputStream is = new ByteArrayInputStream( xmlString.getBytes("UTF-8"));
> parser.parse(new InputSource(is));
> if(handler.validationError==true){
> log.error(clazzName + "-> " + ValidatorConstants.SCHEMA_VALIDATION_ERROR + ": " + handler.validationError +
> "" + handler.saxParseException.getMessage(), handler.saxParseException);
> throw handler.saxParseException;
> } else {
> log.debug(clazzName + "-> " + ValidatorConstants.DOCUMENT_VALIDATED );
> return true;
> }
> } catch( java.io.UTFDataFormatException utfex){
> log.info(clazzName + "-> Wrong utf: " + utfex.getMessage(), utfex );
> } catch(java.io.IOException ioe){
> log.error(clazzName + "-> IOException " + ioe.getMessage(), ioe);
> throw new ValidationException(ValidatorConstants.SCHEMA_VALI DATION_EXCEPTION, ioe);
> } catch (SAXParseException e) {
> log.error(clazzName + "-> SAXParseException " + e.getMessage(), e);
> throw e;
> } catch (SAXNotRecognizedException e) {
> log.error(clazzName + "-> SAXNotRecognizedException " + e.getMessage(), e);
> throw new ValidationException(ValidatorConstants.SCHEMA_VALI DATION_EXCEPTION, e);
> } catch (SAXNotSupportedException e) {
> log.error(clazzName + "-> SAXNotSupportedException " + e.getMessage(), e);
> throw new ValidationException(ValidatorConstants.SCHEMA_VALI DATION_EXCEPTION, e);
> } catch (SAXException e) {
> log.error(clazzName + "-> SAXException " + e.getMessage(), e);
> throw new ValidationException(ValidatorConstants.SCHEMA_VALI DATION_EXCEPTION, e);
> }
> return true;
> }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Closed: (XERCESJ-1258) Performance issue

Posted by "Gerardo Corro (JIRA)" <xe...@xml.apache.org>.
     [ https://issues.apache.org/jira/browse/XERCESJ-1258?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Gerardo Corro closed XERCESJ-1258.
----------------------------------

    Resolution: Invalid

After re-compiling the applcation and re-deploying everything worked properly,  seems like during the first deployment something wrong happened and something got corrupted.

Closing this issue as invalid.

Thanks for your assistance.

> Performance issue
> -----------------
>
>                 Key: XERCESJ-1258
>                 URL: https://issues.apache.org/jira/browse/XERCESJ-1258
>             Project: Xerces2-J
>          Issue Type: Bug
>          Components: XML Schema Structures
>    Affects Versions: 2.6.2
>         Environment: AIX
>            Reporter: Gerardo Corro
>            Priority: Blocker
>
> The following snippet cuases tremendous CPU consumption, one xml file of 1Mb size and schema size of 33kb can take up to one hour to be validated.
> This problem does not occur in windows, but happens in AIX.
>  private boolean validateXmlVsSchema(String SchemaUrl, String xmlString) throws ValidationException, SAXParseException, UnhandleableException {
> File schema = new File(SchemaUrl);
> log.debug("The schema is being searched at: " + SchemaUrl);
> if ( !schema.exists() ) {
> throw new UnhandleableException(ValidatorConstants.SCHEMA_NO T_FOUND_EXCEPTION,
> new Exception(ValidatorConstants.SCHEMA_NOT_FOUND_EXCE PTION));
> }
> SAXParser parser = new SAXParser();
> try{
> parser.setFeature("http://xml.org/sax/features/validation", true);
> parser.setFeature("http://apache.org/xml/features/validation/schema", true);
> parser.setFeature("http://apache.org/xml/features/validation/schema-full-checking", true);
> parser.setProperty("http://apache.org/xml/properties/schema/external-noNamespaceSchemaLocation", SchemaUrl );
> Validator handler = new Validator();
> parser.setErrorHandler(handler);
> InputStream is = new ByteArrayInputStream( xmlString.getBytes("UTF-8"));
> parser.parse(new InputSource(is));
> if(handler.validationError==true){
> log.error(clazzName + "-> " + ValidatorConstants.SCHEMA_VALIDATION_ERROR + ": " + handler.validationError +
> "" + handler.saxParseException.getMessage(), handler.saxParseException);
> throw handler.saxParseException;
> } else {
> log.debug(clazzName + "-> " + ValidatorConstants.DOCUMENT_VALIDATED );
> return true;
> }
> } catch( java.io.UTFDataFormatException utfex){
> log.info(clazzName + "-> Wrong utf: " + utfex.getMessage(), utfex );
> } catch(java.io.IOException ioe){
> log.error(clazzName + "-> IOException " + ioe.getMessage(), ioe);
> throw new ValidationException(ValidatorConstants.SCHEMA_VALI DATION_EXCEPTION, ioe);
> } catch (SAXParseException e) {
> log.error(clazzName + "-> SAXParseException " + e.getMessage(), e);
> throw e;
> } catch (SAXNotRecognizedException e) {
> log.error(clazzName + "-> SAXNotRecognizedException " + e.getMessage(), e);
> throw new ValidationException(ValidatorConstants.SCHEMA_VALI DATION_EXCEPTION, e);
> } catch (SAXNotSupportedException e) {
> log.error(clazzName + "-> SAXNotSupportedException " + e.getMessage(), e);
> throw new ValidationException(ValidatorConstants.SCHEMA_VALI DATION_EXCEPTION, e);
> } catch (SAXException e) {
> log.error(clazzName + "-> SAXException " + e.getMessage(), e);
> throw new ValidationException(ValidatorConstants.SCHEMA_VALI DATION_EXCEPTION, e);
> }
> return true;
> }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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