mirror of
https://github.com/nerzhul/ownCloud-SMS-App.git
synced 2025-06-08 08:26:09 +00:00
Remove a useless try/catch
This commit is contained in:
parent
0407f719ef
commit
56eecb98bc
@ -48,18 +48,13 @@ public class AndroidSmsFetcher {
|
|||||||
do {
|
do {
|
||||||
SmsEntry entry = new SmsEntry();
|
SmsEntry entry = new SmsEntry();
|
||||||
|
|
||||||
try {
|
for (int idx = 0; idx < c.getColumnCount(); idx++) {
|
||||||
for (int idx = 0; idx < c.getColumnCount(); idx++) {
|
handleProviderColumn(c, idx, entry);
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Mailbox ID is required by server
|
||||||
|
entry.mailboxId = mbID.ordinal();
|
||||||
|
smsBuffer.push(mbID, entry);
|
||||||
}
|
}
|
||||||
while (c.moveToNext());
|
while (c.moveToNext());
|
||||||
}
|
}
|
||||||
@ -106,26 +101,22 @@ public class AndroidSmsFetcher {
|
|||||||
SmsEntry entry = new SmsEntry();
|
SmsEntry entry = new SmsEntry();
|
||||||
SmsBuffer results = new SmsBuffer();
|
SmsBuffer results = new SmsBuffer();
|
||||||
|
|
||||||
try {
|
Integer mboxId = -1;
|
||||||
Integer mboxId = -1;
|
for (int idx = 0; idx < c.getColumnCount(); idx++) {
|
||||||
for (int idx = 0; idx < c.getColumnCount(); idx++) {
|
Integer rid = handleProviderColumn(c, idx, entry);
|
||||||
Integer rid = handleProviderColumn(c, idx, entry);
|
if (rid != -1) {
|
||||||
if (rid != -1) {
|
mboxId = rid;
|
||||||
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();
|
c.close();
|
||||||
|
|
||||||
return results;
|
return results;
|
||||||
@ -160,7 +151,7 @@ public class AndroidSmsFetcher {
|
|||||||
c.close();
|
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);
|
String colName = c.getColumnName(idx);
|
||||||
|
|
||||||
// Id column is must be an integer
|
// Id column is must be an integer
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
package fr.unix_experience.owncloud_sms.jni;
|
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.engine.SmsEntry;
|
||||||
import fr.unix_experience.owncloud_sms.enums.MailboxID;
|
import fr.unix_experience.owncloud_sms.enums.MailboxID;
|
||||||
|
|
||||||
@ -48,7 +46,7 @@ public class SmsBuffer {
|
|||||||
public native void print();
|
public native void print();
|
||||||
public native String asRawJsonString();
|
public native String asRawJsonString();
|
||||||
|
|
||||||
public void push(MailboxID mbid, SmsEntry smsEntry) throws JSONException {
|
public void push(MailboxID mbid, SmsEntry smsEntry) {
|
||||||
push(smsEntry.id,
|
push(smsEntry.id,
|
||||||
mbid.ordinal(),
|
mbid.ordinal(),
|
||||||
smsEntry.type,
|
smsEntry.type,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user