Intelehealth / intelehealth-fhw-mobileapp

Intelehealth's FHWs Mobile App
http://intelehealth.org
Mozilla Public License 2.0
33 stars 48 forks source link

NPE being thrown by QuestionNodeActivity line 124 #502

Closed AmbujPandey closed 5 years ago

AmbujPandey commented 6 years ago

App crashing on "HelperMethods.java line 99" Originator- Ambuj Pandey Status- OPEN User Affected- 5 Checked from- July 19,2018 Bug type- Coding error

Environment: Mobile Brand- Motorola & OnePlus Model- Moto E(4), Moto E(4)PLUS, ONEPLUS A3003 OS Version- Moto(7.1.1), OnePlus(8.0.0) App Version- 1.2.2 & 1.3.2 Started- May 30th, 2018 lasst crash date July 25th, 2018 Number of Crashes: 11

Summary: Fatal Exception: java.lang.RuntimeException && Caused by java.lang.NullPointerException Description: Unable to start activity ComponentInfo{io.intelehealth.client/io.intelehealth.client.activities.question_node_activity.QuestionNodeActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'int java.lang.String.length()' on a null object reference io.intelehealth.client.services.ImageUploadService.uploadImage (ImageUploadService.java:176)

Attempt to invoke virtual method 'int java.lang.String.length()' on a null object reference io.intelehealth.client.utilities.HelperMethods.encodeJSON (HelperMethods.java:99)

URL: click_here

amalafrozalam commented 6 years ago

This is happening because there is no image being taken. The app is trying to upload an image but is not finding an image to upload. It's possible that this is occurring on the QuestionNodeActivity because a node is requiring the user to take a picture, but instead they do not. This just requires a logical check on QNA line 124 to determine if the file to be encoded into JSON is null or not.

amalafrozalam commented 6 years ago

if (filelocation != null) { currentFile = HelperMethods.encodeJSON(this, fileLocation); }

meerapo commented 6 years ago

Made changes as above and also check without change. Unable to reproduce a bug. Checked from start, create patient->start new visite->vitals->Choose Complain->symptoms->past histrory->Family Histrory->phisical Exam Debuged through all steps

nehav39 commented 6 years ago

Go to Physical exam activity -> On Nail abnormality -> Click "Take a picture" -> Then cancel the camera activity without taking a picture ---- See if the app crashes If the app does not crash there, then finish the Physical Exam activity steps and hit the FAB --- See if the app crashes here If the app does not crash there and moves to the visit summary screen, then hit "Upload to doctor" --- See if the app crashes there.

meerapo commented 6 years ago

Downloaded AFI and RHPT mind maps from parse server its working fine. When I put All JSON files(From Vibha) in our asset folder for testing, I found this error. It came because of json name and there nodes name having a naming conflict(Uppercase/Lowercase).json file name and Node name should be same.

nehav39 commented 6 years ago

This is a mind map issue. Write unit test script to test mm json files - it should simulate selecting each node of the mm file and running it through the node object so we can automate the testing of mind maps. Keep a watch on this issue to see if any new crashes occur from users.