kohsuke     2004/02/25 11:46:15

  Modified:    java/src/org/apache/xerces/util
                        DOMEntityResolverWrapper.java
  Log:
  removing a try-catch block that was masking RuntimeException in the user's code
  
  Revision  Changes    Path
  1.12      +39 -49    
xml-xerces/java/src/org/apache/xerces/util/DOMEntityResolverWrapper.java
  
  Index: DOMEntityResolverWrapper.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xerces/java/src/org/apache/xerces/util/DOMEntityResolverWrapper.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- DOMEntityResolverWrapper.java     24 Feb 2004 23:15:53 -0000      1.11
  +++ DOMEntityResolverWrapper.java     25 Feb 2004 19:46:15 -0000      1.12
  @@ -101,55 +101,45 @@
           throws XNIException, IOException {
           // resolve entity using DOM entity resolver
           if (fEntityResolver != null) {
  -            try {
  -                // For entity resolution the type of the resource would be  XML TYPE
  -                // DOM L3 LS spec mention only the XML 1.0 recommendation right now
  -                LSInput inputSource =
  -                    resourceIdentifier == null
  -                        ? fEntityResolver.resolveResource(
  -                            null,
  -                            null,
  -                            null,
  -                            null,
  -                            null)
  -                        : fEntityResolver.resolveResource(
  -                            getType(resourceIdentifier),
  -                            resourceIdentifier.getNamespace(),
  -                            resourceIdentifier.getPublicId(),
  -                            resourceIdentifier.getLiteralSystemId(),
  -                            resourceIdentifier.getBaseSystemId());
  -                if (inputSource != null) {
  -                    String publicId = inputSource.getPublicId();
  -                    String systemId = inputSource.getSystemId();
  -                    String baseSystemId = inputSource.getBaseURI();
  -                    InputStream byteStream = inputSource.getByteStream();
  -                    Reader charStream = inputSource.getCharacterStream();
  -                    String encoding = inputSource.getEncoding();
  -                    String data = inputSource.getStringData();
  -                    XMLInputSource xmlInputSource =
  -                        new XMLInputSource(publicId, systemId, baseSystemId);
  +            // For entity resolution the type of the resource would be  XML TYPE
  +            // DOM L3 LS spec mention only the XML 1.0 recommendation right now
  +            LSInput inputSource =
  +                resourceIdentifier == null
  +                    ? fEntityResolver.resolveResource(
  +                        null,
  +                        null,
  +                        null,
  +                        null,
  +                        null)
  +                    : fEntityResolver.resolveResource(
  +                        getType(resourceIdentifier),
  +                        resourceIdentifier.getNamespace(),
  +                        resourceIdentifier.getPublicId(),
  +                        resourceIdentifier.getLiteralSystemId(),
  +                        resourceIdentifier.getBaseSystemId());
  +            if (inputSource != null) {
  +                String publicId = inputSource.getPublicId();
  +                String systemId = inputSource.getSystemId();
  +                String baseSystemId = inputSource.getBaseURI();
  +                InputStream byteStream = inputSource.getByteStream();
  +                Reader charStream = inputSource.getCharacterStream();
  +                String encoding = inputSource.getEncoding();
  +                String data = inputSource.getStringData();
  +                XMLInputSource xmlInputSource =
  +                    new XMLInputSource(publicId, systemId, baseSystemId);
   
  -                    if (charStream != null) {
  -                        xmlInputSource.setCharacterStream(charStream);
  -                    }
  -                    if (byteStream != null) {
  -                        xmlInputSource.setByteStream((InputStream) byteStream);
  -                    }
  -                    if (data != null && data.length() != 0) {
  -                        xmlInputSource.setCharacterStream(
  -                            new StringReader(data));
  -                    }
  -                    xmlInputSource.setEncoding(encoding);
  -                    return xmlInputSource;
  +                if (charStream != null) {
  +                    xmlInputSource.setCharacterStream(charStream);
                   }
  -            }
  -
  -            // error resolving entity
  -            catch (Exception e) {
  -                // REVISIT:
  -                // can at this point we receive wrapped exception?
  -
  -                throw new XNIException(e);
  +                if (byteStream != null) {
  +                    xmlInputSource.setByteStream((InputStream) byteStream);
  +                }
  +                if (data != null && data.length() != 0) {
  +                    xmlInputSource.setCharacterStream(
  +                        new StringReader(data));
  +                }
  +                xmlInputSource.setEncoding(encoding);
  +                return xmlInputSource;
               }
           }
   
  
  
  

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

Reply via email to