Author: nextgens
Date: 2007-03-24 12:12:24 +0000 (Sat, 24 Mar 2007)
New Revision: 12303

Modified:
   trunk/freenet/src/freenet/client/StandardOnionFECCodec.java
Log:
doh

Modified: trunk/freenet/src/freenet/client/StandardOnionFECCodec.java
===================================================================
--- trunk/freenet/src/freenet/client/StandardOnionFECCodec.java 2007-03-24 
12:02:47 UTC (rev 12302)
+++ trunk/freenet/src/freenet/client/StandardOnionFECCodec.java 2007-03-24 
12:12:24 UTC (rev 12303)
@@ -7,6 +7,7 @@
 import java.io.IOException;
 import java.io.OutputStream;
 import java.util.LinkedList;
+import java.util.NoSuchElementException;

 import com.onionnetworks.fec.FECCode;
 import com.onionnetworks.fec.Native8Code;
@@ -523,12 +524,12 @@
                public void run(){
                        while(true){
                                FECJob job = null;
-                               // Get a job
-                               synchronized (_awaitingJobs) {
-                                       job = (FECJob) 
_awaitingJobs.removeLast();
-                               }
+                               try {
+                                       // Get a job
+                                       synchronized (_awaitingJobs) {
+                                               job = (FECJob) 
_awaitingJobs.removeLast();
+                                       }

-                               if(job != null){
                                        // Encode it
                                        try {
                                                if(job.isADecodingJob)
@@ -558,7 +559,7 @@
                                        } catch (Throwable e) {
                                                Logger.error(this, "The 
callback failed!" + e.getMessage());
                                        }
-                               } else {
+                               } catch (NoSuchElementException ne) {
                                        try {
                                                synchronized (this) {
                                                        
wait(Integer.MAX_VALUE);        


Reply via email to