cziegeler    2003/03/13 07:31:55

  Modified:    xmlutil/src/java/org/apache/excalibur/xml
                        DefaultEntityResolver.java
  Log:
  Fixing catalog resolving
  
  Revision  Changes    Path
  1.3       +20 -4     
avalon-excalibur/xmlutil/src/java/org/apache/excalibur/xml/DefaultEntityResolver.java
  
  Index: DefaultEntityResolver.java
  ===================================================================
  RCS file: 
/home/cvs/avalon-excalibur/xmlutil/src/java/org/apache/excalibur/xml/DefaultEntityResolver.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- DefaultEntityResolver.java        12 Mar 2003 10:03:15 -0000      1.2
  +++ DefaultEntityResolver.java        13 Mar 2003 15:31:54 -0000      1.3
  @@ -171,11 +171,27 @@
           try 
           {
               source = this.resolver.resolveURI(file);
  -            this.catalogResolver.getCatalog().parseCatalog(source.getURI(), 
source.getInputStream());
  +            String mimeType = source.getMimeType();
  +            this.catalogResolver.getCatalog().parseCatalog(source.getURI());
           } 
           catch (Exception e) 
  -        {
  -            this.getLogger().warn("Could not get Catalog file " + file, e);         
   
  +        {   
  +            this.getLogger().warn("Could not get Catalog file. Trying again: " + 
file, e);
  +                        
  +            // try it again
  +            if ( null != source )
  +            {   
  +                try 
  +                {
  +                    String mimeType = source.getMimeType();
  +                    if ( null == mimeType ) mimeType =" text/plain";
  +                    this.catalogResolver.getCatalog().parseCatalog(mimeType, 
source.getInputStream());
  +                } 
  +                catch (Exception ex)
  +                {
  +                    this.getLogger().warn("Could not get Catalog file: " + file, 
ex);
  +                }
  +            }
           }
           finally 
           {
  
  
  

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

Reply via email to