In javascript
when NullPointerException
(sort of) occurs in stack trace I can see the method and line where it occurred. However, in Java it just shows the name of the method where the exception occurred without any indication which variable was Null
or at which line this occurred. I'm wondering as to why this difference exists? Is it because Javascript is an interpreted language while Java is compiled to bytecode? And when compiled there is no such thing as line or variable?
Update:
05-22 10:53:31.656 31583-31583/com.inreado.reader E/AndroidRuntime﹕ FATAL
EXCEPTION: main
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.inreado.reader/com.inreado.reader.TextsListActivity}: java.lang.NullPointerException
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2180)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
at android.app.ActivityThread.access$600(ActivityThread.java:141)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
And when I go to the ActivityThread.performLaunchActivity(ActivityThread.java:2180)
it shows the following:
private Activity performLaunchActivity(ActivityClientRecord r, Intent customIntent) {
// System.out.println("##### [" + System.currentTimeMillis() + "] ActivityThread.performLaunchActivity(" + r + ")");
ActivityInfo aInfo = r.activityInfo;
if (r.packageInfo == null) {
(this line is 2180) r.packageInfo = getPackageInfo(aInfo.applicationInfo, r.compatInfo,
Context.CONTEXT_INCLUDE_CODE);
}
I don't see how to figure out where is NPE since it's my activity that failed.