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

Telemetry entry reporting Java NullPointerException error in deviceInfo section #304

Open
dianabarsan opened this issue Feb 23, 2023 · 1 comment
Labels
Type: Bug Fix something that isn't working as intended

Comments

@dianabarsan
Copy link
Member

Describe the bug
I came across a telemetry entry that had this message in the device section:

"userAgent": "Mozilla/5.0 (Linux; Android 7.0; TECNO WX3P Build/NRD90M) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.143 Crosswalk/23.53.589.4 Mobile Safari/537.36 org.livinggoods.smarthealth.region1.ug/v0.4.33",
    "deviceInfo": {
      "error": true,
      "message": "Problem fetching device info: class java.lang.NullPointerException: Attempt to invoke virtual method 'int android.net.NetworkCapabilities.getLinkDownstreamBandwidthKbps()' on a null object reference"
    },

Link to forum post sharing the full telemetry entry: https://forum.communityhealthtoolkit.org/t/error-loading-tasks/2471/9

To Reproduce
Steps to reproduce the behavior:
I'm assuming this is linked to the Android version this device runs, which is Android 7.0.

Expected behavior
Get device info, not an error.

Environment

  • Instance: live instance
  • Android Version: 7.0
  • App Version: ??
@dianabarsan dianabarsan added the Type: Bug Fix something that isn't working as intended label Feb 23, 2023
@dianabarsan dianabarsan changed the title Telemetry entry reporting Java NullPointerException error Telemetry entry reporting Java NullPointerException error in deviceInfo section Feb 23, 2023
@garethbowen
Copy link
Member

Looks like null is a valid return value: https://developer.android.com/reference/android/net/ConnectivityManager#getNetworkCapabilities(android.net.Network)

Need to add null check here:

NetworkCapabilities networkCapabilities = connectivityManager.getNetworkCapabilities(connectivityManager.getActiveNetwork());

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Fix something that isn't working as intended
Projects
None yet
Development

No branches or pull requests

2 participants