There is a part of our application that does this...
int x = DOM.getElementById("x").getPropertyInt("value");
int y = DOM.getElementById("y").getPropertyInt("value");
int w = DOM.getElementById("w").getPropertyInt("value");
int h = DOM.getElementById("h").getPropertyInt("value");
Every call to DOM.getElemendById("something")
returns null
(which I expect as I removed them) but calling .getPropertyInt("value")
on that return value of null is not causing a NullPointerException. In dev mode I am able to step through all of these statements and watch x,y,w,h all be assigned to zero. If I evaluate one of these statements in the Intellij evaluator in the debugger there 开发者_StackOverflow中文版is a NullPointerException thrown.
Doesn't this seem slightly insane to anybody else?
Wow it looks like anything created by GWT overlay types are able to do this...
http://code.google.com/p/google-web-toolkit/issues/detail?id=5030
The docs say:
Exceptions: try, catch, finally and user-defined exceptions are supported as
normal, although Throwable.getStackTrace() is not meaningfully supported in
production mode.
Note: Several fundamental exceptions implicitly produced by the Java VM, most
notably NullPointerException, StackOverflowError, and OutOfMemoryError, do not
occur in production mode as such. Instead, a JavaScriptException is produced for
any implicitly generated exceptions. This is because the nature of the underlying
JavaScript exception cannot be reliably mapped onto the appropriate Java
exception type.
精彩评论