Modified Filter impl to correctly deal with the fact that the logger
might be null; this needs to be changed somehow to get a proper logger.
git-svn-id: https://svn.apache.org/repos/asf/incubator/felix/trunk@386371 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/org.apache.felix.framework/src/main/java/org/apache/felix/framework/FilterImpl.java b/org.apache.felix.framework/src/main/java/org/apache/felix/framework/FilterImpl.java
index c41aeea..e9f478d 100644
--- a/org.apache.felix.framework/src/main/java/org/apache/felix/framework/FilterImpl.java
+++ b/org.apache.felix.framework/src/main/java/org/apache/felix/framework/FilterImpl.java
@@ -37,7 +37,7 @@
private Evaluator m_evaluator = null;
private SimpleMapper m_mapper = null;
-// TODO: FilterImpl needs a logger, this is a hack to get FrameworkUtil to compile.
+// TODO: FilterImpl needs a logger, this is a hack for FrameworkUtil.
public FilterImpl(String expr) throws InvalidSyntaxException
{
this(null, expr);
@@ -132,11 +132,11 @@
}
catch (AttributeNotFoundException ex)
{
- m_logger.log(Logger.LOG_DEBUG, "FilterImpl: " + ex);
+ log(Logger.LOG_DEBUG, "FilterImpl: Attribute not found.", ex);
}
catch (EvaluationException ex)
{
- m_logger.log(Logger.LOG_ERROR, "FilterImpl: " + toString(), ex);
+ log(Logger.LOG_ERROR, "FilterImpl: " + toString(), ex);
}
return false;
}
@@ -158,11 +158,11 @@
}
catch (AttributeNotFoundException ex)
{
- m_logger.log(Logger.LOG_DEBUG, "FilterImpl: " + ex);
+ log(Logger.LOG_DEBUG, "FilterImpl: Attribute not found.", ex);
}
catch (EvaluationException ex)
{
- m_logger.log(Logger.LOG_ERROR, "FilterImpl: " + toString(), ex);
+ log(Logger.LOG_ERROR, "FilterImpl: " + toString(), ex);
}
return false;
}
@@ -176,11 +176,12 @@
}
catch (AttributeNotFoundException ex)
{
- m_logger.log(Logger.LOG_DEBUG, "FilterImpl: " + ex);
+ log(Logger.LOG_DEBUG, "FilterImpl: Attribute not found.", ex);
}
catch (EvaluationException ex)
{
- m_logger.log(Logger.LOG_ERROR, "FilterImpl: " + toString(), ex); }
+ log(Logger.LOG_ERROR, "FilterImpl: " + toString(), ex);
+ }
return false;
}
@@ -254,4 +255,16 @@
return m_map.get(name);
}
}
+
+ private void log(int flag, String msg, Throwable th)
+ {
+ if (m_logger == null)
+ {
+ System.out.println(msg + ": " + th);
+ }
+ else
+ {
+ m_logger.log(flag, msg, th);
+ }
+ }
}
\ No newline at end of file