From b0a3c717d21ffc0c17aa123c171cce29e01d2884 Mon Sep 17 00:00:00 2001 From: iNPUTmice Date: Wed, 25 Jun 2014 17:06:20 +0200 Subject: wrap wakelock release with try catch --- src/eu/siacs/conversations/services/XmppConnectionService.java | 2 +- src/eu/siacs/conversations/xml/XmlReader.java | 4 ++-- src/eu/siacs/conversations/xmpp/XmppConnection.java | 8 ++++---- 3 files changed, 7 insertions(+), 7 deletions(-) (limited to 'src/eu/siacs') diff --git a/src/eu/siacs/conversations/services/XmppConnectionService.java b/src/eu/siacs/conversations/services/XmppConnectionService.java index 6e36c9bcf..f4691fab9 100644 --- a/src/eu/siacs/conversations/services/XmppConnectionService.java +++ b/src/eu/siacs/conversations/services/XmppConnectionService.java @@ -510,7 +510,7 @@ public class XmppConnectionService extends Service { } } if (wakeLock.isHeld()) { - wakeLock.release(); + try { wakeLock.release();} catch (RuntimeException re) {} } return START_STICKY; } diff --git a/src/eu/siacs/conversations/xml/XmlReader.java b/src/eu/siacs/conversations/xml/XmlReader.java index b4b1647ef..01a9e2d84 100644 --- a/src/eu/siacs/conversations/xml/XmlReader.java +++ b/src/eu/siacs/conversations/xml/XmlReader.java @@ -51,7 +51,7 @@ public class XmlReader { public Tag readTag() throws XmlPullParserException, IOException { if (wakeLock.isHeld()) { - wakeLock.release(); + try { wakeLock.release();} catch (RuntimeException re) {} } try { while(parser.next() != XmlPullParser.END_DOCUMENT) { @@ -75,7 +75,7 @@ public class XmlReader { } } if (wakeLock.isHeld()) { - wakeLock.release(); + try { wakeLock.release();} catch (RuntimeException re) {} } } catch (ArrayIndexOutOfBoundsException e) { throw new IOException("xml parser mishandled ArrayIndexOufOfBounds", e); diff --git a/src/eu/siacs/conversations/xmpp/XmppConnection.java b/src/eu/siacs/conversations/xmpp/XmppConnection.java index 2447b49bd..4fc64590a 100644 --- a/src/eu/siacs/conversations/xmpp/XmppConnection.java +++ b/src/eu/siacs/conversations/xmpp/XmppConnection.java @@ -183,7 +183,7 @@ public class XmppConnection implements Runnable { } catch (UnknownHostException e) { this.changeStatus(Account.STATUS_SERVER_NOT_FOUND); if (wakeLock.isHeld()) { - wakeLock.release(); + try { wakeLock.release();} catch (RuntimeException re) {} } return; } catch (IOException e) { @@ -191,21 +191,21 @@ public class XmppConnection implements Runnable { this.changeStatus(Account.STATUS_OFFLINE); } if (wakeLock.isHeld()) { - wakeLock.release(); + try { wakeLock.release();} catch (RuntimeException re) {} } return; } catch (NoSuchAlgorithmException e) { this.changeStatus(Account.STATUS_OFFLINE); Log.d(LOGTAG, "compression exception " + e.getMessage()); if (wakeLock.isHeld()) { - wakeLock.release(); + try { wakeLock.release();} catch (RuntimeException re) {} } return; } catch (XmlPullParserException e) { this.changeStatus(Account.STATUS_OFFLINE); Log.d(LOGTAG, "xml exception " + e.getMessage()); if (wakeLock.isHeld()) { - wakeLock.release(); + try { wakeLock.release();} catch (RuntimeException re) {} } return; } -- cgit v1.2.3