You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by re...@apache.org on 2014/03/04 19:03:41 UTC

svn commit: r1574162 - /tomcat/trunk/java/org/apache/tomcat/util/threads/TaskQueue.java

Author: remm
Date: Tue Mar  4 18:03:41 2014
New Revision: 1574162

URL: http://svn.apache.org/r1574162
Log:
Avoid possible NPE (it really needs to throw a rejected execution instead anyway).

Modified:
    tomcat/trunk/java/org/apache/tomcat/util/threads/TaskQueue.java

Modified: tomcat/trunk/java/org/apache/tomcat/util/threads/TaskQueue.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/threads/TaskQueue.java?rev=1574162&r1=1574161&r2=1574162&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/threads/TaskQueue.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/threads/TaskQueue.java Tue Mar  4 18:03:41 2014
@@ -55,12 +55,12 @@ public class TaskQueue extends LinkedBlo
     }
 
     public boolean force(Runnable o) {
-        if ( parent.isShutdown() ) throw new RejectedExecutionException("Executor not running, can't force a command into the queue");
+        if ( parent==null || parent.isShutdown() ) throw new RejectedExecutionException("Executor not running, can't force a command into the queue");
         return super.offer(o); //forces the item onto the queue, to be used if the task is rejected
     }
 
     public boolean force(Runnable o, long timeout, TimeUnit unit) throws InterruptedException {
-        if ( parent.isShutdown() ) throw new RejectedExecutionException("Executor not running, can't force a command into the queue");
+        if ( parent==null || parent.isShutdown() ) throw new RejectedExecutionException("Executor not running, can't force a command into the queue");
         return super.offer(o,timeout,unit); //forces the item onto the queue, to be used if the task is rejected
     }
 



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org