rdonkin     2003/10/19 12:35:40

  Modified:    digester/src/java/org/apache/commons/digester Digester.java
  Log:
  Modified internal entity resolver so that it will try the SYSTEM id if the PUBLIC id 
is null. Patch submitted by Henri Gomez. Also added getter and setter for SAX logger.
  
  Revision  Changes    Path
  1.84      +40 -8     
jakarta-commons/digester/src/java/org/apache/commons/digester/Digester.java
  
  Index: Digester.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-commons/digester/src/java/org/apache/commons/digester/Digester.java,v
  retrieving revision 1.83
  retrieving revision 1.84
  diff -u -r1.83 -r1.84
  --- Digester.java     9 Oct 2003 21:09:46 -0000       1.83
  +++ Digester.java     19 Oct 2003 19:35:40 -0000      1.84
  @@ -591,6 +591,25 @@
   
       }
   
  +    /**
  +     * Gets the logger used for logging SAX-related information.
  +     * <strong>Note</strong> the output is finely grained.
  +     */
  +    public Log getSAXLogger() {
  +        
  +        return saxLog;
  +    }
  +    
  +
  +    /**
  +     * Sets the logger used for logging SAX-related information.
  +     * <strong>Note</strong> the output is finely grained.
  +     * @param log Log, not null
  +     */    
  +    public void setSAXLogger(Log saxLog) {
  +    
  +        this.saxLog = saxLog;
  +    }
   
       /**
        * Return the current rule match path
  @@ -1381,9 +1400,9 @@
        * @param systemId The system identifier of the entity being referenced
        *
        * @exception SAXException if a parsing exception occurs
  -     * <
  +     * 
        */
  -      public InputSource resolveEntity(String publicId, String systemId)
  +    public InputSource resolveEntity(String publicId, String systemId)
               throws SAXException {     
                   
           if (saxLog.isDebugEnabled()) {
  @@ -1404,8 +1423,21 @@
               entityURL = (String)entityValidator.get(systemId);
           } 
   
  -        if (entityURL == null){ 
  -           return (null); 
  +        if (entityURL == null) { 
  +            if (systemId == null) {
  +                // cannot resolve
  +                if (log.isDebugEnabled()) {
  +                    log.debug(" Cannot resolve entity: '" + entityURL + "'");
  +                }
  +                return (null);
  +                
  +                } else {
  +                    // try to resolve using system ID
  +                    if (log.isDebugEnabled()) {
  +                        log.debug(" Trying to resolve using system ID '" + systemId 
+ "'");
  +                    } 
  +                    entityURL = systemId;
  +                }
           }
           
           // Return an input source to our alternative URL
  
  
  

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

Reply via email to