getodk / briefcase

ODK Briefcase is a Java application for fetching and pushing forms and their contents. It helps make billions of data points from ODK portable. Contribute and make the world a better place! ✨💼✨
https://docs.getodk.org/briefcase-intro
Other
60 stars 154 forks source link

Error in log from missing metadata.json #818

Closed yanokwa closed 4 years ago

yanokwa commented 4 years ago

Briefcase on the CLI reports an error:

Unexpected error in Briefcase. Please review briefcase.log for more information. For help, post to https://forum.opendatakit.org/c/support

The log has

java.io.UncheckedIOException: java.nio.file.NoSuchFileException: uga/ODK Briefcase Storage/uga/ODK Briefcase Storage/forms/IOMHHSurveyer_V6/metadata.json
    at org.opendatakit.briefcase.reused.UncheckedFiles.write(UncheckedFiles.java:80)
    at org.opendatakit.briefcase.reused.UncheckedFiles.write(UncheckedFiles.java:73)
    at org.opendatakit.briefcase.model.form.FileSystemFormMetadataAdapter.serialize(FileSystemFormMetadataAdapter.java:123)
    at org.opendatakit.briefcase.model.form.FileSystemFormMetadataAdapter.persist(FileSystemFormMetadataAdapter.java:96)
    at java.base/java.util.stream.ReferencePipeline$11$1.accept(ReferencePipeline.java:441)
    at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1621)
    at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484)
    at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474)
    at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:913)
    at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
    at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:578)
    at org.opendatakit.briefcase.model.form.FileSystemFormMetadataAdapter.syncWithFilesAt(FileSystemFormMetadataAdapter.java:75)
    at org.opendatakit.briefcase.model.form.FileSystemFormMetadataAdapter.at(FileSystemFormMetadataAdapter.java:33)
    at org.opendatakit.briefcase.operations.PullFormFromAggregate.pullFormFromAggregate(PullFormFromAggregate.java:90)
    at org.opendatakit.briefcase.operations.PullFormFromAggregate.lambda$static$0(PullFormFromAggregate.java:69)
    at org.opendatakit.common.cli.Cli.lambda$run$4(Cli.java:130)
    at java.base/java.lang.Iterable.forEach(Iterable.java:75)
    at org.opendatakit.common.cli.Cli.run(Cli.java:127)
    at org.opendatakit.briefcase.Launcher.main(Launcher.java:90)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:567)
    at org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoader.java:58)
Caused by: java.nio.file.NoSuchFileException: uga/ODK Briefcase Storage/uga/ODK Briefcase Storage/forms/IOMHHSurveyer_V6/metadata.json
    at java.base/sun.nio.fs.UnixException.translateToIOException(UnixException.java:92)
    at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:111)
    at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:116)
    at java.base/sun.nio.fs.UnixFileSystemProvider.newByteChannel(UnixFileSystemProvider.java:219)
    at java.base/java.nio.file.spi.FileSystemProvider.newOutputStream(FileSystemProvider.java:478)
    at java.base/java.nio.file.Files.newOutputStream(Files.java:223)
    at java.base/java.nio.file.Files.write(Files.java:3488)
    at org.opendatakit.briefcase.reused.UncheckedFiles.write(UncheckedFiles.java:78)
    ... 23 common frames omitted
ggalmazor commented 4 years ago

So, I have a couple of questions:

yanokwa commented 4 years ago

It is not breaking. Just something I see in the logs. I get this error pulling from Aggregate on the CLI. If it's not a harmful error, it shouldn't be exposed to the user. If it is a harmful error, we should fix it.

ggalmazor commented 4 years ago

It sounds like you're right and we shouldn't show that in the logs, but after looking to the source code, I think we might improve the code a little bit to prevent the error.

FileSystemFormMetadataAdapter.serialize() is responsible for writing metadata files in the storage directory. We could ensure the directory exists before trying to do so as we do in other places.

grantrzchan commented 4 years ago

Hi there @yanokwa and @ggalmazor, this looks like a good first issue that I can contribute to. Can I take a stab at it?

ggalmazor commented 4 years ago

Sure! I'll assign the issue to you :)

Thanks, @grantrzchan!

getodk-bot commented 4 years ago

Hello @grantrzchan, you have been unassigned from this issue because you have not updated this issue or any referenced pull requests for over 15 days.

You can reclaim this issue or claim any other issue by commenting @opendatakit-bot claim on that issue.

Thanks for your contributions, and hope to see you again soon!

grantrzchan commented 4 years ago

hi there, yes I am still working on this issue. My day job got in the way, but I should be able to start this weekend.

narbigcito commented 4 years ago

@opendatakit-bot claim

getodk-bot commented 4 years ago

Welcome to Open Data Kit, @narbigcito! We just sent you an invite to collaborate on this repository at https://github.com/opendatakit/briefcase/invitations. Please accept this invite in order to claim this issue and begin a fun and rewarding experience contributing to Open Data Kit!

Here are some tips to get you off to a good start:

See you on the other side (that is, the pull request side)!

getodk-bot commented 4 years ago

Hello @narbigcito, you have been unassigned from this issue because you have not updated this issue or any referenced pull requests for over 15 days.

You can reclaim this issue or claim any other issue by commenting @opendatakit-bot claim on that issue.

Thanks for your contributions, and hope to see you again soon!

cletusajibade commented 4 years ago

@opendatakit-bot claim

getodk-bot commented 4 years ago

Welcome to Open Data Kit, @cletusajibade! We just sent you an invite to collaborate on this repository at https://github.com/opendatakit/briefcase/invitations. Please accept this invite in order to claim this issue and begin a fun and rewarding experience contributing to Open Data Kit!

Here are some tips to get you off to a good start:

See you on the other side (that is, the pull request side)!

getodk-bot commented 4 years ago

Hello @cletusajibade, you have been unassigned from this issue because you have not updated this issue or any referenced pull requests for over 15 days.

You can reclaim this issue or claim any other issue by commenting @opendatakit-bot claim on that issue.

Thanks for your contributions, and hope to see you again soon!

cletusajibade commented 4 years ago

Yes, I am still working on it. I just sent a pull request yesterday and the tests passed.