-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
java.lang.NullPointerException: Attempt to get length of null array on some Huawei devices #1505
Comments
Hi @coolguy001tv, Did it occasionally happen on your device (not Huawei Mate20)? Did I understand you correctly? |
I just see it on some logs from server. It shows me there is a crash. I don't own this device. |
Thanks, I understand now. I think this question might be related to app permissions and it's very strange, these Huawei devices may have an unusual memory configuration, but we can't test it without the actual device, so we can only assume the reasons. |
Thanks for the reply. I'll try to add the permission. |
@yuri-kulikov |
Hey @coolguy001tv,
I think you're right! However, it still won't solve the issue completely. These specific devices won't be crashed, but still won't be able to update via CodePush. And it's weird that |
Thanks. If I get more info, I shall comment it here. |
Same problem here: Android, Huawei Mate 20 Pro Dual SIM (LYA-L29), Android 9, free disk space: 115924271104, free memory: 400024576.
|
@pawlowskim After I modified the code with an if-not-null-test like discussed above(fork this repo and then modify) , it seems that no devices crash with this error any more. U may try this if the official still faces this. |
I will give it a try when it happens again. Thanks @coolguy001tv |
@pawlowskim Good luck to you. Besides, we've already updated rn with 0.58.1. |
@pawlowskim did the fix @coolguy001tv suggest work for you? |
@henrymoulton Not occurred again yet. |
Sounds good, rather than forking I've used patch-package, @coolguy001tv was this the patch you recommend?
|
@henrymoulton Yes, this is the patch I recommend. Besides, I also recommend to modify Line 25 for the same reason: react-native-code-push/android/app/src/main/java/com/microsoft/codepush/react/FileUtils.java Line 25 in 3144c91
U may refer here to see my modification. |
Is the patch I'm applying, will feedback how it goes |
I have this issue also in production Thanks for the patch @henrymoulton, Has this worked for you? |
Currently away, will know soon.
On Wed, 11 Sep 2019 at 10:31, Adnan Khabbaz ***@***.***> wrote:
I have this issue also in production
[image: Screen Shot 2019-09-11 at 12 28 07 PM]
<https://user-images.githubusercontent.com/1051387/64685416-a5e26400-d48f-11e9-9693-b6482a7e41e1.png>
Thanks for the patch @henrymoulton <https://github.com/henrymoulton>, Has
this worked for you?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#1505?email_source=notifications&email_token=AHFTC7H3E3BLQRZA3GROXKDQJC3F5A5CNFSM4GRPK2PKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD6N4CSA#issuecomment-530301256>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AHFTC7FHETH2RQTRDE5NC3LQJC3F5ANCNFSM4GRPK2PA>
.
--
Best Regards,
Henry Moulton
|
@adnkh no longer seeing the com.microsoft.codepush.react.FileUtils.copyDirectoryContents error but still seeing the com.microsoft.codepush.react.FileUtils.deleteFileOrFolderSilently error |
@coolguy001tv did your patch resolve the |
@henrymoulton It never occurs again after using the patch. So I think it at least bypasses the |
We are also seeing this issue affecting numerous Huawei devices. Can anyone confirm whether the patch above (or another fix to prevent the crash) is likely to be merged into a release at some point please? |
@julianD77 Sorry I can't. Since microsoft code-push is so slow in China, we have to migrate to another code-push-like solution. |
Hi there. We investigated the problem and found the following:
Unfortunately applying the patch mentioned above in the issue is not an option, because it would just skip deletion which is not expected. Issue affects only some devices and caused by API to behave against the specification, and may be fixed with OS updates already or be fixed in the future. Until this fixed, we don't have solid solution for the code to work as expected on those devices. So right now I'm going just close the issue. |
Steps to Reproduce
1.crash log shows this error
Expected Behavior
no crash
Actual Behavior
crashed, here's the log:
Environment
react-native-code-push version:4.0.0-beta
react-native version:0.46.0 (I know it's so old, we're trying updating)
iOS/Android/Windows version: android
Does this reproduce on a debug build or release build? release
Does this reproduce on a simulator, or only on a physical device? physical device
Other Info
Actually there is a similar issue here #1458
which is not solved but closed.
This happens on a HuaWei Mate20 phone.
It is occasionally happened and I got no such a cellphone, so I cann't reproduct it.
According to the log above, it seems that the
deleteFileOrFolderSilently
should be responsible for the crash.https://github.com/Microsoft/react-native-code-push/blob/3144c916018fab077231e88d8718ad3a1cb0a7d8/android/app/src/main/java/com/microsoft/codepush/react/FileUtils.java#L74-L75
It seems that files is null? According to file.listFiles doc, this func should return
An array of abstract pathnames denoting the files and directories in the directory denoted by this abstract pathname. The array will be empty if the directory is empty. Returns null if this abstract pathname does not denote a directory, or if an I/O error occurs.
So, an I/O error occurs?
The text was updated successfully, but these errors were encountered: