From 437f6801ec7f78ac4857d1640b3f4f856b33cd15 Mon Sep 17 00:00:00 2001 From: bootswithdefer Date: Fri, 12 Nov 2010 12:15:56 -0700 Subject: [PATCH] error checking --- LogBlock.java | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/LogBlock.java b/LogBlock.java index d00322f..3871298 100755 --- a/LogBlock.java +++ b/LogBlock.java @@ -62,7 +62,8 @@ public class LogBlock extends Plugin public void disable() { - consumer.stop(); + if (consumer != null) + consumer.stop(); consumer = null; log.info(name + " v" + version + " Plugin Disabled."); } @@ -126,8 +127,10 @@ public class LogBlock extends Plugin log.log(Level.SEVERE, name + " SQL exception", ex); } finally { try { - rs.close(); - ps.close(); + if (rs != null) + rs.close(); + if (ps != null) + ps.close(); conn.close(); } catch (SQLException ex) { log.log(Level.SEVERE, name + " SQL exception on close", ex); @@ -189,8 +192,10 @@ public class LogBlock extends Plugin log.log(Level.SEVERE, name + " SQL exception", ex); } finally { try { - rs.close(); - ps.close(); + if (rs != null) + rs.close(); + if (ps != null) + ps.close(); conn.close(); } catch (SQLException ex) { log.log(Level.SEVERE, name + " SQL exception on close", ex); @@ -274,8 +279,10 @@ public class LogBlock extends Plugin log.log(Level.SEVERE, name + " SQL exception", ex); } finally { try { - rs.close(); - ps.close(); + if (rs != null) + rs.close(); + if (ps != null) + ps.close(); conn.close(); } catch (SQLException ex) { log.log(Level.SEVERE, name + " SQL exception on close", ex); @@ -345,8 +352,10 @@ public class LogBlock extends Plugin log.log(Level.SEVERE, name + " SQL exception", ex); } finally { try { - rs.close(); - ps.close(); + if (rs != null) + rs.close(); + if (ps != null) + ps.close(); conn.close(); } catch (SQLException ex) { log.log(Level.SEVERE, name + " SQL exception on close", ex);