cziegeler    02/01/02 23:18:28

  Modified:    src/scratchpad/org/apache/avalon/excalibur/xml
                        JaxpParser.java
  Log:
  Ignore failure on setting property
  
  Revision  Changes    Path
  1.9       +16 -8     
jakarta-avalon-excalibur/src/scratchpad/org/apache/avalon/excalibur/xml/JaxpParser.java
  
  Index: JaxpParser.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-avalon-excalibur/src/scratchpad/org/apache/avalon/excalibur/xml/JaxpParser.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- JaxpParser.java   2 Jan 2002 10:18:55 -0000       1.8
  +++ JaxpParser.java   3 Jan 2002 07:18:28 -0000       1.9
  @@ -51,7 +51,7 @@
    * @author <a href="mailto:[EMAIL PROTECTED]">Berin Loritsch</a>
    * @author <a href="mailto:[EMAIL PROTECTED]">Carsten Ziegeler</a>
    * @author <a href="mailto:[EMAIL PROTECTED]">Sylvain Wallez</a>
  - * @version CVS $Revision: 1.8 $ $Date: 2002/01/02 10:18:55 $
  + * @version CVS $Revision: 1.9 $ $Date: 2002/01/03 07:18:28 $
    */
   public class JaxpParser
   extends AbstractLogEnabled
  @@ -212,12 +212,21 @@
               try
               {
                   this.reader = factory.newSAXParser().getXMLReader();
  -                
this.reader.setFeature("http://xml.org/sax/features/namespace-prefixes";, 
this.nsPrefixes);
               }
  -            catch(Exception e)
  +            catch( ParserConfigurationException pce )
               {
  -                this.getLogger().error("Cannot produce a valid parser", e);
  -                throw new SAXException("Cannot produce a valid parser", e);
  +                throw new SAXException( "Cannot produce a valid parser", pce 
);
  +            }
  +            if ( this.nsPrefixes ) {
  +                try
  +                {
  +                    
this.reader.setFeature("http://xml.org/sax/features/namespace-prefixes";, 
this.nsPrefixes);
  +                }
  +                catch ( SAXException e )
  +                {
  +                    this.getLogger().warn("SAX2 XMLReader does not support 
setting feature: "+
  +                                      
"'http://xml.org/sax/features/namespace-prefixes'");
  +                }
               }
           }
       }
  @@ -226,6 +235,7 @@
        * Creates a new <code>DocumentBuilder</code> if needed.
        */
       protected void setupDocumentBuilder()
  +    throws SAXException
       {
           if ( null == this.docBuilder )
           {
  @@ -235,9 +245,7 @@
               }
               catch (ParserConfigurationException pce)
               {
  -                this.getLogger().error("Could not create DocumentBuilder", 
pce);
  -                throw new 
org.apache.avalon.framework.CascadingRuntimeException(
  -                    "Could not create DocumentBuilder", pce);
  +                throw new SAXException( "Could not create DocumentBuilder", 
pce );
               }
           }
       }
  
  
  

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

Reply via email to