1
0
mirror of https://github.com/nerzhul/ownCloud-SMS-App.git synced 2025-06-07 16:06:18 +00:00

Remove a useless try/catch

This commit is contained in:
Loic Blot 2017-09-04 22:28:42 +02:00
parent 0407f719ef
commit 56eecb98bc
No known key found for this signature in database
GPG Key ID: EFAA458E8C153987
2 changed files with 21 additions and 32 deletions

View File

@ -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

View File

@ -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,