[ https://issues.apache.org/jira/browse/CB-8689?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14365139#comment-14365139 ]
ASF subversion and git services commented on CB-8689: ----------------------------------------------------- Commit 5b1afc28123e8fbe2b09a278ca748914c22b3ca1 in cordova-plugin-file's branch refs/heads/master from [~agrieve] [ https://git-wip-us.apache.org/repos/asf?p=cordova-plugin-file.git;h=5b1afc2 ] CB-8689 Fix NPE in makeEntryForNativeUri (was affecting file-transfer) Regression was introduced in a recent commit and was never released. > Unhandled NullPointerException thrown resolving a file entry > ------------------------------------------------------------ > > Key: CB-8689 > URL: https://issues.apache.org/jira/browse/CB-8689 > Project: Apache Cordova > Issue Type: Bug > Components: Plugin File > Affects Versions: 3.3.0, 3.5.0 > Reporter: Jacob G > > This is the log of the exception: > {noformat} > 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) > {noformat} > The fix is that in FileSystem.java, the following method: > {code} > public JSONObject makeEntryForNativeUri(Uri nativeUri) { > LocalFilesystemURL inputUrl = toLocalUri(nativeUri); > return makeEntryForURL(inputUrl, nativeUri); > } > {code} > should be changed to: > {code} > public JSONObject makeEntryForNativeUri(Uri nativeUri) { > LocalFilesystemURL inputUrl = toLocalUri(nativeUri); > return inputUrl != null ? makeEntryForURL(inputUrl, nativeUri) : null; > } > {code} > With that change, I can successfully download the file using FileTransfer, > which depends on the File plugin. -- This message was sent by Atlassian JIRA (v6.3.4#6332) --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org For additional commands, e-mail: issues-h...@cordova.apache.org