Author: sebb
Date: Fri Mar 11 17:55:51 2011
New Revision: 1080704

URL: http://svn.apache.org/viewvc?rev=1080704&view=rev
Log:
Use specific Exception (Findbugs)

Modified:
    
commons/proper/net/trunk/src/main/java/examples/telnet/TelnetClientExample.java

Modified: 
commons/proper/net/trunk/src/main/java/examples/telnet/TelnetClientExample.java
URL: 
http://svn.apache.org/viewvc/commons/proper/net/trunk/src/main/java/examples/telnet/TelnetClientExample.java?rev=1080704&r1=1080703&r2=1080704&view=diff
==============================================================================
--- 
commons/proper/net/trunk/src/main/java/examples/telnet/TelnetClientExample.java 
(original)
+++ 
commons/proper/net/trunk/src/main/java/examples/telnet/TelnetClientExample.java 
Fri Mar 11 17:55:51 2011
@@ -81,7 +81,7 @@ public class TelnetClientExample impleme
         {
             fout = new FileOutputStream ("spy.log", true);
         }
-        catch (Exception e)
+        catch (IOException e)
         {
             System.err.println(
                 "Exception while opening the spy file: "
@@ -144,7 +144,7 @@ public class TelnetClientExample impleme
 
                                     System.out.println("AYT response:" + 
tc.sendAYT(5000));
                                 }
-                                catch (Exception e)
+                                catch (IOException e)
                                 {
                                     System.err.println("Exception waiting AYT 
response: " + e.getMessage());
                                 }
@@ -210,14 +210,7 @@ public class TelnetClientExample impleme
                             }
                             else if((new String(buff, 0, 
ret_read)).startsWith("SPY"))
                             {
-                                try
-                                {
-                                    tc.registerSpyStream(fout);
-                                }
-                                catch (Exception e)
-                                {
-                                    System.err.println("Error registering the 
spy");
-                                }
+                                tc.registerSpyStream(fout);
                             }
                             else if((new String(buff, 0, 
ret_read)).startsWith("UNSPY"))
                             {
@@ -230,7 +223,7 @@ public class TelnetClientExample impleme
                                         outstr.write(buff, 0 , ret_read);
                                         outstr.flush();
                                 }
-                                catch (Exception e)
+                                catch (IOException e)
                                 {
                                         end_loop = true;
                                 }
@@ -249,12 +242,12 @@ public class TelnetClientExample impleme
                 {
                     tc.disconnect();
                 }
-                catch (Exception e)
+                catch (IOException e)
                 {
                           System.err.println("Exception while connecting:" + 
e.getMessage());
                 }
             }
-            catch (Exception e)
+            catch (IOException e)
             {
                     System.err.println("Exception while connecting:" + 
e.getMessage());
                     System.exit(1);
@@ -319,7 +312,7 @@ public class TelnetClientExample impleme
             }
             while (ret_read >= 0);
         }
-        catch (Exception e)
+        catch (IOException e)
         {
             System.err.println("Exception while reading socket:" + 
e.getMessage());
         }
@@ -328,7 +321,7 @@ public class TelnetClientExample impleme
         {
             tc.disconnect();
         }
-        catch (Exception e)
+        catch (IOException e)
         {
             System.err.println("Exception while closing telnet:" + 
e.getMessage());
         }


Reply via email to