/** * private instance creation * * @param classloader project classloader * @param jndiFileName (optional) jndi file name */ private ServiceFactory(ClassLoader classloader) { super(); try { this.classLoader = classloader; properties = System.getProperties(); //loading server properties (from class-path) try { properties.load(FileUtil.getResource("serviceaccess.properties", classloader)); } catch (final Exception e) { LOG.info("couldn't load optional properties from serviceaccess.properties in classpath"); } // set the default jndi prefix if (Boolean.valueOf(properties.getProperty(KEY_USE_JNDI_MAPPING, "false"))) jndiPrefix = properties.getProperty(KEY_JNDI_PREFIX, ENV.getName().toLowerCase().trim()); } catch (final Exception e) { throw new RuntimeException(e); } }
reader = new InputStreamReader(FileUtil.getResource(filePath));
public static void printAsciiImage(String name, PrintWriter out, int width, int height, boolean resource, boolean bars) { try { if (resource) { new AsciiImage(bars ? AsciiImage.BARS : AsciiImage.CHARS, AsciiImage.RGB).convertToAscii( ImageIO.read(FileUtil.getResource(name)), out, width, height).flush(); } else { new AsciiImage().convertToAscii(name, out, width, height).flush(); } } catch (Exception e) { //it's only a logo, no problem (perhaps on android) LOG.error(e.toString()); } }