Skip to content
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

OFX export fails with FileNotFoundException #448

Closed
rivaldi8 opened this issue Dec 5, 2015 · 2 comments
Closed

OFX export fails with FileNotFoundException #448

rivaldi8 opened this issue Dec 5, 2015 · 2 comments

Comments

@rivaldi8
Copy link
Collaborator

rivaldi8 commented Dec 5, 2015

Exporting transactions in OFX format fail if there's a difference in the wall clock time between the start and end of the export.

E/ExportAsyncTask: /data/data/org.gnucash.android.devel/cache/OFX/20151204_175635_gnucash_export.ofx (No such file or directory)
E/SchedulerService: org.gnucash.android.export.Exporter$ExporterException: Failed to generate Open Financial eXchange-/data/data/org.gnucash.android.devel/cache/OFX/20151204_175635_gnucash_export.ofx (No such file or directory)
W/dalvikvm: threadid=17: thread exiting with uncaught exception (group=0x401e1560)
E/AndroidRuntime: FATAL EXCEPTION: AsyncTask #2
                  java.lang.RuntimeException: An error occured while executing doInBackground()
                      at android.os.AsyncTask$3.done(AsyncTask.java:200)
                      at java.util.concurrent.FutureTask$Sync.innerSetException(FutureTask.java:274)
                      at java.util.concurrent.FutureTask.setException(FutureTask.java:125)
                      at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:308)
                      at java.util.concurrent.FutureTask.run(FutureTask.java:138)
                      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1088)
                      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:581)
                      at java.lang.Thread.run(Thread.java:1019)
                   Caused by: org.gnucash.android.export.Exporter$ExporterException: Failed to generate Open Financial eXchange-/data/data/org.gnucash.android.devel/cache/OFX/20151204_175635_gnucash_export.ofx (No such file or directory)
                      at org.gnucash.android.export.ExportAsyncTask.moveExportToSDCard(ExportAsyncTask.java:355)
                      at org.gnucash.android.export.ExportAsyncTask.doInBackground(ExportAsyncTask.java:184)
                      at org.gnucash.android.export.ExportAsyncTask.doInBackground(ExportAsyncTask.java:79)
                      at android.os.AsyncTask$2.call(AsyncTask.java:185)
                      at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:306)
                      at java.util.concurrent.FutureTask.run(FutureTask.java:138) 
                      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1088) 
                      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:581) 
                      at java.lang.Thread.run(Thread.java:1019) 
                   Caused by: java.io.FileNotFoundException: /data/data/org.gnucash.android.devel/cache/OFX/20151204_175635_gnucash_export.ofx (No such file or directory)
                      at org.apache.harmony.luni.platform.OSFileSystem.open(Native Method)
                      at dalvik.system.BlockGuard$WrappedFileSystem.open(BlockGuard.java:232)
                      at java.io.FileInputStream.<init>(FileInputStream.java:80)
                      at org.gnucash.android.export.ExportAsyncTask.moveFile(ExportAsyncTask.java:457)
                      at org.gnucash.android.export.ExportAsyncTask.moveExportToSDCard(ExportAsyncTask.java:350)
                      at org.gnucash.android.export.ExportAsyncTask.doInBackground(ExportAsyncTask.java:184) 
                      at org.gnucash.android.export.ExportAsyncTask.doInBackground(ExportAsyncTask.java:79) 
                      at android.os.AsyncTask$2.call(AsyncTask.java:185) 
                      at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:306) 
                      at java.util.concurrent.FutureTask.run(FutureTask.java:138) 
                      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1088) 
                      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:581) 
                      at java.lang.Thread.run(Thread.java:1019) 

It happens when the second call to Export.getExportCacheFilePath() in
OfxExporter.generateExport() returns a file name with a time stamp different to
the first call in the same method. The root of the problem is
getExportCacheFilePath(), which builds the file name with the current time.

Received through Crashlitics as issue #129.

@rivaldi8
Copy link
Collaborator Author

rivaldi8 commented Dec 5, 2015

I'm preparing a fix.

@codinguser
Copy link
Owner

Cool. Looking forward.
Please send it to hotfix/patches
On Dec 5, 2015 19:25, "Àlex Magaz Graça" notifications@github.com wrote:

I'm preparing a fix.


Reply to this email directly or view it on GitHub
#448 (comment)
.

rivaldi8 added a commit to rivaldi8/gnucash-android that referenced this issue Dec 7, 2015
…same filename.

The filename returned by getExportCacheFilePath() contains a timestamp,
which can change if called multiple times.

Fixes codinguser#448
codinguser added a commit that referenced this issue Dec 7, 2015
…found

Fix OFX export fails with FileNotFoundException

Fixes #448
@rivaldi8 rivaldi8 closed this as completed Dec 7, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants