Audit header row tests fail on Windows
- Dominant language
- Kotlin
- Stars
- 790
- Forks
- 1.4k
- Avg merge
- 4d 15h
- Merged PRs (30d)
- 16
Description
From https://github.com/opendatakit/collect/pull/3518/commits/4eacab91d5f33bf3dceba87d4fc6ac6681116b6c: New AuditEvent logic attempts to insert a header row into an existing file using a temporary file and a rename operation, whose semantics are platform dependent and fail on Windows (surfacing as test failures when running Android Studio on Windows).
There was an attempt to address this in https://github.com/opendatakit/collect/pull/3518 but for test `openingForm_andThenEnteringIdentity_proceedsToForm` it resulted in
```
java.lang.RuntimeException: An error occurred while executing doInBackground()
FATAL EXCEPTION: AsyncTask #2
Process: org.odk.collect.android, PID: 7548
java.lang.RuntimeException: An error occurred while executing doInBackground()
at android.os.AsyncTask$3.done(AsyncTask.java:353)
at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:383)
at java.util.concurrent.FutureTask.setException(FutureTask.java:252)
at java.util.concurrent.FutureTask.run(FutureTask.java:271)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:245)
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)
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void java.io.FileWriter.write(java.lang.String)' on a null object reference
at org.odk.collect.android.formentry.audit.AuditEventSaveTask.doInBackground(AuditEventSaveTask.java:59)
at org.odk.collect.android.formentry.audit.AuditEventSaveTask.doInBackground(AuditEventSaveTask.java:23)
at android.os.AsyncTask$2.call(AsyncTask.java:333)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
... 4 more
```
Contributor guide
Research direction
Start with AuditEventSaveTask.java at line 59 and the failing openingForm_andThenEnteringIdentity_proceedsToForm test, then review the temporary-file and rename behavior described in PR #3518. Done means the audit header-row tests pass when Android Studio runs on Windows without the null FileWriter exception.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, java
- Domain
- mobile, operating-systems, testing
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100