1.1 --- a/vm/src/test/java/org/apidesign/vm4brwsr/Exceptions.java Sat Dec 08 10:32:04 2012 +0100
1.2 +++ b/vm/src/test/java/org/apidesign/vm4brwsr/Exceptions.java Mon Dec 31 12:44:51 2012 +0100
1.3 @@ -22,6 +22,8 @@
1.4 * @author tom
1.5 */
1.6 public class Exceptions {
1.7 + private Exceptions() {
1.8 + }
1.9
1.10 public static int methodWithTryCatchNoThrow() {
1.11 int res = 0;
1.12 @@ -46,4 +48,17 @@
1.13 return res;
1.14 }
1.15
1.16 + public static String newInstance(String n) {
1.17 + try {
1.18 + Class c;
1.19 + try {
1.20 + c = Class.forName(n);
1.21 + } catch (ClassNotFoundException ex) {
1.22 + return ("CNFE:" + ex.getMessage()).toString();
1.23 + }
1.24 + return c.newInstance().getClass().getName();
1.25 + } catch (InstantiationException | IllegalAccessException ex) {
1.26 + return ex.getMessage();
1.27 + }
1.28 + }
1.29 }