Native exception handling

This commit is contained in:
M66B 2016-01-10 17:10:52 +01:00
parent 5ebbf82ef3
commit 1dca134061
3 changed files with 17 additions and 13 deletions

View File

@ -98,6 +98,7 @@
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/manifests" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/objectFiles" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/pre-dexed" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/proguard-rules" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/res" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/rs" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/symbols" />

View File

@ -726,7 +726,6 @@ public class SinkholeService extends VpnService implements SharedPreferences.OnS
// Called from native code
private void logPacket(int version, String saddr, int sport, String daddr, int dport, int protocol, String flags, int uid) {
try {
new DatabaseHelper(SinkholeService.this).insertLog(
version,
daddr,
@ -736,9 +735,6 @@ public class SinkholeService extends VpnService implements SharedPreferences.OnS
uid,
(last_connected ? last_metered ? 2 : 1 : 0),
last_interactive).close();
} catch (Throwable ex) {
Log.e(TAG, ex.toString() + "\n" + Log.getStackTraceString(ex));
}
}
private void stopReceiving() {

View File

@ -155,6 +155,13 @@ void decode(JNIEnv *env, jobject instance, jbyte *buffer, int length) {
(*env)->DeleteLocalRef(env, jsource);
(*env)->DeleteLocalRef(env, jdest);
(*env)->DeleteLocalRef(env, jflags);
jthrowable ex = (*env)->ExceptionOccurred(env);
if (ex) {
(*env)->ExceptionDescribe(env);
(*env)->ExceptionClear(env);
(*env)->DeleteLocalRef(env, ex);
}
}
}