public Properties loadProperties(String path) { Properties pages = new Properties(); try { FileInputStream filePages = new FileInputStream(path); pages.load(filePages); filePages.close(); } catch (IOException ex) { throw new RuntimeException(ex); } return pages; }
/** * Does the actual work of reading a catalog. * * @param factory use this InvCatalogFactory * @param path reletive path starting from content root * @param catalogFullPath absolute location on disk * @return the InvCatalogImpl, or null if failure */ private InvCatalogImpl readCatalog( InvCatalogFactory factory, String path, String catalogFullPath) { InvCatalogImpl acat; try { catURI = new URI("file:" + StringUtil2.escape(catalogFullPath, "/:-_.")); // LOOK needed ? } catch (URISyntaxException e) { logServerStartup.info("radarServer readCatalog(): URISyntaxException=" + e.getMessage()); return null; } // read the catalog logServerStartup.info( "radarServer readCatalog(): full path=" + catalogFullPath + "; path=" + path); FileInputStream ios = null; try { ios = new FileInputStream(catalogFullPath); acat = factory.readXML(ios, catURI); } catch (Throwable t) { logServerStartup.error( "radarServer readCatalog(): Exception on catalog=" + catalogFullPath + " " + t.getMessage()); // +"\n log="+cat.getLog(), t); return null; } finally { if (ios != null) { try { ios.close(); } catch (IOException e) { logServerStartup.info("radarServer readCatalog(): error closing" + catalogFullPath); } } } return acat; }
package com.jspsmart.upload;