Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Application stops when trying to open a news story #186

Open
GoogleCodeExporter opened this issue Jul 2, 2015 · 2 comments
Open

Application stops when trying to open a news story #186

GoogleCodeExporter opened this issue Jul 2, 2015 · 2 comments

Comments

@GoogleCodeExporter
Copy link

What steps will reproduce the problem?
1. Launch application via emulator
2. Select any news story
3. Observe "Unfortunately NPR News has stopped"

What is the expected output? What do you see instead?
I expect to see the news story contents; instead I see the aforementioned 
app-crash notification.

What version of the product are you using? On what operating system?
ce46f6fe92353676bf9d98b530fceb8328aceb85 on android-19

Please provide any additional information below.

03-23 17:51:20.876: E/eglCodecCommon(1241): glUtilsParamSize: unknow param 
0x00000b44
03-23 17:51:20.896: E/eglCodecCommon(1241): glUtilsParamSize: unknow param 
0x00000bd0
03-23 17:51:21.206: E/eglCodecCommon(1241): **** ERROR unknown type 0x0 
(glSizeof,72)
03-23 17:51:21.226: E/eglCodecCommon(1241): glUtilsParamSize: unknow param 
0x00000b44
03-23 17:51:21.226: E/eglCodecCommon(1241): glUtilsParamSize: unknow param 
0x00000bd0
03-23 17:51:21.266: E/eglCodecCommon(1241): **** ERROR unknown type 0x0 
(glSizeof,72)
03-23 17:51:22.756: E/eglCodecCommon(1241): glUtilsParamSize: unknow param 
0x00000b44
03-23 17:51:22.756: E/eglCodecCommon(1241): glUtilsParamSize: unknow param 
0x00000bd0
03-23 17:51:22.776: E/eglCodecCommon(1241): **** ERROR unknown type 0x0 
(glSizeof,72)
03-23 17:51:24.766: E/AndroidRuntime(1241): FATAL EXCEPTION: main
03-23 17:51:24.766: E/AndroidRuntime(1241): Process: org.npr.android.news, PID: 
1241
03-23 17:51:24.766: E/AndroidRuntime(1241): java.lang.RuntimeException: Unable 
to start activity 
ComponentInfo{org.npr.android.news/org.npr.android.news.NewsStoryActivity}: 
java.lang.NullPointerException
03-23 17:51:24.766: E/AndroidRuntime(1241):     at 
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2195)
03-23 17:51:24.766: E/AndroidRuntime(1241):     at 
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)
03-23 17:51:24.766: E/AndroidRuntime(1241):     at 
android.app.ActivityThread.access$800(ActivityThread.java:135)
03-23 17:51:24.766: E/AndroidRuntime(1241):     at 
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
03-23 17:51:24.766: E/AndroidRuntime(1241):     at 
android.os.Handler.dispatchMessage(Handler.java:102)
03-23 17:51:24.766: E/AndroidRuntime(1241):     at 
android.os.Looper.loop(Looper.java:136)
03-23 17:51:24.766: E/AndroidRuntime(1241):     at 
android.app.ActivityThread.main(ActivityThread.java:5017)
03-23 17:51:24.766: E/AndroidRuntime(1241):     at 
java.lang.reflect.Method.invokeNative(Native Method)
03-23 17:51:24.766: E/AndroidRuntime(1241):     at 
java.lang.reflect.Method.invoke(Method.java:515)
03-23 17:51:24.766: E/AndroidRuntime(1241):     at 
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
03-23 17:51:24.766: E/AndroidRuntime(1241):     at 
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
03-23 17:51:24.766: E/AndroidRuntime(1241):     at 
dalvik.system.NativeStart.main(Native Method)
03-23 17:51:24.766: E/AndroidRuntime(1241): Caused by: 
java.lang.NullPointerException
03-23 17:51:24.766: E/AndroidRuntime(1241):     at 
org.npr.android.news.NewsStoryActivity.loadStory(NewsStoryActivity.java:285)
03-23 17:51:24.766: E/AndroidRuntime(1241):     at 
org.npr.android.news.NewsStoryActivity.layoutStory(NewsStoryActivity.java:193)
03-23 17:51:24.766: E/AndroidRuntime(1241):     at 
org.npr.android.news.NewsStoryActivity.onCreate(NewsStoryActivity.java:130)
03-23 17:51:24.766: E/AndroidRuntime(1241):     at 
android.app.Activity.performCreate(Activity.java:5231)
03-23 17:51:24.766: E/AndroidRuntime(1241):     at 
android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
03-23 17:51:24.766: E/AndroidRuntime(1241):     at 
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2159)
03-23 17:51:24.766: E/AndroidRuntime(1241):     ... 11 more

Original issue reported on code.google.com by [email protected] on 23 Mar 2014 at 9:53

@GoogleCodeExporter
Copy link
Author

I just started playing around with the source code and hit this error as well.

Cause: The 'layout' field of the story is not being set by 
Story.createNprmlStory(Node node), as the xml returned by the server and fed 
into this method does not contain a 'layout' node.

Not sure if this is a server side error or if the XML format changed at some 
point and this application wasn't updated.

The null pointer exception is being thrown in NewsStoryActivity.loadStory on 
the following line:

     if (story.getLayout().getItems().size() > 0) {

The solution is easy: check the value of getLayout before using it :-) The 
accompanying else looks like it already includes code for handling cases where 
the layout is missing.

I will try it out and submit the fix.

Original comment by [email protected] on 2 Sep 2014 at 6:04

@GoogleCodeExporter
Copy link
Author

I've got a confirmed fix and patch ready. Will send it over to the devs for 
approval.

Original comment by [email protected] on 2 Sep 2014 at 6:30

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant