Skip to content

App crashes while reading file on android, Error: java.lang.NumberFormatException #79

Open
@shubhnik

Description

@shubhnik

Versions:

"react-native-fetch-blob": "0.10.8"
"react-native": "0.49.5"

I was reading a file using this code:

RNFetchBlob.fs
      .readFile(filePath, "ascii")
      .then(data => {
        this.showProgressModal = true;
        ...
      }).catch(e){}

On Android device I got this error and app crashes:

java.lang.NumberFormatException: For input string: "raw:/storage/emulated/0/Download/Bittrexv1.csv"
                                                                             at java.lang.Long.parseLong(Long.java:590)
                                                                             at java.lang.Long.valueOf(Long.java:804)
                                                                             at com.RNFetchBlob.Utils.PathResolver.getRealPathFromURI(PathResolver.java:41)
                                                                             at com.RNFetchBlob.RNFetchBlobFS.normalizePath(RNFetchBlobFS.java:918)
                                                                             at com.RNFetchBlob.RNFetchBlobFS.readFile(RNFetchBlobFS.java:141)
                                                                             at com.RNFetchBlob.RNFetchBlob$6.run(RNFetchBlob.java:208)
                                                                             at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
                                                                             at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
                                                                             at java.lang.Thread.run(Thread.java:764)

PS. Its working fine on Android emulator and ios simulator. Haven't tested on ios device yet. Please let me know if more information is needed to debug the issue, Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions