Check for null Bundle in logging code. (FELIX-2800)
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1062903 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/framework/src/main/java/org/apache/felix/framework/Logger.java b/framework/src/main/java/org/apache/felix/framework/Logger.java
index 031868b..6e05d4f 100644
--- a/framework/src/main/java/org/apache/felix/framework/Logger.java
+++ b/framework/src/main/java/org/apache/felix/framework/Logger.java
@@ -118,10 +118,20 @@
Bundle bundle, ServiceReference sr, int level,
String msg, Throwable throwable)
{
- String s = (sr == null) ? null : "SvcRef " + sr;
- s = (s == null) ? null : s + " Bundle '" + bundle.getBundleId() + "'";
- s = (s == null) ? msg : s + " " + msg;
- s = (throwable == null) ? s : s + " (" + throwable + ")";
+ String s = "";
+ if (sr != null)
+ {
+ s = s + "SvcRef " + sr + " ";
+ }
+ else if (bundle != null)
+ {
+ s = s + "Bundle " + bundle.toString() + " ";
+ }
+ s = s + msg;
+ if (throwable != null)
+ {
+ s = s + " (" + throwable + ")";
+ }
switch (level)
{
case LOG_DEBUG:
@@ -311,4 +321,4 @@
}
}
}
-}
\ No newline at end of file
+}