diff options
author | Artur Signell <artur.signell@itmill.com> | 2010-11-05 17:00:00 +0000 |
---|---|---|
committer | Artur Signell <artur.signell@itmill.com> | 2010-11-05 17:00:00 +0000 |
commit | 43ffbd25d70f3e78626dac1ce7ba267f8819c481 (patch) | |
tree | e875cad8a7224356a6c97fd0d437e84622fc9c4b /src/com/vaadin | |
parent | 8f31c436f47ecebe0ee5c5f4e226215055ac6d1c (diff) | |
download | vaadin-framework-43ffbd25d70f3e78626dac1ce7ba267f8819c481.tar.gz vaadin-framework-43ffbd25d70f3e78626dac1ce7ba267f8819c481.zip |
Merged ClassPathExplorer fixes for #5953, #5957
svn changeset:15891/svn branch:6.5
Diffstat (limited to 'src/com/vaadin')
-rw-r--r-- | src/com/vaadin/terminal/gwt/widgetsetutils/ClassPathExplorer.java | 44 |
1 files changed, 33 insertions, 11 deletions
diff --git a/src/com/vaadin/terminal/gwt/widgetsetutils/ClassPathExplorer.java b/src/com/vaadin/terminal/gwt/widgetsetutils/ClassPathExplorer.java index f69cc468bf..077dd9c2f8 100644 --- a/src/com/vaadin/terminal/gwt/widgetsetutils/ClassPathExplorer.java +++ b/src/com/vaadin/terminal/gwt/widgetsetutils/ClassPathExplorer.java @@ -196,7 +196,8 @@ public class ClassPathExplorer { } catch (MalformedURLException e) { // should never happen as based on an existing URL, // only changing end of file name/path part - logger.log(Level.SEVERE, + logger.log( + Level.SEVERE, "Error locating the widgetset " + classname, e); } @@ -524,30 +525,51 @@ public class ClassPathExplorer { @SuppressWarnings("unchecked") private static void tryToAdd(final String fullclassName, Collection<Class<? extends Paintable>> paintables) { + PrintStream out = System.out; + PrintStream err = System.err; + Throwable errorToShow = null; + Level logLevel = null; try { - PrintStream out = System.out; - PrintStream err = System.err; System.setErr(devnull); System.setOut(devnull); Class<?> c = Class.forName(fullclassName); - System.setErr(err); - System.setOut(out); - if (c.getAnnotation(ClientWidget.class) != null) { paintables.add((Class<? extends Paintable>) c); // System.out.println("Found paintable " + fullclassName); } else if (c.getAnnotation(ClientCriterion.class) != null) { acceptCriterion.add((Class<? extends AcceptCriterion>) 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. + logLevel = Level.INFO; + errorToShow = e; } catch (ClassNotFoundException e) { - // e.printStackTrace(); + // Don't show to avoid flooding the user with irrelevant messages + logLevel = Level.FINE; + errorToShow = e; } catch (LinkageError e) { - // NOP + // Don't show to avoid flooding the user with irrelevant messages + logLevel = Level.FINE; + errorToShow = e; } catch (Exception e) { - logger.log(Level.FINEST, "Could not add class: " + fullclassName, e); + // Don't show to avoid flooding the user with irrelevant messages + logLevel = 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 && logLevel != null) { + logger.log(logLevel, + "Failed to load class " + fullclassName + ". " + + errorToShow.getClass().getName() + ": " + + errorToShow.getMessage()); } } @@ -615,4 +637,4 @@ public class ClassPathExplorer { } } -}
\ No newline at end of file +} |