Skip to Content.
Sympa Menu

ndt-dev - [ndt-dev] [ndt] r835 committed - Improve exception handling....

Subject: NDT-DEV email list created

List archive

[ndt-dev] [ndt] r835 committed - Improve exception handling....


Chronological Thread 
  • From:
  • To:
  • Subject: [ndt-dev] [ndt] r835 committed - Improve exception handling....
  • Date: Wed, 09 Oct 2013 13:16:17 +0000

Revision: 835
Author:

Date: Wed Oct 9 13:16:09 2013 UTC
Log: Improve exception handling.
Modified existing catch block to catch all types of exceptions during tests and displaying appropriate message for user.
http://code.google.com/p/ndt/source/detail?r=835

Modified:
/branches/AppletIssue88/Applet/NDTUtils.java
/branches/AppletIssue88/Applet/Tcpbw100.java
/branches/AppletIssue88/Applet/Tcpbw100_msgs_en_US.properties

=======================================
--- /branches/AppletIssue88/Applet/NDTUtils.java Mon Apr 30 20:46:39 2012 UTC
+++ /branches/AppletIssue88/Applet/NDTUtils.java Wed Oct 9 13:16:09 2013 UTC
@@ -81,5 +81,15 @@
return (strNameTxt);
} // prttxt() method ends

+ /**
+ * Utility method to check if the given string is empty ("") or null.
+ *
+ * @param str
+ * String to check
+ * @return true is the given string is empty; otherwise false
+ */
+ public static boolean isEmpty(String str) {
+ return str == null || str.length() == 0;
+ } // isEmpty() method ends

}
=======================================
--- /branches/AppletIssue88/Applet/Tcpbw100.java Mon Jun 17 04:39:20 2013 UTC
+++ /branches/AppletIssue88/Applet/Tcpbw100.java Wed Oct 9 13:16:09 2013 UTC
@@ -685,11 +685,17 @@
System.err.println("INFO: Thread interrupted while sleeping before starting the next test.");
}
}
- } catch (IOException e) {
+ } catch (Exception e) {
e.printStackTrace();
+
+ String sMessage =
NDTUtils.isEmpty(e.getMessage())
+ ?
_resBundDisplayMsgs.getString("withoutMessage")
+ : e.getMessage();
+
_bFailed = true;
- _sErrMsg =
_resBundDisplayMsgs.getString("serverBusy30s")
- + "\n";
+ _sErrMsg =
_resBundDisplayMsgs.getString("unexpectedException")
+ + " (" + e.getClass().getName()
+ "): "
+ + sMessage + "\n";
}

// If test failed due to any reason, mark
failure reason too
=======================================
--- /branches/AppletIssue88/Applet/Tcpbw100_msgs_en_US.properties Tue Apr 9 13:42:50 2013 UTC
+++ /branches/AppletIssue88/Applet/Tcpbw100_msgs_en_US.properties Wed Oct 9 13:16:09 2013 UTC
@@ -222,3 +222,5 @@
yourPcHas = Your PC/Workstation has a
connectingTo = Connecting to
toRunTest = to run test
+unexpectedException=Unexpected exception
+withoutMessage=without message


  • [ndt-dev] [ndt] r835 committed - Improve exception handling...., ndt, 10/09/2013

Archive powered by MHonArc 2.6.16.

Top of Page