postCachedMethods does not handle null return value from File.listFiles()
DanFTRX opened this issue · 5 comments
https://docs.oracle.com/javase/7/docs/api/java/io/File.html#listFiles()
listFiles() can return null in some cases and raygun errors on it rather than handling gracefully.
Hey @DanFTRX - Thanks for that report, I'll have a look at a fix later today.
Out of curiousity - may I ask in which scenario(s) that occurred for you? And were you using the v4 final or are you on the older 3.0.6 release?
@TheRealAgentK I was on the older 3.0.6 release, however the code in question did not change between the two versions(aside from moving from RaygunClient to CrashReporting) As for the scenario, it occured when sending up an exception. Unfortuanently I do not have reproduction steps.
@DanFTRX Yeah, I saw this is code from 3.0.x and would show the same behaviour.
Bugger you don't have a repro. Will have a bit of a deeper look in which scenarios building that path could fail. Did you see it on any particular devices or Android versions?
This is the environment section of the raygun report:
"architecture": "arm64-v8a",
"availablePhysicalMemory": 1797,
"availableVirtualMemory": 0,
"board": "sdm630",
"brand": "Sonim",
"currentOrientation": "Portrait",
"deviceCode": "XP8800",
"deviceName": "XP8800",
"diskSpaceFree": 0,
"locale": "en_US",
"oSVersion": "8.1.0",
"osSDKVersion": "27",
"processorCount": 1,
"totalPhysicalMemory": 0,
"totalVirtualMemory": 0,
"utcOffset": -4,
"windowsBoundHeight": 1920,
"windowsBoundWidth": 1080
This is the relevant part of the StackTrace:
main.java.com.mindscapehq.android.raygun4android.RaygunClient.postCachedMessages in RaygunClient.java::611
main.java.com.mindscapehq.android.raygun4android.RaygunClient.send in RaygunClient.java::384
Oh and as a bonus, now that I am looking at my report again, I notice that the OS had too many open files at the time. So I would guess that the reproduction steps is to induce that state again. I send my logcat up with Raygun reports and it got this:
java.io.IOException: Cannot run program \"logcat\": error=24, Too many open files
And as File.listFiles() is documented as returning null on IOExceptions, this tracks as being the cause.
Thx @DanFTRX, this is fixed in my dev build and will go out to a 4.0.1 release in the next few days.