FELIX-1622 Prevent NullPointerException if no LogReaderService is
installed.
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@817183 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/webconsole/src/main/java/org/apache/felix/webconsole/internal/compendium/LogServlet.java b/webconsole/src/main/java/org/apache/felix/webconsole/internal/compendium/LogServlet.java
index b5afd09..98bb6ce 100644
--- a/webconsole/src/main/java/org/apache/felix/webconsole/internal/compendium/LogServlet.java
+++ b/webconsole/src/main/java/org/apache/felix/webconsole/internal/compendium/LogServlet.java
@@ -98,13 +98,17 @@
jw.key( "data" );
jw.array();
- int index = 0;
- for ( Enumeration logEntries = logReaderService.getLog(); logEntries.hasMoreElements() && index < MAX_LOGS; )
+ if ( logReaderService != null )
{
- LogEntry nextLog = ( LogEntry ) logEntries.nextElement();
- if ( nextLog.getLevel() <= minLogLevel )
+ int index = 0;
+ for ( Enumeration logEntries = logReaderService.getLog(); logEntries.hasMoreElements()
+ && index < MAX_LOGS; )
{
- logJson( jw, nextLog, index++ );
+ LogEntry nextLog = ( LogEntry ) logEntries.nextElement();
+ if ( nextLog.getLevel() <= minLogLevel )
+ {
+ logJson( jw, nextLog, index++ );
+ }
}
}