|
From: Jan H. (JIRA) <no...@at...> - 2006-09-14 12:59:33
|
[ http://opensource.atlassian.com/projects/spring/browse/RCP-314?page=all ] Jan Hoskens updated RCP-314: ---------------------------- Fix Version: (was: 0.2.0) 0.3.0 > Merge exception handler implementations > --------------------------------------- > > Key: RCP-314 > URL: http://opensource.atlassian.com/projects/spring/browse/RCP-314 > Project: Spring Framework Rich Client Project > Type: New Feature > Components: Helper Classes > Versions: 0.1.0 > Reporter: Geoffrey De Smet > Assignee: Larry Streepy > Fix For: 0.3.0 > > On the dev list we 've found out each of us has it own exception handler. > In the discussion "Exception handling" we aggreed they all should be merged into the best solution. > Very short summary of the thread (pls take a look at it): > Geoffrey's is checked in into the tiger module: D:\projects\sf\spring-richclient\tiger\src\main\java\be\springframework\richclient\exception\I18nUncaughtExceptionHandler.java > It supports i18n and polymorfistic message declarationg (for example if there is no specific message for NullPointerException, the one from RuntimeException is used). > Larry has an e-mail report. > Jan uses SwingLab's JXErrorDialog. > Bushe uses http://eventbus.dev.java.net and it's AWTExceptionHandler. > Benoit found the best way to take an image was with this code, which uses the JDK (and not an LGPL library): > private byte[] takeScreenSnapshot() throws AWTException { > final Robot robot = new Robot(); > final Dimension screenDim = Toolkit.getDefaultToolkit().getScreenSize(); > final Rectangle rect = new Rectangle(0, 0, screenDim.width, screenDim.height); > final BufferedImage bi = robot.createScreenCapture(rect); > > ByteArrayOutputStream bos = new ByteArrayOutputStream(); > try { > ImageIO.write((RenderedImage) bi, "png", bos); > bos.close(); > } catch (IOException e) { > e.printStackTrace(); > } > > // convert java.awt.Image to a PNG graphic (highest compression) > final byte[] pngArray = bos.toByteArray(); > return pngArray; > } > Some brainstorming: > The commands on a thrown exception could be configurable (maybe?): > - inject in a eMailReporterCommand at your own will > - send all system properties too boolean > IMHO catching Exception yourself (with try-catch) is bad: I18nUncaughtExceptionHandler shows it can be done differently. > PMD, checkstyle, etc say to avoid catching general exceptions such as Throwable, Error, Exception, RuntimeException, unless in the root of the stacktrace (= exceptino handler api in 1.5) > I've assigned it to Larry for the moment because he said he might look at it after the petclinic sample. -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/spring/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira |