From fac3268539e2a4fc993bfd01362a90ab607088a8 Mon Sep 17 00:00:00 2001 From: Artur Signell Date: Fri, 5 Nov 2010 15:38:53 +0000 Subject: [PATCH] #5957 - ClassPathExplorer should show UnsupportedClassVersionError svn changeset:15886/svn branch:6.4 --- .../gwt/widgetsetutils/ClassPathExplorer.java | 30 ++++++++++++++++--- 1 file changed, 26 insertions(+), 4 deletions(-) diff --git a/src/com/vaadin/terminal/gwt/widgetsetutils/ClassPathExplorer.java b/src/com/vaadin/terminal/gwt/widgetsetutils/ClassPathExplorer.java index 45b3d5a1c9..06876e44c5 100644 --- a/src/com/vaadin/terminal/gwt/widgetsetutils/ClassPathExplorer.java +++ b/src/com/vaadin/terminal/gwt/widgetsetutils/ClassPathExplorer.java @@ -525,6 +525,8 @@ public class ClassPathExplorer { Collection> paintables) { PrintStream out = System.out; PrintStream err = System.err; + Throwable errorToShow = null; + try { System.setErr(devnull); System.setOut(devnull); @@ -537,17 +539,37 @@ public class ClassPathExplorer { } else if (c.getAnnotation(ClientCriterion.class) != null) { acceptCriterion.add((Class) c); } - + } catch (UnsupportedClassVersionError e) { + // Inform the user about this as the class might contain a Paintable + // Typically happens when using an add-on that is compiled using a + // newer Java version. + errorToShow = e; } catch (ClassNotFoundException e) { - // e.printStackTrace(); + // Don't show to avoid flooding the user with irrelevant messages + if (logger.isLoggable(Level.FINE)) { + errorToShow = e; + } } catch (LinkageError e) { - // NOP + // Don't show to avoid flooding the user with irrelevant messages + if (logger.isLoggable(Level.FINE)) { + errorToShow = e; + } } catch (Exception e) { - e.printStackTrace(); + // Don't show to avoid flooding the user with irrelevant messages + if (logger.isLoggable(Level.FINE)) { + errorToShow = e; + } } finally { System.setErr(err); System.setOut(out); } + + // Must be done here after stderr and stdout have been reset. + if (errorToShow != null) { + logger.warning("Failed to load class " + fullclassName + ". " + + errorToShow.getClass().getName() + ": " + + errorToShow.getMessage()); + } } /** -- 2.39.5