1
0

Added catch of security exceptions which are thrown if using commons-logging inside a container, such as the J2EE SDK server.

git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/logging/trunk@138873 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
James Strachan
2002-02-26 04:06:22 +00:00
parent dee096a758
commit 18a4e8fa33

View File

@@ -1,7 +1,7 @@
/* /*
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//logging/src/java/org/apache/commons/logging/impl/SimpleLog.java,v 1.2 2002/02/15 05:46:36 costin Exp $ * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//logging/src/java/org/apache/commons/logging/impl/SimpleLog.java,v 1.3 2002/02/26 04:06:22 jstrachan Exp $
* $Revision: 1.2 $ * $Revision: 1.3 $
* $Date: 2002/02/15 05:46:36 $ * $Date: 2002/02/26 04:06:22 $
* *
* ==================================================================== * ====================================================================
* *
@@ -62,12 +62,13 @@
package org.apache.commons.logging.impl; package org.apache.commons.logging.impl;
import java.util.Properties;
import java.util.Enumeration;
import java.io.InputStream; import java.io.InputStream;
import java.text.SimpleDateFormat; import java.security.AccessControlException;
import java.text.DateFormat; import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date; import java.util.Date;
import java.util.Enumeration;
import java.util.Properties;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
@@ -104,7 +105,7 @@ import org.apache.commons.logging.Log;
* @author Rod Waldhoff * @author Rod Waldhoff
* @author Robert Burrell Donkin * @author Robert Burrell Donkin
* *
* @version $Id: SimpleLog.java,v 1.2 2002/02/15 05:46:36 costin Exp $ * @version $Id: SimpleLog.java,v 1.3 2002/02/26 04:06:22 jstrachan Exp $
*/ */
public class SimpleLog implements Log { public class SimpleLog implements Log {
@@ -155,6 +156,8 @@ public class SimpleLog implements Log {
// initialize class attributes // initialize class attributes
static { static {
try {
// add all system props that start with the specified prefix // add all system props that start with the specified prefix
Enumeration enum = System.getProperties().propertyNames(); Enumeration enum = System.getProperties().propertyNames();
while(enum.hasMoreElements()) { while(enum.hasMoreElements()) {
@@ -205,6 +208,10 @@ public class SimpleLog implements Log {
systemPrefix + "dateformat","yyyy/MM/dd HH:mm:ss:SSS zzz")); systemPrefix + "dateformat","yyyy/MM/dd HH:mm:ss:SSS zzz"));
} }
} }
catch (AccessControlException e) {
// ignore access control exceptions when trying to check system properties
}
}
// ------------------------------------------------------------- Attributes // ------------------------------------------------------------- Attributes