The problem is a null pointer exception being thrown in the IPCameraFrameGrabber class when no header fields are found. The problem is the following code on line 60 and 61.
getHeaderFields returns null for me, then obviously the if statement causes a NPE. I'm not sure what the header fields are needed for, but adding a null check for headerfields in the if statement may fix it.
Here is the stack trace, it says the exception happened on line 80, but when I click it, it takes me to line 60 in the IPCameraFrameGrabber class.
07-07 12:51:02.300 22769-22769/com.example.javacv_test3 W/System.err﹕ java.lang.NullPointerException
07-07 12:51:02.300 22769-22769/com.example.javacv_test3 W/System.err﹕ at org.bytedeco.javacv.IPCameraFrameGrabber.start(IPCameraFrameGrabber.java:80)
07-07 12:51:02.300 22769-22769/com.example.javacv_test3 W/System.err﹕ at com.example.javacv_test3.MyActivity.onCreate(MyActivity.java:66)
07-07 12:51:02.300 22769-22769/com.example.javacv_test3 W/System.err﹕ at android.app.Activity.performCreate(Activity.java:5231)
07-07 12:51:02.300 22769-22769/com.example.javacv_test3 W/System.err﹕ at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
07-07 12:51:02.300 22769-22769/com.example.javacv_test3 W/System.err﹕ at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2169)
07-07 12:51:02.300 22769-22769/com.example.javacv_test3 W/System.err﹕ at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2264)
07-07 12:51:02.300 22769-22769/com.example.javacv_test3 W/System.err﹕ at android.app.ActivityThread.access$800(ActivityThread.java:144)
07-07 12:51:02.300 22769-22769/com.example.javacv_test3 W/System.err﹕ at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1205)
07-07 12:51:02.300 22769-22769/com.example.javacv_test3 W/System.err﹕ at android.os.Handler.dispatchMessage(Handler.java:102)
07-07 12:51:02.300 22769-22769/com.example.javacv_test3 W/System.err﹕ at android.os.Looper.loop(Looper.java:136)
07-07 12:51:02.300 22769-22769/com.example.javacv_test3 W/System.err﹕ at android.app.ActivityThread.main(ActivityThread.java:5139)
07-07 12:51:02.300 22769-22769/com.example.javacv_test3 W/System.err﹕ at java.lang.reflect.Method.invokeNative(Native Method)
07-07 12:51:02.300 22769-22769/com.example.javacv_test3 W/System.err﹕ at java.lang.reflect.Method.invoke(Method.java:515)
07-07 12:51:02.300 22769-22769/com.example.javacv_test3 W/System.err﹕ at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:796)
07-07 12:51:02.300 22769-22769/com.example.javacv_test3 W/System.err﹕ at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:612)
07-07 12:51:02.300 22769-22769/com.example.javacv_test3 W/System.err﹕ at dalvik.system.NativeStart.main(Native Method)
Please could you confirm this bug, thank you.
My code below for reference
try
{
IPCameraFrameGrabber ipGrabber = new IPCameraFrameGrabber("my_ip_camera_url"); // url works with VLC
ipGrabber.start(); // npe here
// more code
}
catch(NullPointerException npe)
{
// :(
}
The problem is a null pointer exception being thrown in the
IPCameraFrameGrabber
class when no header fields are found. The problem is the following code on line 60 and 61.getHeaderFields
returns null for me, then obviously the if statement causes a NPE. I'm not sure what the header fields are needed for, but adding a null check forheaderfields
in the if statement may fix it.Here is the stack trace, it says the exception happened on line 80, but when I click it, it takes me to line 60 in the
IPCameraFrameGrabber
class.Please could you confirm this bug, thank you.
My code below for reference