diff --git a/src/main/java/fr/unix_experience/owncloud_sms/engine/AndroidSmsFetcher.java b/src/main/java/fr/unix_experience/owncloud_sms/engine/AndroidSmsFetcher.java index a00a1c6..2e93ed1 100644 --- a/src/main/java/fr/unix_experience/owncloud_sms/engine/AndroidSmsFetcher.java +++ b/src/main/java/fr/unix_experience/owncloud_sms/engine/AndroidSmsFetcher.java @@ -48,18 +48,13 @@ public class AndroidSmsFetcher { do { SmsEntry entry = new SmsEntry(); - try { - for (int idx = 0; idx < c.getColumnCount(); idx++) { - handleProviderColumn(c, idx, entry); - } - - // Mailbox ID is required by server - entry.mailboxId = mbID.ordinal(); - smsBuffer.push(mbID, entry); - - } catch (JSONException e) { - Log.e(AndroidSmsFetcher.TAG, "JSON Exception when reading SMS Mailbox", e); + for (int idx = 0; idx < c.getColumnCount(); idx++) { + handleProviderColumn(c, idx, entry); } + + // Mailbox ID is required by server + entry.mailboxId = mbID.ordinal(); + smsBuffer.push(mbID, entry); } while (c.moveToNext()); } @@ -106,26 +101,22 @@ public class AndroidSmsFetcher { SmsEntry entry = new SmsEntry(); SmsBuffer results = new SmsBuffer(); - try { - Integer mboxId = -1; - for (int idx = 0; idx < c.getColumnCount(); idx++) { - Integer rid = handleProviderColumn(c, idx, entry); - if (rid != -1) { - mboxId = rid; - } + Integer mboxId = -1; + for (int idx = 0; idx < c.getColumnCount(); idx++) { + Integer rid = handleProviderColumn(c, idx, entry); + if (rid != -1) { + mboxId = rid; } - - /* - * Mailbox ID is required by server - * mboxId is greater than server mboxId by 1 because types - * aren't indexed in the same mean - */ - entry.mailboxId = mboxId - 1; - results.push(mbID, entry); - } catch (JSONException e) { - Log.e(AndroidSmsFetcher.TAG, "JSON Exception when reading SMS Mailbox", e); } + /* + * Mailbox ID is required by server + * mboxId is greater than server mboxId by 1 because types + * aren't indexed in the same mean + */ + entry.mailboxId = mboxId - 1; + results.push(mbID, entry); + c.close(); return results; @@ -160,7 +151,7 @@ public class AndroidSmsFetcher { c.close(); } - private Integer handleProviderColumn(Cursor c, int idx, SmsEntry entry) throws JSONException { + private Integer handleProviderColumn(Cursor c, int idx, SmsEntry entry) { String colName = c.getColumnName(idx); // Id column is must be an integer diff --git a/src/main/java/fr/unix_experience/owncloud_sms/jni/SmsBuffer.java b/src/main/java/fr/unix_experience/owncloud_sms/jni/SmsBuffer.java index dd82f65..ebceffe 100644 --- a/src/main/java/fr/unix_experience/owncloud_sms/jni/SmsBuffer.java +++ b/src/main/java/fr/unix_experience/owncloud_sms/jni/SmsBuffer.java @@ -1,7 +1,5 @@ package fr.unix_experience.owncloud_sms.jni; -import org.json.JSONException; - import fr.unix_experience.owncloud_sms.engine.SmsEntry; import fr.unix_experience.owncloud_sms.enums.MailboxID; @@ -48,7 +46,7 @@ public class SmsBuffer { public native void print(); public native String asRawJsonString(); - public void push(MailboxID mbid, SmsEntry smsEntry) throws JSONException { + public void push(MailboxID mbid, SmsEntry smsEntry) { push(smsEntry.id, mbid.ordinal(), smsEntry.type,