Open YYYSSSHHH opened 4 years ago
How do we test the APP? We use the fuzzing method to simulate the network response data. For example, when the app receives network API response data from the server or network, we will replace it with 404, null and random data.
normal data :Value=”hello” -----fuzzing-----> simulated data :Value=null or network request fails(404、503) or Value=”heee”(random data) or Value=""(empty) , etc.
Environment Info: Apod Classic android:versionCode="11" Apod Classic android:versionName="3.2.8" Android OS Version = “6.0.1”
Description information: We find that mobile apps are prone to crashes due to a network issue, mainly because successful network API calls return unexpected or no data. And we found that when this app's network returned data is null, or some fields are null (JSON format),or is empty the app has crashed. crash information:
crash one:
java.lang.NullPointerException: Attempt to invoke virtual method 'boolean java.lang.String.equalsIgnoreCase(java.lang.String)' on a null object reference at com.jvillalba.apod.classic.adapter.MyAdapter.addAll(MyAdapter.java:32) at com.jvillalba.apod.classic.controller.NasaController$1.onResponse(NasaController.java:30) at retrofit2.ExecutorCallAdapterFactory$ExecutorCallbackCall$1$1.run(ExecutorCallAdapterFactory.java:70) at android.os.Handler.handleCallback(Handler.java:739) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:148) at android.app.ActivityThread.main(ActivityThread.java:5539) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:745) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:635)
[ ] crashActivity=com.jvillalba.apod.classic.activities.MainActivity
: java.lang.IllegalArgumentException: Path must not be empty. at com.squareup.picasso.Picasso.load(Picasso.java:297) at com.jvillalba.apod.classic.adapter.MyAdapter$ViewHolder.bind(MyAdapter.java:84) at com.jvillalba.apod.classic.adapter.MyAdapter.onBindViewHolder(MyAdapter.java:59) at com.jvillalba.apod.classic.adapter.MyAdapter.onBindViewHolder(MyAdapter.java:18) at android.support.v7.widget.RecyclerView$Adapter.onBindViewHolder(RecyclerView.java:6482) at android.support.v7.widget.RecyclerView$Adapter.bindViewHolder(RecyclerView.java:6515) at android.support.v7.widget.RecyclerView$Recycler.tryBindViewHolderByDeadline(RecyclerView.java:5458) at android.support.v7.widget.RecyclerView$Recycler.tryGetViewHolderForPositionByDeadline(RecyclerView.java:5724) at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:5563) at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:5559) at android.support.v7.widget.LinearLayoutManager$LayoutState.next(LinearLayoutManager.java:2229) at android.support.v7.widget.LinearLayoutManager.layoutChunk(LinearLayoutManager.java:1556) at android.support.v7.widget.LinearLayoutManager.fill(LinearLayoutManager.java:1516) at android.support.v7.widget.LinearLayoutManager.onLayoutChildren(LinearLayoutManager.java:608) at android.support.v7.widget.RecyclerView.dispatchLayoutStep2(RecyclerView.java:3693) at android.support.v7.widget.RecyclerView.dispatchLayout(RecyclerView.java:3410) at android.support.v7.widget.RecyclerView.onLayout(RecyclerView.java:3962) at android.view.View.layout(View.java:16636) at android.view.ViewGroup.layout(ViewGroup.java:5437) at android.widget.RelativeLayout.onLayout(RelativeLayout.java:1079) at android.view.View.layout(View.java:16636) at android.view.ViewGroup.layout(ViewGroup.java:5437) at android.widget.FrameLayout.layoutChildren(FrameLayout.java:336) at android.widget.FrameLayout.onLayout(FrameLayout.java:273) at android.view.View.layout(View.java:16636) at android.view.ViewGroup.layout(ViewGroup.java:5437) at android.support.v7.widget.ActionBarOverlayLayout.onLayout(ActionBarOverlayLayout.java:443) at android.view.View.layout(View.java:16636) at android.view.ViewGroup.layout(ViewGroup.java:5437) at android.widget.FrameLayout.layoutChildren(FrameLayout.java:336) at android.widget.FrameLayout.onLayout(FrameLayout.java:273) at android.view.View.layout(View.java:16636) at android.view.ViewGroup.layout(ViewGroup.java:5437) at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1743) at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1586) at android.widget.LinearLayout.onLayout(LinearLayout.java:1495) at android.view.View.layout(View.java:16636) at android.view.ViewGroup.layout(ViewGroup.java:5437) at android.widget.FrameLayout.layoutChildren(FrameLayout.java:336) at android.widget.FrameLayout.onLayout(FrameLayout.java:273) at com.android.internal.policy.PhoneWindow$DecorView.onLayout(PhoneWindow.java:2678) at android.view.View.layout(View.java:16636) at android.view.ViewGroup.layout(ViewGroup.java:5437) at android.view.ViewRootImpl.performLayout(ViewRootImpl.java:2165) at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1925) at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1107) at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6007) at android.view.Choreographer$CallbackRecord.run(Choreographer.java:858) at android.view.Choreographer.doCallbacks(Choreographer.java:670) at android.view.Choreographer.doFrame(Choreographer.java:606) at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:844) at android.os.Handler.handleCallback(Handler.java:739) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:148) at android.app.ActivityThread.main(ActivityThread.java:5539) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:745) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:635)
Finally: The cause of the program crash may be that the network response data is not handled properly in the code, such as null or empty. If you have confirmed or fixed this problem, please give me a reply, thank you!