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-2013 Eyeo GmbH | 3 * Copyright (C) 2006-2013 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 #include <AdblockPlus.h> | 18 #include <AdblockPlus.h> |
19 #include "AndroidWebRequest.h" | 19 #include "AndroidWebRequest.h" |
20 #include "Utils.h" | 20 #include "Utils.h" |
21 #include "debug.h" | 21 #include "Debug.h" |
22 | 22 |
23 namespace | 23 namespace |
24 { | 24 { |
25 std::string ExtractExceptionMessage(JNIEnv* env, jthrowable throwable) | 25 std::string ExtractExceptionMessage(JNIEnv* env, jthrowable throwable) |
26 { | 26 { |
27 jclass throwableClass = env->FindClass("java/lang/Throwable"); | 27 jclass throwableClass = env->FindClass("java/lang/Throwable"); |
28 jmethodID throwableToStringMethodId = env->GetMethodID(throwableClass, "toSt
ring", "()Ljava/lang/String;"); | 28 jmethodID throwableToStringMethodId = env->GetMethodID(throwableClass, "toSt
ring", "()Ljava/lang/String;"); |
29 jstring javaMessage = static_cast<jstring>(env->CallObjectMethod(throwable,
throwableToStringMethodId)); | 29 jstring javaMessage = static_cast<jstring>(env->CallObjectMethod(throwable,
throwableToStringMethodId)); |
30 return "Java exception: " + GetString(env, javaMessage); | 30 return "Java exception: " + GetString(env, javaMessage); |
31 } | 31 } |
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
314 { | 314 { |
315 D(D_ERROR, "Unknown exception"); | 315 D(D_ERROR, "Unknown exception"); |
316 result.status = AdblockPlus::DefaultWebRequest::NS_ERROR_FAILURE; | 316 result.status = AdblockPlus::DefaultWebRequest::NS_ERROR_FAILURE; |
317 } | 317 } |
318 | 318 |
319 if (stat == JNI_EDETACHED) | 319 if (stat == JNI_EDETACHED) |
320 globalJvm->DetachCurrentThread(); | 320 globalJvm->DetachCurrentThread(); |
321 | 321 |
322 return result; | 322 return result; |
323 } | 323 } |
OLD | NEW |