You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by di...@apache.org on 2002/04/09 18:47:06 UTC

cvs commit: jakarta-commons/latka/src/java/org/apache/commons/latka/xml LatkaVariableEntityResolver.java

dion        02/04/09 09:47:06

  Modified:    latka/src/java/org/apache/commons/latka/xml
                        LatkaVariableEntityResolver.java
  Log:
  - handle null systemId better
  - reformat code
  
  Revision  Changes    Path
  1.2       +26 -24    jakarta-commons/latka/src/java/org/apache/commons/latka/xml/LatkaVariableEntityResolver.java
  
  Index: LatkaVariableEntityResolver.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/latka/src/java/org/apache/commons/latka/xml/LatkaVariableEntityResolver.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- LatkaVariableEntityResolver.java	19 Sep 2001 22:24:40 -0000	1.1
  +++ LatkaVariableEntityResolver.java	9 Apr 2002 16:47:06 -0000	1.2
  @@ -103,31 +103,33 @@
   
     }
   
  -  /**
  -   * Preprocesses the URIs, resolving any Latka variables 
  -   * before returning a modified InputSource.
  -   * 
  -   * @param publicId URL of the entity to retrieve
  -   * @param systemId System id for the entity
  -   * @return InputSource containing the XML content with all
  -   *         variables resolved
  -   * @exception SAXException
  -   */
  -  public InputSource resolveEntity(String publicId, String systemId)
  -  throws SAXException {
  +    /**
  +     * Preprocesses the URIs, resolving any Latka variables 
  +     * before returning a modified InputSource.
  +     * 
  +     * @param publicId URL of the entity to retrieve
  +     * @param systemId System id for the entity
  +     * @return InputSource containing the XML content with all
  +     *         variables resolved
  +     * @exception SAXException
  +     */
  +    public InputSource resolveEntity(String publicId, String systemId)
  +        throws SAXException {
   
  -    _log.debug("Resolving URI: " + systemId);
  +        if (systemId == null) {
  +            return null;
  +        }
  +        _log.debug("Resolving URI: " + systemId);
   
  -    XMLPreprocessor process = XMLPreprocessor.instance();
  -    try {
  -      URL url = new URL(systemId);
  -      String xml = process.resolveVariables(url);
  -      InputSource source = new InputSource(new StringReader(xml));
  -      source.setSystemId(systemId);
  -      return source;
  -    } catch (IOException e) {
  -      throw new SAXException(e);
  +        XMLPreprocessor process = XMLPreprocessor.instance();
  +        try {
  +            URL url = new URL(systemId);
  +            String xml = process.resolveVariables(url);
  +            InputSource source = new InputSource(new StringReader(xml));
  +            source.setSystemId(systemId);
  +            return source;
  +        } catch (IOException e) {
  +            throw new SAXException(e);
  +        }
       }
  -  }
  -
   }
  
  
  

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>