Avoid System.exit

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/net/trunk@1788537 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/src/main/java/examples/ftp/TFTPExample.java b/src/main/java/examples/ftp/TFTPExample.java
index 6775d6a..b4b4782 100644
--- a/src/main/java/examples/ftp/TFTPExample.java
+++ b/src/main/java/examples/ftp/TFTPExample.java
@@ -163,9 +163,7 @@
         catch (IOException e)
         {
             tftp.close();
-            System.err.println("Error: could not open local file for reading.");
-            System.err.println(e.getMessage());
-            System.exit(1);
+            throw new RuntimeException("Error: could not open local file for reading.", e);
         }
 
         open(tftp);
@@ -213,7 +211,7 @@
         if (file.exists())
         {
             System.err.println("Error: " + localFilename + " already exists.");
-            System.exit(1);
+            return false;
         }
 
         // Try to open local file for writing
@@ -224,9 +222,7 @@
         catch (IOException e)
         {
             tftp.close();
-            System.err.println("Error: could not open local file for writing.");
-            System.err.println(e.getMessage());
-            System.exit(1);
+            throw new RuntimeException("Error: could not open local file for writing.", e);
         }
 
         open(tftp);
@@ -289,9 +285,7 @@
         }
         catch (SocketException e)
         {
-            System.err.println("Error: could not open local UDP socket.");
-            System.err.println(e.getMessage());
-            System.exit(1);
+            throw new RuntimeException("Error: could not open local UDP socket.", e);
         }
     }