Be security conscious about getting our system class loader.
git-svn-id: https://samskivert.googlecode.com/svn/trunk@1376 6335cc39-0255-0410-8fd6-9bcaacd3b74c
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
//
|
//
|
||||||
// $Id: ConfigUtil.java,v 1.11 2003/04/02 04:01:50 mdb Exp $
|
// $Id: ConfigUtil.java,v 1.12 2004/01/24 06:02:11 mdb Exp $
|
||||||
//
|
//
|
||||||
// samskivert library - useful routines for java programs
|
// samskivert library - useful routines for java programs
|
||||||
// Copyright (C) 2001 Michael Bayne
|
// Copyright (C) 2001 Michael Bayne
|
||||||
@@ -22,6 +22,7 @@ package com.samskivert.util;
|
|||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
|
import java.security.AccessControlException;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
import com.samskivert.Log;
|
import com.samskivert.Log;
|
||||||
@@ -287,9 +288,13 @@ public class ConfigUtil
|
|||||||
// if we couldn't find anything there, try the system class
|
// if we couldn't find anything there, try the system class
|
||||||
// loader (but only if that's not where we were already
|
// loader (but only if that's not where we were already
|
||||||
// looking)
|
// looking)
|
||||||
ClassLoader sysloader = ClassLoader.getSystemClassLoader();
|
try {
|
||||||
if (sysloader != loader) {
|
ClassLoader sysloader = ClassLoader.getSystemClassLoader();
|
||||||
enum = getResources(path, sysloader);
|
if (sysloader != loader) {
|
||||||
|
enum = getResources(path, sysloader);
|
||||||
|
}
|
||||||
|
} catch (AccessControlException ace) {
|
||||||
|
// can't get the system loader, no problem!
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -564,12 +569,15 @@ public class ConfigUtil
|
|||||||
|
|
||||||
// if that didn't work, try the system class loader (but only if
|
// if that didn't work, try the system class loader (but only if
|
||||||
// it's different from the class loader we just tried)
|
// it's different from the class loader we just tried)
|
||||||
ClassLoader sysloader = ClassLoader.getSystemClassLoader();
|
try {
|
||||||
if (sysloader != loader) {
|
ClassLoader sysloader = ClassLoader.getSystemClassLoader();
|
||||||
return getResourceAsStream(path, loader);
|
if (sysloader != loader) {
|
||||||
} else {
|
return getResourceAsStream(path, loader);
|
||||||
return null;
|
}
|
||||||
|
} catch (AccessControlException ace) {
|
||||||
|
// can't get the system loader, no problem!
|
||||||
}
|
}
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static InputStream getResourceAsStream (
|
protected static InputStream getResourceAsStream (
|
||||||
|
|||||||
Reference in New Issue
Block a user