> private Component focusedComponent = null;
> @@ -1520,6 +1520,8 @@ public abstract class ApplicationContext
> throw new RuntimeException(exception);
> } catch (SerializationException exception) {
> throw new RuntimeException(exception);
> + } catch (NullPointerException exception) {
> + throw new RuntimeException("Unable to locate style sheet
> resource \"" + resourceName + "\".");
> }
No. This is just silly. You don't catch NPEs - you prevent them. The
appropriate way to handle this is to check for a null return value from
ClassLoader#getResource().
> Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/ScriptApplication.java
> URL:
> http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/ScriptApplication.java?rev=993158&r1=993157&r2=993158&view=diff
> ==============================================================================
> --- pivot/trunk/wtk/src/org/apache/pivot/wtk/ScriptApplication.java (original)
> +++ pivot/trunk/wtk/src/org/apache/pivot/wtk/ScriptApplication.java Mon Sep
> 6 21:45:25 2010
> @@ -66,7 +66,10 @@ public class ScriptApplication implement
>
> if (properties.containsKey(STYLESHEET_KEY)) {
> String stylesheet = properties.get(STYLESHEET_KEY);
> - ApplicationContext.applyStylesheet(stylesheet.substring(1));
> + if (stylesheet.startsWith("/")) {
> + stylesheet = stylesheet.substring(1);
> + }
> + ApplicationContext.applyStylesheet(stylesheet);
> }
The leading slash is required. We can display an error when it is missing, but
it should not be optional.