venu        2003/11/13 18:44:08

  Modified:    java/src/org/apache/xerces/dom DOMNormalizer.java
  Log:
  Changed DOMNormalizer to reuse DOMErrorImpl. Patch submitted by kohosuke kawaguchi.
  
  Revision  Changes    Path
  1.37      +15 -9     xml-xerces/java/src/org/apache/xerces/dom/DOMNormalizer.java
  
  Index: DOMNormalizer.java
  ===================================================================
  RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/dom/DOMNormalizer.java,v
  retrieving revision 1.36
  retrieving revision 1.37
  diff -u -r1.36 -r1.37
  --- DOMNormalizer.java        13 Nov 2003 11:25:39 -0000      1.36
  +++ DOMNormalizer.java        14 Nov 2003 02:44:08 -0000      1.37
  @@ -66,6 +66,7 @@
   import org.apache.xerces.impl.RevalidationHandler;
   import org.apache.xerces.impl.dv.XSSimpleType;
   import org.apache.xerces.xs.XSTypeDefinition;
  +import org.apache.xerces.impl.xs.util.SimpleLocator;
   import org.apache.xerces.util.AugmentationsImpl;
   import org.apache.xerces.util.NamespaceSupport;
   import org.apache.xerces.util.SymbolTable;
  @@ -151,7 +152,13 @@
       protected SymbolTable fSymbolTable;
       /** error handler. may be null. */
       protected DOMErrorHandler fErrorHandler;
  -
  +    
  +    /**
  +     * Cached [EMAIL PROTECTED] DOMError} impl.
  +     * The same object is re-used to report multiple errors.
  +     */
  +    private final DOMErrorImpl fError = new DOMErrorImpl();
  +    
       // Validation against namespace aware grammar
       protected boolean fNamespaceValidation = false;
   
  @@ -914,15 +921,14 @@
        */
       protected final void reportDOMError(String message, short severity, Node node, 
String type ){
           if( fErrorHandler!=null ) {
  -            DOMErrorImpl error = new DOMErrorImpl();
  -            error.reset();
  -            error.fMessage = message;
  -            error.fSeverity = severity;
  -            error.fLocator = fLocator;
  -            error.fType = type;
  +            fError.reset();
  +            fError.fMessage = message;
  +            fError.fSeverity = severity;
  +            fError.fLocator = fLocator;
  +            fError.fType = type;
               fLocator.fRelatedNode = node;
       
  -            if(!fErrorHandler.handleError(error))
  +            if(!fErrorHandler.handleError(fError))
                   throw abort;
           }
           if( severity==DOMError.SEVERITY_FATAL_ERROR )
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to