Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
3.3.0, 3.5.0
-
None
-
None
Description
This is the log of the exception:
03-16 20:38:33.961 31560-31859/com.f.tc E/FileTransfer﹕ {"code":3,"source":"https:\/\/localdev.f.com\/static\/tc\/resources\/css\/app.css","target":"file:\/\/\/data\/data\/com.f.tc\/files\/wwwTmp\/resources\/css\/app.css","http_status":200,"exception":"Attempt to read from field 'java.lang.String org.apache.cordova.file.LocalFilesystemURL.path' on a null object reference"} java.lang.NullPointerException: Attempt to read from field 'java.lang.String org.apache.cordova.file.LocalFilesystemURL.path' on a null object reference at org.apache.cordova.file.Filesystem.makeEntryForURL(Filesystem.java:56) at org.apache.cordova.file.Filesystem.makeEntryForNativeUri(Filesystem.java:91) at org.apache.cordova.file.Filesystem.makeEntryForFile(Filesystem.java:99) at org.apache.cordova.file.FileUtils.getEntryForFile(FileUtils.java:895) at org.apache.cordova.filetransfer.FileTransfer$4.run(FileTransfer.java:902) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587) at java.lang.Thread.run(Thread.java:818)
The fix is that in FileSystem.java, the following method:
public JSONObject makeEntryForNativeUri(Uri nativeUri) { LocalFilesystemURL inputUrl = toLocalUri(nativeUri); return makeEntryForURL(inputUrl, nativeUri); }
should be changed to:
public JSONObject makeEntryForNativeUri(Uri nativeUri) { LocalFilesystemURL inputUrl = toLocalUri(nativeUri); return inputUrl != null ? makeEntryForURL(inputUrl, nativeUri) : null; }
With that change, I can successfully download the file using FileTransfer, which depends on the File plugin.