From e1bcd435ad371863b7e6cf6baa57878bab7115d7 Mon Sep 17 00:00:00 2001 From: brutzman <brutzman@nps.edu> Date: Wed, 19 Jan 2022 17:45:03 -0800 Subject: [PATCH] try/catch in main --- .../moves/dis7/utilities/stream/PduPlayer.java | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/edu/nps/moves/dis7/utilities/stream/PduPlayer.java b/src/edu/nps/moves/dis7/utilities/stream/PduPlayer.java index 50c4b39ca8..1aa5a9a95e 100644 --- a/src/edu/nps/moves/dis7/utilities/stream/PduPlayer.java +++ b/src/edu/nps/moves/dis7/utilities/stream/PduPlayer.java @@ -491,7 +491,7 @@ public class PduPlayer { /** Test execution for debugging * @param args command-line arguments (unused) */ - public static void main(String[] args) throws IOException // TODO fix exception handling + public static void main(String[] args) { String DEFAULT_OUTPUT_DIRECTORY = "pduLog"; /** Default multicast group address we send on. @@ -504,9 +504,16 @@ public class PduPlayer { int multicastPort = DEFAULT_MULTICAST_PORT; boolean sendToNet = true; - // create instance of class in this static block - PduPlayer pduPlayer = new PduPlayer(multicastAddress, multicastPort, Path.of(outputDirectory), sendToNet); - // thread automatically starts up when class is instantiated - pduPlayer.begin(); // default is self test through all logs in ancestor pduLog subdirectory + try + { + // create instance of class in this static block + PduPlayer pduPlayer = new PduPlayer(multicastAddress, multicastPort, Path.of(outputDirectory), sendToNet); + // thread automatically starts up when class is instantiated + pduPlayer.begin(); // default is self test through all logs in ancestor pduLog subdirectory + } + catch (IOException ioe) + { + System.out.println("PduPlayer exception in main(): " + ioe.getMessage()); + } } } -- GitLab