karaf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jean-Baptiste Onofré (JIRA) <j...@apache.org>
Subject [jira] [Resolved] (KARAF-2531) NPE in log:tail after a log:clear
Date Fri, 25 Oct 2013 19:54:31 GMT

     [ https://issues.apache.org/jira/browse/KARAF-2531?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Jean-Baptiste Onofré resolved KARAF-2531.
-----------------------------------------

    Resolution: Duplicate
      Assignee: Jean-Baptiste Onofré

> NPE in log:tail after a log:clear
> ---------------------------------
>
>                 Key: KARAF-2531
>                 URL: https://issues.apache.org/jira/browse/KARAF-2531
>             Project: Karaf
>          Issue Type: Bug
>    Affects Versions: 2.3.3
>            Reporter: Jonathan Anstey
>            Assignee: Jean-Baptiste Onofré
>
> Get this sometimes when doing a log:tail after a log:clear:
> {code}
> Exception in thread "pool-36-thread-1" java.lang.NullPointerException
> 	at org.apache.karaf.shell.log.layout.PatternParser$DatePatternConverter.convert(PatternParser.java:428)
> 	at org.apache.karaf.shell.log.layout.PatternConverter.format(PatternConverter.java:61)
> 	at org.apache.karaf.shell.log.DisplayLog.display(DisplayLog.java:153)
> 	at org.apache.karaf.shell.log.LogTail$PrintEventThread.run(LogTail.java:80)
> 	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
> 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
> 	at java.lang.Thread.run(Thread.java:724)
> {code}
> It requires a simple guard that we do elsewhere in the log commands:
> {code}
> diff --git a/shell/log/src/main/java/org/apache/karaf/shell/log/LogTail.java b/shell/log/src/main/java/org/apache/karaf/shell/log/LogTail.java
> index 547c05d..4951984 100644
> --- a/shell/log/src/main/java/org/apache/karaf/shell/log/LogTail.java
> +++ b/shell/log/src/main/java/org/apache/karaf/shell/log/LogTail.java
> @@ -77,7 +77,9 @@ public class LogTail extends DisplayLog {
>  
>              Iterable<PaxLoggingEvent> le = events.getElements(entries == 0 ? Integer.MAX_VALUE
: entries);
>              for (PaxLoggingEvent event : le) {
> -                display(cnv, event, out);
> +                if (event != null) {
> +                    display(cnv, event, out);
> +                }
>              }
>              // Tail
>              final BlockingQueue<PaxLoggingEvent> queue = new LinkedBlockingQueue<PaxLoggingEvent>();
> {code}
> I'll push the commit once I get my karma set up.



--
This message was sent by Atlassian JIRA
(v6.1#6144)

Mime
View raw message