private ConfigCatalog readCatalog ( String catalogRelPath , String catalogFullPath ) { URI uri ; try { // uri = new URI("file:" + StringUtil2.escape(catalogFullPath, "/:-_.")); // needed ? uri = new URI ( this . contextPath + "/catalog/" + catalogRelPath ) ; } catch ( URISyntaxException e ) { logCatalogInit . error ( ERROR + "readCatalog(): URISyntaxException=" + e . getMessage ( ) ) ; return null ; } ConfigCatalogBuilder builder = new ConfigCatalogBuilder ( ) ; try { // read the catalog logCatalogInit . info ( "-------readCatalog(): path=" + catalogRelPath ) ; ConfigCatalog cat = ( ConfigCatalog ) builder . buildFromLocation ( catalogFullPath , uri ) ; if ( builder . hasFatalError ( ) ) { logCatalogInit . error ( ERROR + " invalid catalog -- " + builder . getErrorMessage ( ) ) ; return null ; } if ( builder . getErrorMessage ( ) . length ( ) > 0 ) logCatalogInit . debug ( builder . getErrorMessage ( ) ) ; return cat ; } catch ( Throwable t ) { logCatalogInit . error ( ERROR + " Exception on catalog=" + catalogFullPath + " " + t . getMessage ( ) + "\n log=" + builder . getErrorMessage ( ) , t ) ; return null ; } }
Does the actual work of reading a catalog .