wrap wakelock release with try catch

This commit is contained in:
iNPUTmice 2014-06-25 17:06:20 +02:00
parent dfbc42ecd7
commit b0a3c717d2
3 changed files with 7 additions and 7 deletions

View File

@ -510,7 +510,7 @@ public class XmppConnectionService extends Service {
} }
} }
if (wakeLock.isHeld()) { if (wakeLock.isHeld()) {
wakeLock.release(); try { wakeLock.release();} catch (RuntimeException re) {}
} }
return START_STICKY; return START_STICKY;
} }

View File

@ -51,7 +51,7 @@ public class XmlReader {
public Tag readTag() throws XmlPullParserException, IOException { public Tag readTag() throws XmlPullParserException, IOException {
if (wakeLock.isHeld()) { if (wakeLock.isHeld()) {
wakeLock.release(); try { wakeLock.release();} catch (RuntimeException re) {}
} }
try { try {
while(parser.next() != XmlPullParser.END_DOCUMENT) { while(parser.next() != XmlPullParser.END_DOCUMENT) {
@ -75,7 +75,7 @@ public class XmlReader {
} }
} }
if (wakeLock.isHeld()) { if (wakeLock.isHeld()) {
wakeLock.release(); try { wakeLock.release();} catch (RuntimeException re) {}
} }
} catch (ArrayIndexOutOfBoundsException e) { } catch (ArrayIndexOutOfBoundsException e) {
throw new IOException("xml parser mishandled ArrayIndexOufOfBounds", e); throw new IOException("xml parser mishandled ArrayIndexOufOfBounds", e);

View File

@ -183,7 +183,7 @@ public class XmppConnection implements Runnable {
} catch (UnknownHostException e) { } catch (UnknownHostException e) {
this.changeStatus(Account.STATUS_SERVER_NOT_FOUND); this.changeStatus(Account.STATUS_SERVER_NOT_FOUND);
if (wakeLock.isHeld()) { if (wakeLock.isHeld()) {
wakeLock.release(); try { wakeLock.release();} catch (RuntimeException re) {}
} }
return; return;
} catch (IOException e) { } catch (IOException e) {
@ -191,21 +191,21 @@ public class XmppConnection implements Runnable {
this.changeStatus(Account.STATUS_OFFLINE); this.changeStatus(Account.STATUS_OFFLINE);
} }
if (wakeLock.isHeld()) { if (wakeLock.isHeld()) {
wakeLock.release(); try { wakeLock.release();} catch (RuntimeException re) {}
} }
return; return;
} catch (NoSuchAlgorithmException e) { } catch (NoSuchAlgorithmException e) {
this.changeStatus(Account.STATUS_OFFLINE); this.changeStatus(Account.STATUS_OFFLINE);
Log.d(LOGTAG, "compression exception " + e.getMessage()); Log.d(LOGTAG, "compression exception " + e.getMessage());
if (wakeLock.isHeld()) { if (wakeLock.isHeld()) {
wakeLock.release(); try { wakeLock.release();} catch (RuntimeException re) {}
} }
return; return;
} catch (XmlPullParserException e) { } catch (XmlPullParserException e) {
this.changeStatus(Account.STATUS_OFFLINE); this.changeStatus(Account.STATUS_OFFLINE);
Log.d(LOGTAG, "xml exception " + e.getMessage()); Log.d(LOGTAG, "xml exception " + e.getMessage());
if (wakeLock.isHeld()) { if (wakeLock.isHeld()) {
wakeLock.release(); try { wakeLock.release();} catch (RuntimeException re) {}
} }
return; return;
} }