Commit 9bacf6b6 authored by Nicolas Gilmard's avatar Nicolas Gilmard
Browse files

Correct exception management for adapter instantiation

parent 846c5c6a
......@@ -87,9 +87,8 @@ public abstract class TangibleApplication {
*
* @param newPropertiesFileURI
* The URI of the properties file to load.
* @throws Exception
*/
protected TangibleApplication(@Nullable String newPropertiesFileURI) throws Exception {
protected TangibleApplication(@Nullable String newPropertiesFileURI) {
if (newPropertiesFileURI != null && !newPropertiesFileURI.isEmpty()) {
propertiesFileURI = newPropertiesFileURI;
}
......@@ -111,35 +110,30 @@ public abstract class TangibleApplication {
} catch (InstantiationException e) {
logger.log(Level.SEVERE, "Cannot instantiate adapter.\n" //$NON-NLS-1$
+ "You try to instantiate an abstract class or an interface!"); //$NON-NLS-1$s
throw new Exception("Cannot instantiate adapter\n" //$NON-NLS-1$
+ "You try to instantiate an abstract class or an interface!", e); //$NON-NLS-1$
System.exit(0);
} catch (IllegalAccessException e) {
logger.log(Level.SEVERE, "The currently executing method does not have access to the definition of the constructor."); //$NON-NLS-1$
throw new IllegalAccessException("The currently executing method does not have access to the definition of the constructor."); //$NON-NLS-1$
System.exit(0);
} catch (IllegalArgumentException e) {
logger.log(Level.SEVERE, "A wrong argument has been passed to the adapter."); //$NON-NLS-1$
throw new Exception("A wrong argument has been passed to the adapter.\n+" //$NON-NLS-1$
+ "Required argument of type lu.list.itis.dkd.tui.TangibleInterfaceManager!", e); //$NON-NLS-1$
System.exit(0);
} catch (InvocationTargetException e) {
logger.log(Level.SEVERE, "An exception has been thrown in the constructor of the adapter"); //$NON-NLS-1$
throw new InvocationTargetException(e, "Une exception a été jeté dans le constructeur de l'adaptateur.\n+" //$NON-NLS-1$
+ "Check the constructor of " + properties.getProperty("tableAdapter")); //$NON-NLS-1$ //$NON-NLS-2$
System.exit(0);
} catch (NoSuchMethodException e) {
logger.log(Level.SEVERE, "The called method was not found"); //$NON-NLS-1$
throw new NoSuchMethodException("The called method was not found"); //$NON-NLS-1$
System.exit(0);
} catch (SecurityException e) {
logger.log(Level.SEVERE, "Security violation"); //$NON-NLS-1$
throw new Exception("Security violation", e); //$NON-NLS-1$
System.exit(0);
} catch (ClassNotFoundException e) {
logger.log(Level.SEVERE, "The class " + properties.getProperty("tableAdapter") + "was not found."); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
throw new ClassNotFoundException("The class " + properties.getProperty("tableAdapter") + "was not found.\n" //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ "Check the spelling of your adapter class name in properties file."); //$NON-NLS-1$
System.exit(0);
}
......
......@@ -96,6 +96,7 @@ public class TextBox extends Corona implements ContextEventListener, Information
TextHelper.configure(font, fontSize, colour, centred);
TextHelper.drawText(canvas, drawAt, lineWidth, textToShow);
canvas.setTransform(new AffineTransform());
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment