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/10 09:37:04 UTC

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

     [ 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