[wpiutil] DataLogWriter
constructor doesn't throw when file cannot be created
#7531
Labels
type: bug
Something isn't working.
Describe the bug
In Java, the constructor of
DataLogWriter
declared that it throws anIOException
if the file cannot be opened. When logging to a path that doesn't exist (/U/logs/...
with no USB stick attached), a native error is produced instead which crashes the robot program:This makes it difficult to utilize
DataLogWriter
even from a background thread, because an incidental error that would prevent logging (like a disconnected USB stick) can crash the robot program on startup. If the constructor throws an exception, this can be properly handled in user/library code.Expected behavior
The native constructor should catch the error and propagate to Java via JNI. I haven't tested the current behavior with the non-JNI version, but if applicable it should throw a similar error.
The text was updated successfully, but these errors were encountered: