Steve,
Unless I am mistaken this has been already fixed in 1.1b1. Ceki
At 16:52 23.03.2001 -0500, you wrote:
>I could not run log4j in untrusted applets until I added this
>patch to Category. The difficulty was that the code was
>handling a security exception in the first check to System.getProperty()
>correctly, but then turned around and issued another check to
>System.getProperty()
>without any SecurityException handling code!
>
>Anyway a simple little fix, included for those who are interested in it.
>
>Thanks!
>Steve
>
> /** Search for the properties file log4j.properties in the CLASSPATH. */
> static {
> String override = null;
> try {
> override=System.getProperty(DEFAULT_INIT_OVERRIDE_KEY, override);
> } catch(SecurityException e) {
> LogLog.debug("Could not read system property \""+
> DEFAULT_INIT_OVERRIDE_KEY +
> "\", assuming default value of false.", e);
> }
> // if there is no default init override, them get the resource
> // specified by the user or the default config file.
> if(override == null || "false".equalsIgnoreCase(override)) {
> // Handle security exception again
> String resource = null;
> try {
> resource = System.getProperty(DEFAULT_CONFIGURATION_KEY,
> DEFAULT_CONFIGURATION_FILE);
> } catch(SecurityException e) {
> LogLog.debug("Could not read system property \""+
> DEFAULT_CONFIGURATION_KEY +
> "\", assuming default configuration file \"" +
> DEFAULT_CONFIGURATION_FILE + "\".", e);
> resource = DEFAULT_CONFIGURATION_FILE;
> }
> URL url = null;
> try {
> url = new URL(resource);
> } catch (MalformedURLException ex) {
> // so, resource is not a URL:
> // attempt to get the resource in the most generic way:
> url = Category.class.getResource(resource);
> if(url == null) {
> // if that doen't work, then try again in a slightly
> // different way
> ClassLoader loader = Category.class.getClassLoader();
> if(loader != null) {
> url = loader.getResource(resource);
> }
> }
> }
>
> // If we have a non-null url, then delegate the rest of the
> // configuration to the OptionConverter.selectAndConfigure
> // method.
> if(url != null) {
> OptionConverter.selectAndConfigure(url, defaultHierarchy);
> } else {
> LogLog.debug("Could not find resource: ["+resource+"].");
> }
> }
> }
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
I hope to see you at my ApacheCon 2001 presentation
entitled "Log4j, A Logging Package for Java".
See http://ApacheCon.Com/2001/US/ for more details.
--
Ceki Gülcü Web: http://qos.ch
email: [EMAIL PROTECTED] (preferred)
[EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]