Commit 8793daad authored by Petri Hintukainen's avatar Petri Hintukainen

Factorize common code

parent ca14fbc0
......@@ -51,12 +51,7 @@ public class FileInputStream extends InputStream
if (file.isAbsolute()) {
String cachedName = BDJLoader.getCachedFile(name);
if (cachedName != name) {
synchronized (FileInputStream.class) {
if (logger == null) {
logger = Logger.getLogger(FileInputStream.class.getName());
}
}
logger.info("Using cached " + cachedName + " for " + name);
getLogger().info("Using cached " + cachedName + " for " + name);
name = cachedName;
}
openImpl(name);
......@@ -66,12 +61,7 @@ public class FileInputStream extends InputStream
String home = BDJXletContext.getCurrentXletHome();
if (home == null) {
synchronized (FileInputStream.class) {
if (logger == null) {
logger = Logger.getLogger(FileInputStream.class.getName());
}
}
logger.error("no home found for " + name + " at " + Logger.dumpStack());
getLogger().error("Xlet home directory not found for " + name + " at " + Logger.dumpStack());
throw new FileNotFoundException(name);
}
openImpl(home + name);
......@@ -187,6 +177,15 @@ public class FileInputStream extends InputStream
public FileChannel getChannel() {}
*/
private static Logger getLogger() {
synchronized (FileInputStream.class) {
if (logger == null) {
logger = Logger.getLogger(FileInputStream.class.getName());
}
}
return logger;
}
private static native void initIDs();
static {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment