Integer.parseInt("5") and Long.parseLong("5") are throwing an UnsupportedOperationException in the Eclipse Expressions Window.

I think this is also the Exception I’m getting at runtime, but being new to Eclipse, I’m not sure how to find the type of e within a debug session:
public static long longTryParse(String text, long fallbackValue) {
try {
return Long.parseLong(text);
} catch (Exception e) {
return fallbackValue; // When stopping at a breakpoint here, Eclipse says that e is of type 'Exception'. Well, that's informative.
}
}
So …
- Are these valid statements?
- If so, why am I getting an exception?
- (Of lesser importance) Why won’t Eclipse say that e is of type UnsupportedOperationException rather than Exception during my debug session?
Thanks!
Yes … taken as Java expressions in the context of a normal Java program.
In the context of an Eclipse debugger’s expression evaluator, I’m not sure.
I don’t know for sure, but I suspect that it is something to do with the debugger itself.
One possibility is that you are using the expression evaluation functionality incorrectly.
Another possibility is that this is a bug in the Eclipse debugger, or a mismatch between the Eclipse debugger and the debug agent in the JVM.
The one thing that I do know is that the
parseIntandparseLongmethods themselves don’t throwUnsupportedOperationException. (In theory, they could because it is an unchecked exception. But I checked the source code for those 2 methods, and there’s no way that the code could do that … if executed in the normal way.)The Google query – “site:eclipse.org +UnsupportedOperationException JDI” – shows a lot of hits in the Eclipse issues database and newsgroups / mailing lists.
In some cases, it looks like the problem is that the JDI / JNDI implementation for the target platform is incomplete. Could this be your problem? You mention you are doing Android development …