You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by fm...@apache.org on 2008/03/12 08:07:15 UTC

svn commit: r636226 - /incubator/sling/trunk/osgi/log/src/main/java/org/apache/sling/osgi/log/LogbackManager.java

Author: fmeschbe
Date: Wed Mar 12 00:07:07 2008
New Revision: 636226

URL: http://svn.apache.org/viewvc?rev=636226&view=rev
Log:
SLING-321 Applying patch supplied by Betrand and also rightly assume property
values are strings (and not just objects)

Modified:
    incubator/sling/trunk/osgi/log/src/main/java/org/apache/sling/osgi/log/LogbackManager.java

Modified: incubator/sling/trunk/osgi/log/src/main/java/org/apache/sling/osgi/log/LogbackManager.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/osgi/log/src/main/java/org/apache/sling/osgi/log/LogbackManager.java?rev=636226&r1=636225&r2=636226&view=diff
==============================================================================
--- incubator/sling/trunk/osgi/log/src/main/java/org/apache/sling/osgi/log/LogbackManager.java (original)
+++ incubator/sling/trunk/osgi/log/src/main/java/org/apache/sling/osgi/log/LogbackManager.java Wed Mar 12 00:07:07 2008
@@ -141,7 +141,8 @@
         if (properties != null) {
             this.configureLogback(new ConfigProperties() {
                 public String getProperty(String name) {
-                    return (String) properties.get(name);
+                    final Object obj = properties.get(name);
+                    return (obj == null) ? null : obj.toString();
                 }
             });
         }
@@ -293,13 +294,11 @@
             }
 
             // get number of files and ensure minimum and default
-            Object fileNumObj = context.getProperty(LOG_FILE_NUMBER);
+            String fileNumProp = context.getProperty(LOG_FILE_NUMBER);
             int fileNum = -1;
-            if (fileNumObj instanceof Number) {
-                fileNum = ((Number) fileNumObj).intValue();
-            } else if (fileNumObj != null) {
+            if (fileNumProp != null) {
                 try {
-                    fileNum = Integer.parseInt(fileNumObj.toString());
+                    fileNum = Integer.parseInt(fileNumProp.toString());
                 } catch (NumberFormatException nfe) {
                     // don't care
                 }
@@ -316,8 +315,7 @@
             rolling.setContext(loggerContext);
 
             // get the log file size
-            Object fileSizeObj = context.getProperty(LOG_FILE_SIZE);
-            String fileSize = (fileSizeObj != null) ? fileSizeObj.toString() : null;
+            String fileSize = context.getProperty(LOG_FILE_SIZE);
             if (fileSize == null || fileSize.length() == 0) {
                 fileSize = LOG_FILE_SIZE_DEFAULT;
             }