diff --git a/log/src/main/java/org/apache/felix/log/Activator.java b/log/src/main/java/org/apache/felix/log/Activator.java index e88d600f1b..506971ffb4 100644 --- a/log/src/main/java/org/apache/felix/log/Activator.java +++ b/log/src/main/java/org/apache/felix/log/Activator.java @@ -116,7 +116,7 @@ private static boolean getStoreDebug(final BundleContext context) String storeDebugPropValue = context.getProperty(STORE_DEBUG_PROPERTY); if (storeDebugPropValue != null) { - storeDebug = Boolean.valueOf(storeDebugPropValue).booleanValue(); + storeDebug = Boolean.parseBoolean(storeDebugPropValue); } return storeDebug; diff --git a/log/src/main/java/org/apache/felix/log/ConfigurationListenerImpl.java b/log/src/main/java/org/apache/felix/log/ConfigurationListenerImpl.java index 489cc74145..729f1b389f 100644 --- a/log/src/main/java/org/apache/felix/log/ConfigurationListenerImpl.java +++ b/log/src/main/java/org/apache/felix/log/ConfigurationListenerImpl.java @@ -52,7 +52,7 @@ public class ConfigurationListenerImpl { final Log m_log; final LoggerAdminImpl m_loggerAdmin; - public ConfigurationListenerImpl(final BundleContext context, final Log log, final LoggerAdminImpl loggerAdmin) throws Exception { + ConfigurationListenerImpl(final BundleContext context, final Log log, final LoggerAdminImpl loggerAdmin) throws Exception { m_context = context; m_log = log; m_loggerAdmin = loggerAdmin; diff --git a/log/src/main/java/org/apache/felix/log/FormatterLoggerImpl.java b/log/src/main/java/org/apache/felix/log/FormatterLoggerImpl.java index dda2667733..0ff256bf9d 100644 --- a/log/src/main/java/org/apache/felix/log/FormatterLoggerImpl.java +++ b/log/src/main/java/org/apache/felix/log/FormatterLoggerImpl.java @@ -26,12 +26,13 @@ public class FormatterLoggerImpl extends LoggerImpl implements FormatterLogger { - public FormatterLoggerImpl( + FormatterLoggerImpl( final String name, final Bundle bundle, final Log log, final LoggerAdminImpl loggerAdmin) { super(name, bundle, log, loggerAdmin); } + @Override String format(String format, LogParameters logParameters) { StringBuilder sb = new StringBuilder(); diff --git a/log/src/main/java/org/apache/felix/log/Log.java b/log/src/main/java/org/apache/felix/log/Log.java index a92f596f7c..4ab9610d05 100644 --- a/log/src/main/java/org/apache/felix/log/Log.java +++ b/log/src/main/java/org/apache/felix/log/Log.java @@ -206,7 +206,7 @@ synchronized Enumeration getEntries() "FrameworkEvent STARTED", "FrameworkEvent ERROR", "FrameworkEvent PACKAGES REFRESHED", - "FrameworkEvent STARTLEVEL CHANGED", + "FrameworkEvent STARTLEVEL CHANGED", "FrameworkEvent WARNING", "FrameworkEvent INFO" }; diff --git a/log/src/main/java/org/apache/felix/log/LogEntryImpl.java b/log/src/main/java/org/apache/felix/log/LogEntryImpl.java index 2d98b9298e..2198e97765 100644 --- a/log/src/main/java/org/apache/felix/log/LogEntryImpl.java +++ b/log/src/main/java/org/apache/felix/log/LogEntryImpl.java @@ -143,6 +143,7 @@ final class LogEntryImpl implements LogEntry * @return the bundle that created this LogEntry object;null if no * bundle is associated with this LogEntry object */ + @Override public Bundle getBundle() { return m_bundle; @@ -155,6 +156,7 @@ public Bundle getBundle() * this LogEntry object; null if no {@link ServiceReference} object * was provided */ + @Override public ServiceReference getServiceReference() { return m_serviceReference; @@ -171,6 +173,7 @@ public ServiceReference getServiceReference() * @see org.osgi.service.LogService#LOG_INFO * @see org.osgi.service.LogService#LOG_DEBUG */ + @Override public int getLevel() { if (m_legacyLevel != m_level.ordinal()) { @@ -184,6 +187,7 @@ public int getLevel() * Returns the human readable message associated with this LogEntry object. * @return a string containing the message associated with this LogEntry object */ + @Override public String getMessage() { return m_message; @@ -202,6 +206,7 @@ public String getMessage() * @return throwable object of the exception associated with this LogEntry; * null if no exception is associated with this LogEntry object */ + @Override public Throwable getException() { return m_exception; @@ -213,6 +218,7 @@ public Throwable getException() * @return the system time in milliseconds when this LogEntry object was created * @see System#currentTimeMillis() */ + @Override public long getTime() { return m_time; diff --git a/log/src/main/java/org/apache/felix/log/LogListenerThread.java b/log/src/main/java/org/apache/felix/log/LogListenerThread.java index 588f1e739a..34ee75ad7d 100644 --- a/log/src/main/java/org/apache/felix/log/LogListenerThread.java +++ b/log/src/main/java/org/apache/felix/log/LogListenerThread.java @@ -106,6 +106,7 @@ void shutdown() * The main method of the thread: waits for new messages to be receieved * and then delivers them to any registered log listeners. */ + @Override public void run() { while (!isInterrupted()) @@ -138,10 +139,10 @@ public void run() { // Take a snapshot of all current listeners and deliver all // pending messages to them... - List listeners = new ArrayList<>(); + List listeners; synchronized (m_listeners) { - listeners.addAll(m_listeners); + listeners = new ArrayList<>(m_listeners); } Iterator entriesIt = entriesToDeliver.iterator(); diff --git a/log/src/main/java/org/apache/felix/log/LogNodeEnumeration.java b/log/src/main/java/org/apache/felix/log/LogNodeEnumeration.java index 39f067e973..8560b71e5c 100644 --- a/log/src/main/java/org/apache/felix/log/LogNodeEnumeration.java +++ b/log/src/main/java/org/apache/felix/log/LogNodeEnumeration.java @@ -48,6 +48,7 @@ final class LogNodeEnumeration implements Enumeration * Determines whether there are any more elements to return. * @return true if there are more elements; false otherwise */ + @Override public boolean hasMoreElements() { return m_next != null; @@ -57,6 +58,7 @@ public boolean hasMoreElements() * Returns the current element and moves onto the next element. * @return the current element */ + @Override public LogEntry nextElement() { LogEntry result = null; diff --git a/log/src/main/java/org/apache/felix/log/LogReaderServiceFactory.java b/log/src/main/java/org/apache/felix/log/LogReaderServiceFactory.java index 12677ba35e..5193c66704 100644 --- a/log/src/main/java/org/apache/felix/log/LogReaderServiceFactory.java +++ b/log/src/main/java/org/apache/felix/log/LogReaderServiceFactory.java @@ -47,6 +47,7 @@ final class LogReaderServiceFactory implements ServiceFactory * @param registration the service registration * @return the log reader service implementation for the specified bundle */ + @Override public LogReaderService getService(final Bundle bundle, final ServiceRegistration registration) { @@ -60,6 +61,7 @@ public LogReaderService getService(final Bundle bundle, * @param registration the service registration * @param service the service to release */ + @Override public void ungetService(final Bundle bundle, final ServiceRegistration registration, final LogReaderService service) diff --git a/log/src/main/java/org/apache/felix/log/LogServiceFactory.java b/log/src/main/java/org/apache/felix/log/LogServiceFactory.java index 132f386b5d..210d1ee7ef 100644 --- a/log/src/main/java/org/apache/felix/log/LogServiceFactory.java +++ b/log/src/main/java/org/apache/felix/log/LogServiceFactory.java @@ -34,7 +34,7 @@ final class LogServiceFactory implements ServiceFactory /** * Create a new instance. - * @param log the log to associate the service implementations with., + * @param loggerAdminImpl */ LogServiceFactory(final LoggerAdminImpl loggerAdminImpl) { diff --git a/log/src/main/java/org/apache/felix/log/LogServiceImpl.java b/log/src/main/java/org/apache/felix/log/LogServiceImpl.java index a58e841825..da91eff19a 100644 --- a/log/src/main/java/org/apache/felix/log/LogServiceImpl.java +++ b/log/src/main/java/org/apache/felix/log/LogServiceImpl.java @@ -43,9 +43,8 @@ final class LogServiceImpl implements LogService /** * Create a new instance. - * @param log the log implementation * @param bundle the bundle associated with this implementation - * @param serviceReference + * @param loggerAdminImpl */ LogServiceImpl(final Bundle bundle, final LoggerAdminImpl loggerAdminImpl) { diff --git a/log/src/main/java/org/apache/felix/log/LoggerAdminImpl.java b/log/src/main/java/org/apache/felix/log/LoggerAdminImpl.java index 67857e9cc4..482192f216 100644 --- a/log/src/main/java/org/apache/felix/log/LoggerAdminImpl.java +++ b/log/src/main/java/org/apache/felix/log/LoggerAdminImpl.java @@ -44,7 +44,7 @@ public class LoggerAdminImpl implements LoggerAdmin { private final ConcurrentMap m_contexts = new ConcurrentHashMap<>(); private final ConcurrentMap _loggers = new ConcurrentHashMap<>(); - public LoggerAdminImpl(final String defaultLogLevelString, final Log log) { + LoggerAdminImpl(final String defaultLogLevelString, final Log log) { m_rootContext = new RootLoggerContextImpl(defaultLogLevelString, this); m_log = log; } diff --git a/log/src/main/java/org/apache/felix/log/LoggerContextImpl.java b/log/src/main/java/org/apache/felix/log/LoggerContextImpl.java index d26889e95d..36a9b206ad 100644 --- a/log/src/main/java/org/apache/felix/log/LoggerContextImpl.java +++ b/log/src/main/java/org/apache/felix/log/LoggerContextImpl.java @@ -47,17 +47,19 @@ public LoggerContextImpl(String name, LoggerAdminImpl loggerAdminImpl, LoggerCon _rootContext = rootLoggerContext; } + @Override public String getName() { return _name; } + @Override public LogLevel getEffectiveLogLevel(String name) { _lock.lock(); try { if (_levels != null && !_levels.isEmpty()) { String copy = name; LogLevel level; - while (copy.length() > 0) { + while (!copy.isEmpty()) { level = _levels.get(copy); if (level != null) { return level; @@ -74,6 +76,7 @@ public LogLevel getEffectiveLogLevel(String name) { } } + @Override public Map getLogLevels() { _lock.lock(); try { @@ -87,6 +90,7 @@ public Map getLogLevels() { } } + @Override public void setLogLevels(Map logLevels) { _lock.lock(); try { @@ -98,6 +102,7 @@ public void setLogLevels(Map logLevels) { } } + @Override public void clear() { _lock.lock(); try { @@ -108,6 +113,7 @@ public void clear() { } } + @Override public boolean isEmpty() { _lock.lock(); try { diff --git a/log/src/main/java/org/apache/felix/log/LoggerImpl.java b/log/src/main/java/org/apache/felix/log/LoggerImpl.java index a9879f1603..055bc50914 100644 --- a/log/src/main/java/org/apache/felix/log/LoggerImpl.java +++ b/log/src/main/java/org/apache/felix/log/LoggerImpl.java @@ -36,10 +36,10 @@ public class LoggerImpl implements Logger { protected final String m_name; protected final Bundle m_bundle; - protected final Log m_log; + final Log m_log; protected final LoggerAdminImpl m_loggerAdmin; - public LoggerImpl(final String name, final Bundle bundle, final Log log, final LoggerAdminImpl loggerAdmin) { + LoggerImpl(final String name, final Bundle bundle, final Log log, final LoggerAdminImpl loggerAdmin) { m_name = name; m_bundle = bundle; m_log = log; diff --git a/log/src/main/java/org/apache/felix/log/RootLoggerContextImpl.java b/log/src/main/java/org/apache/felix/log/RootLoggerContextImpl.java index 3ec792b2fd..11e8f5c64c 100644 --- a/log/src/main/java/org/apache/felix/log/RootLoggerContextImpl.java +++ b/log/src/main/java/org/apache/felix/log/RootLoggerContextImpl.java @@ -19,9 +19,6 @@ package org.apache.felix.log; -import java.util.Dictionary; -import java.util.Map; - import org.osgi.service.log.LogLevel; import org.osgi.service.log.Logger; @@ -45,12 +42,13 @@ public RootLoggerContextImpl(String defaultLogLevelString, LoggerAdminImpl logge _defaultLevel = defaultLogLevel; } + @Override public LogLevel getEffectiveLogLevel(String name) { _lock.lock(); try { if (_levels != null && !_levels.isEmpty()) { LogLevel level; - while (name.length() > 0) { + while (!name.isEmpty()) { level = _levels.get(name); if (level != null) { return level; @@ -67,16 +65,6 @@ public LogLevel getEffectiveLogLevel(String name) { } } - @Override - public void setLogLevels(Map logLevels) { - super.setLogLevels(logLevels); - } - - @Override - void updateLoggerContext(Dictionary properties) { - super.updateLoggerContext(properties); - } - private LogLevel getEffectiveRootLogLevel() { if (_levels == null) return _defaultLevel; LogLevel logLevel = _levels.get(Logger.ROOT_LOGGER_NAME);