diff options
author | Markus Keller | 2016-01-19 19:28:10 +0000 |
---|---|---|
committer | Markus Keller | 2016-01-19 19:28:10 +0000 |
commit | 23c9d0a7c36fa11ae3658b26158a8337fbe3293d (patch) | |
tree | 9b3e2af71e62eb2c156b2e13ba1847496be6f319 /org.eclipse.text.tests | |
parent | fa5f93df33b1754f609d95f8f3813992804e1b74 (diff) | |
download | eclipse.platform.text-23c9d0a7c36fa11ae3658b26158a8337fbe3293d.tar.gz eclipse.platform.text-23c9d0a7c36fa11ae3658b26158a8337fbe3293d.tar.xz eclipse.platform.text-23c9d0a7c36fa11ae3658b26158a8337fbe3293d.zip |
don't swallow root exception (example: bug 479217 comment 17)
Diffstat (limited to 'org.eclipse.text.tests')
-rw-r--r-- | org.eclipse.text.tests/src/org/eclipse/text/tests/Accessor.java | 76 |
1 files changed, 38 insertions, 38 deletions
diff --git a/org.eclipse.text.tests/src/org/eclipse/text/tests/Accessor.java b/org.eclipse.text.tests/src/org/eclipse/text/tests/Accessor.java index 0290286ade7..6d00aaee575 100644 --- a/org.eclipse.text.tests/src/org/eclipse/text/tests/Accessor.java +++ b/org.eclipse.text.tests/src/org/eclipse/text/tests/Accessor.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2015 IBM Corporation and others. + * Copyright (c) 2000, 2016 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -41,7 +41,7 @@ public class Accessor { * @param clazz the class */ public Accessor(Object instance, Class<?> clazz) { - org.eclipse.core.runtime.Assert.isNotNull(instance); + Assert.isNotNull(instance); Assert.isNotNull(clazz); fInstance= instance; fClass= clazz; @@ -64,9 +64,9 @@ public class Accessor { try { fClass= Class.forName(className, true, classLoader); } catch (ClassNotFoundException e) { - fail(); + fail(e); } catch (ExceptionInInitializerError e) { - fail(); + fail(e); } } @@ -98,30 +98,30 @@ public class Accessor { try { fClass= Class.forName(className, true, classLoader); } catch (ClassNotFoundException e) { - fail(); + fail(e); } catch (ExceptionInInitializerError e) { - fail(); + fail(e); } Constructor<?> constructor= null; try { constructor= fClass.getDeclaredConstructor(constructorTypes); - } catch (SecurityException e2) { - fail(); - } catch (NoSuchMethodException e2) { - fail(); + } catch (SecurityException e) { + fail(e); + } catch (NoSuchMethodException e) { + fail(e); } Assert.isNotNull(constructor); constructor.setAccessible(true); try { fInstance= constructor.newInstance(constructorArgs); } catch (IllegalArgumentException e) { - fail(); + fail(e); } catch (InvocationTargetException e) { - fail(); + fail(e); } catch (InstantiationException e) { - fail(); + fail(e); } catch (IllegalAccessException e) { - fail(); + fail(e); } } @@ -138,9 +138,9 @@ public class Accessor { try { fClass= Class.forName(className, true, classLoader); } catch (ClassNotFoundException e) { - fail(); + fail(e); } catch (ExceptionInInitializerError e) { - fail(); + fail(e); } } @@ -173,20 +173,20 @@ public class Accessor { try { method= fClass.getDeclaredMethod(methodName, types); } catch (SecurityException e) { - fail(); - } catch (NoSuchMethodException ex) { - fail(); + fail(e); + } catch (NoSuchMethodException e) { + fail(e); } Assert.isNotNull(method); method.setAccessible(true); try { return method.invoke(fInstance, arguments); } catch (IllegalArgumentException e) { - fail(); + fail(e); } catch (InvocationTargetException e) { - fail(); + fail(e); } catch (IllegalAccessException e) { - fail(); + fail(e); } return null; } @@ -202,9 +202,9 @@ public class Accessor { try { field.set(fInstance, value); } catch (IllegalArgumentException e) { - fail(); + fail(e); } catch (IllegalAccessException e) { - fail(); + fail(e); } } @@ -219,9 +219,9 @@ public class Accessor { try { field.setBoolean(fInstance, value); } catch (IllegalArgumentException e) { - fail(); + fail(e); } catch (IllegalAccessException e) { - fail(); + fail(e); } } @@ -236,9 +236,9 @@ public class Accessor { try { field.setInt(fInstance, value); } catch (IllegalArgumentException e) { - fail(); + fail(e); } catch (IllegalAccessException e) { - fail(); + fail(e); } } @@ -253,9 +253,9 @@ public class Accessor { try { return field.get(fInstance); } catch (IllegalArgumentException e) { - fail(); + fail(e); } catch (IllegalAccessException e) { - fail(); + fail(e); } // Unreachable code return null; @@ -272,9 +272,9 @@ public class Accessor { try { return field.getBoolean(fInstance); } catch (IllegalArgumentException e) { - fail(); + fail(e); } catch (IllegalAccessException e) { - fail(); + fail(e); } // Unreachable code return false; @@ -291,9 +291,9 @@ public class Accessor { try { return field.getInt(fInstance); } catch (IllegalArgumentException e) { - fail(); + fail(e); } catch (IllegalAccessException e) { - fail(); + fail(e); } // Unreachable code return 0; @@ -304,9 +304,9 @@ public class Accessor { try { field= fClass.getDeclaredField(fieldName); } catch (SecurityException e) { - fail(); + fail(e); } catch (NoSuchFieldException e) { - fail(); + fail(e); } field.setAccessible(true); return field; @@ -325,7 +325,7 @@ public class Accessor { return classes; } - private void fail() { - Assert.isTrue(false); + private void fail(Throwable e) { + throw new AssertionError(e.getLocalizedMessage(), e); } } |