diff --git a/src/com/annimon/turrets/GameCanvas.java b/src/com/annimon/turrets/GameCanvas.java index 7acc827..2b20891 100644 --- a/src/com/annimon/turrets/GameCanvas.java +++ b/src/com/annimon/turrets/GameCanvas.java @@ -7,6 +7,7 @@ import com.annimon.turrets.network.GameClient; import com.annimon.turrets.network.GameServer; import com.annimon.turrets.network.NetworkListener; import com.annimon.turrets.network.SocketHelper; +import com.annimon.turrets.util.ExceptionHandler; import com.annimon.turrets.util.Util; import java.awt.Color; import java.awt.Font; @@ -128,6 +129,7 @@ public class GameCanvas extends DoubleBufferedCanvas implements Runnable, Networ } socketHelper.start(); } catch (IOException ex) { + ExceptionHandler.handle(ex); } } diff --git a/src/com/annimon/turrets/Sound.java b/src/com/annimon/turrets/Sound.java index cac4f47..58c7696 100644 --- a/src/com/annimon/turrets/Sound.java +++ b/src/com/annimon/turrets/Sound.java @@ -1,5 +1,6 @@ package com.annimon.turrets; +import com.annimon.turrets.util.ExceptionHandler; import java.io.IOException; import java.net.URL; import javax.sound.sampled.AudioInputStream; @@ -37,7 +38,7 @@ public enum Sound { clip.open(ais); } } catch (IOException | UnsupportedAudioFileException | LineUnavailableException ex) { - ex.printStackTrace(); + ExceptionHandler.handle(ex); } return clip; } diff --git a/src/com/annimon/turrets/network/SocketHelper.java b/src/com/annimon/turrets/network/SocketHelper.java index c15f897..6b8a464 100644 --- a/src/com/annimon/turrets/network/SocketHelper.java +++ b/src/com/annimon/turrets/network/SocketHelper.java @@ -1,6 +1,7 @@ package com.annimon.turrets.network; import com.annimon.turrets.Turret.TurretInfo; +import com.annimon.turrets.util.ExceptionHandler; import java.io.DataInputStream; import java.io.DataOutputStream; import java.io.IOException; @@ -41,6 +42,7 @@ public class SocketHelper extends Thread { break; } } catch (IOException ex) { + ExceptionHandler.handle(ex); listener.onStatusChanged(NetworkListener.ON_DISCONNECT, null); } try { @@ -53,7 +55,9 @@ public class SocketHelper extends Thread { try { dos.writeInt(NetworkListener.ON_SEED_RECEIVED); dos.writeLong(seed); - } catch (IOException ex) {} + } catch (IOException ex) { + ExceptionHandler.handle(ex); + } } private long receiveSeed() throws IOException { @@ -67,7 +71,9 @@ public class SocketHelper extends Thread { dos.writeDouble(info.shotPower); dos.writeInt(info.barrelX); dos.writeInt(info.barrelY); - } catch (IOException ex) { } + } catch (IOException ex) { + ExceptionHandler.handle(ex); + } } private TurretInfo receiveMove() throws IOException { @@ -83,7 +89,9 @@ public class SocketHelper extends Thread { try { dos.writeInt(NetworkListener.ON_NEW_ROUND); dos.writeLong(seed); - } catch (IOException ex) {} + } catch (IOException ex) { + ExceptionHandler.handle(ex); + } } public void close() throws IOException {