legacy/src/main/java/thredds/catalog/InvCatalogFactory.java
public InvCatalogImpl readXML(URI uri) {
    // get ready for XML parsing
    warnMessages.setLength(0);
    errMessages.setLength(0);
    fatalMessages.setLength(0);

    org.jdom2.Document jdomDoc;
    InputStream is = null;
    try {
      jdomDoc = saxBuilder.build(uri.toURL());
//      HttpUriResolver httpUriResolver = HttpUriResolver.newDefaultUriResolver();
//      String s = httpUriResolver.getString( url );
//      //StringReader
//      is = new BufferedInputStream( httpUriResolver.getInputStream( url ), 1000000 );
//      jdomDoc = saxBuilder.build( is );
    } catch (Exception e) {
      InvCatalogImpl cat = new InvCatalogImpl(uri.toString(), null, null);
      cat.appendErrorMessage("**Fatal:  InvCatalogFactory.readXML failed"
          + "\n Exception= " + e.getClass().getName() + " " + e.getMessage()
          + "\n fatalMessages= " + fatalMessages.toString()
          + "\n errMessages= " + errMessages.toString()
          + "\n warnMessages= " + warnMessages.toString() + "\n", true);
      return cat;
    }
    finally
    {
      if ( is != null) try
      {
        is.close();
      }
      catch ( IOException e )
      {
        log.warn( "Failed to close input stream [" + uri.toString() + "]." );
      }
    }

    if (fatalMessages.length() > 0) {
      InvCatalogImpl cat = new InvCatalogImpl(uri.toString(), null, null);
      cat.appendErrorMessage("**Fatal:  InvCatalogFactory.readXML XML Fatal error(s) =\n" +
          fatalMessages.toString() + "\n", true);
      return cat;
    }

    return readXML(jdomDoc, uri);
  }
public InvCatalogImpl readXML(URI uri) {
    // get ready for XML parsing
    warnMessages.setLength(0);
    errMessages.setLength(0);
    fatalMessages.setLength(0);

    org.jdom2.Document jdomDoc;
    InputStream is = null;
    try {
      jdomDoc = saxBuilder.build(uri.toURL());
//      HttpUriResolver httpUriResolver = HttpUriResolver.newDefaultUriResolver();
//      String s = httpUriResolver.getString( url );
//      //StringReader
//      is = new BufferedInputStream( httpUriResolver.getInputStream( url ), 1000000 );
//      jdomDoc = saxBuilder.build( is );
    } catch (Exception e) {
      InvCatalogImpl cat = new InvCatalogImpl(uri.toString(), null, null);
      cat.appendErrorMessage("**Fatal:  InvCatalogFactory.readXML failed"
          + "\n Exception= " + e.getClass().getName() + " " + e.getMessage()
          + "\n fatalMessages= " + fatalMessages.toString()
          + "\n errMessages= " + errMessages.toString()
          + "\n warnMessages= " + warnMessages.toString() + "\n", true);
      return cat;
    }
    finally
    {
      if ( is != null) try
      {
        is.close();
      }
      catch ( IOException e )
      {
        log.warn( "Failed to close input stream [" + uri.toString() + "]." );
      }
    }

    if (fatalMessages.length() > 0) {
      InvCatalogImpl cat = new InvCatalogImpl(uri.toString(), null, null);
      cat.appendErrorMessage("**Fatal:  InvCatalogFactory.readXML XML Fatal error(s) =\n" +
          fatalMessages.toString() + "\n", true);
      return cat;
    }

    return readXML(jdomDoc, uri);
  }
public InvCatalogImpl readXML ( URI uri ) { // get ready for XML parsing warnMessages . setLength ( 0 ) ; errMessages . setLength ( 0 ) ; fatalMessages . setLength ( 0 ) ; org . jdom2 . Document jdomDoc ; InputStream is = null ; try { jdomDoc = saxBuilder . build ( uri . toURL ( ) ) ; //      HttpUriResolver httpUriResolver = HttpUriResolver.newDefaultUriResolver(); //      String s = httpUriResolver.getString( url ); //      //StringReader //      is = new BufferedInputStream( httpUriResolver.getInputStream( url ), 1000000 ); //      jdomDoc = saxBuilder.build( is ); } catch ( Exception e ) { InvCatalogImpl cat = new InvCatalogImpl ( uri . toString ( ) , null , null ) ; cat . appendErrorMessage ( "**Fatal:  InvCatalogFactory.readXML failed" + "\n Exception= " + e . getClass ( ) . getName ( ) + " " + e . getMessage ( ) + "\n fatalMessages= " + fatalMessages . toString ( ) + "\n errMessages= " + errMessages . toString ( ) + "\n warnMessages= " + warnMessages . toString ( ) + "\n" , true ) ; return cat ; } finally { if ( is != null ) try { is . close ( ) ; } catch ( IOException e ) { log . warn ( "Failed to close input stream [" + uri . toString ( ) + "]." ) ; } } if ( fatalMessages . length ( ) > 0 ) { InvCatalogImpl cat = new InvCatalogImpl ( uri . toString ( ) , null , null ) ; cat . appendErrorMessage ( "**Fatal:  InvCatalogFactory.readXML XML Fatal error(s) =\n" + fatalMessages . toString ( ) + "\n" , true ) ; return cat ; } return readXML ( jdomDoc , uri ) ; }
Read an InvCatalog from an a URI.
Failures and exceptions are handled
by causing validate() to fail. Therefore, be sure to call validate() before trying
to use the InvCatalog object.

@param uri : the URI of the document, used for resolving reletive references.
@return an InvCatalogImpl object
Read an InvCatalog from an a URI . Failures and exceptions are handled by causing validate () to fail . Therefore be sure to call validate () before trying to use the InvCatalog object .