| OLD | NEW | 
|---|
| 1 /* | 1 /* | 
| 2  * This file is part of Adblock Plus <http://adblockplus.org/>, | 2  * This file is part of Adblock Plus <http://adblockplus.org/>, | 
| 3  * Copyright (C) 2006-2014 Eyeo GmbH | 3  * Copyright (C) 2006-2014 Eyeo GmbH | 
| 4  * | 4  * | 
| 5  * Adblock Plus is free software: you can redistribute it and/or modify | 5  * Adblock Plus is free software: you can redistribute it and/or modify | 
| 6  * it under the terms of the GNU General Public License version 3 as | 6  * it under the terms of the GNU General Public License version 3 as | 
| 7  * published by the Free Software Foundation. | 7  * published by the Free Software Foundation. | 
| 8  * | 8  * | 
| 9  * Adblock Plus is distributed in the hope that it will be useful, | 9  * Adblock Plus is distributed in the hope that it will be useful, | 
| 10  * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10  * but WITHOUT ANY WARRANTY; without even the implied warranty of | 
| 11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 
| 12  * GNU General Public License for more details. | 12  * GNU General Public License for more details. | 
| 13  * | 13  * | 
| 14  * You should have received a copy of the GNU General Public License | 14  * You should have received a copy of the GNU General Public License | 
| 15  * along with Adblock Plus.  If not, see <http://www.gnu.org/licenses/>. | 15  * along with Adblock Plus.  If not, see <http://www.gnu.org/licenses/>. | 
| 16  */ | 16  */ | 
| 17 | 17 | 
| 18 package org.adblockplus.libadblockplus; | 18 package org.adblockplus.libadblockplus; | 
| 19 | 19 | 
| 20 import java.util.concurrent.LinkedBlockingQueue; | 20 import java.util.concurrent.LinkedBlockingQueue; | 
| 21 | 21 | 
|  | 22 import org.adblockplus.android.Utils; | 
|  | 23 | 
|  | 24 import android.util.Log; | 
|  | 25 | 
| 22 public final class JniExceptionHandler | 26 public final class JniExceptionHandler | 
| 23 { | 27 { | 
|  | 28   private final static String TAG = Utils.getTag(JniExceptionHandler.class); | 
|  | 29 | 
| 24   private static LogWorker logWorker = null; | 30   private static LogWorker logWorker = null; | 
| 25 | 31 | 
| 26   static | 32   static | 
| 27   { | 33   { | 
| 28     logWorker = new LogWorker(); | 34     logWorker = new LogWorker(); | 
| 29     final Thread t = new Thread(logWorker); | 35     final Thread t = new Thread(logWorker); | 
| 30     t.setDaemon(true); | 36     t.setDaemon(true); | 
| 31     t.start(); | 37     t.start(); | 
| 32   } | 38   } | 
| 33 | 39 | 
| (...skipping 12 matching lines...) Expand all  Loading... | 
| 46     } | 52     } | 
| 47 | 53 | 
| 48     @Override | 54     @Override | 
| 49     public void run() | 55     public void run() | 
| 50     { | 56     { | 
| 51       for (;;) | 57       for (;;) | 
| 52       { | 58       { | 
| 53         try | 59         try | 
| 54         { | 60         { | 
| 55           final Throwable t = this.exceptionQueue.take(); | 61           final Throwable t = this.exceptionQueue.take(); | 
| 56           // TODO: We need a log callback | 62           Log.e(TAG, "Exception from JNI", t); | 
| 57           System.err.println("EXCEPTION: " + t); |  | 
| 58         } | 63         } | 
| 59         catch (final InterruptedException ie) | 64         catch (final InterruptedException ie) | 
| 60         { | 65         { | 
| 61           break; | 66           break; | 
| 62         } | 67         } | 
| 63         catch (final Throwable ex) | 68         catch (final Throwable ex) | 
| 64         { | 69         { | 
| 65           // TODO: Swallow or log? | 70           // TODO: Swallow or log? | 
| 66         } | 71         } | 
| 67       } | 72       } | 
| 68     } | 73     } | 
| 69   } | 74   } | 
| 70 } | 75 } | 
| OLD | NEW | 
|---|