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

Issue 831 ignore failing forms on startup #836

Closed ggalmazor closed 4 years ago

ggalmazor commented 4 years ago

Closes #831

What has been done to verify that this works as intended?

Why is this the best possible solution? Were any other approaches considered?

This is a straightforward change to ignore forms that can't be parsed while sync'ing files from the storage directory.

How does this change affect users? Describe intentional changes to behavior and behavior that could have accidentally been affected by code changes. In other words, what are the regression risks?

This should solve the issue. Users should expect a new log message "Couldn't parse form at /foo/ODK Briefcase Storage/forms/bar/bar.xml" each time Briefcase isn't able to sync a form for parsing reasons. The full stacktrace would include the causing error. In this case, having replaced the last > with a ? character:

2019-11-19 15:25:57,597 [main] ERROR o.o.b.m.f.FileSystemFormMetadataAdapter - Couldn't parse form at /tmp/cocotero/ODK Briefcase Storage/forms/fieldListSimpleTest/fieldListSimpleTest.xml
org.opendatakit.briefcase.reused.BriefcaseException: org.xmlpull.v1.XmlPullParserException: expected: '>' actual: '?' (position:END_TAG </h:html>@1:1553 in java.io.InputStreamReader@5bf8fa12) 
    at org.opendatakit.briefcase.export.XmlElement.from(XmlElement.java:94)
    at org.opendatakit.briefcase.model.form.FileSystemFormMetadataAdapter.isAForm(FileSystemFormMetadataAdapter.java:87)
    at java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:176)
    at java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:177)
    at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195)
    at java.base/java.util.Iterator.forEachRemaining(Iterator.java:133)
    at java.base/java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1801)
    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:74)
    at java.base/java.util.Optional.ifPresent(Optional.java:183)
    at org.opendatakit.briefcase.ui.MainBriefcaseWindow.<init>(MainBriefcaseWindow.java:115)
    at org.opendatakit.briefcase.ui.MainBriefcaseWindow.launchGUI(MainBriefcaseWindow.java:94)
    at org.opendatakit.briefcase.Launcher.lambda$main$0(Launcher.java:78)
    at org.opendatakit.common.cli.Cli.lambda$run$5(Cli.java:136)
    at java.base/java.lang.Iterable.forEach(Iterable.java:75)
    at org.opendatakit.common.cli.Cli.run(Cli.java:136)
    at org.opendatakit.briefcase.Launcher.main(Launcher.java:90)
Caused by: org.xmlpull.v1.XmlPullParserException: expected: '>' actual: '?' (position:END_TAG </h:html>@1:1553 in java.io.InputStreamReader@5bf8fa12) 
    at org.kxml2.io.KXmlParser.exception(Unknown Source)
    at org.kxml2.io.KXmlParser.error(Unknown Source)
    at org.kxml2.io.KXmlParser.read(Unknown Source)
    at org.kxml2.io.KXmlParser.parseEndTag(Unknown Source)
    at org.kxml2.io.KXmlParser.nextImpl(Unknown Source)
    at org.kxml2.io.KXmlParser.nextToken(Unknown Source)
    at org.kxml2.kdom.Element.parse(Unknown Source)
    at org.kxml2.kdom.Node.parse(Unknown Source)
    at org.kxml2.kdom.Element.parse(Unknown Source)
    at org.kxml2.kdom.Node.parse(Unknown Source)
    at org.kxml2.kdom.Document.parse(Unknown Source)
    at org.opendatakit.briefcase.export.XmlElement.from(XmlElement.java:91)
    ... 20 common frames omitted

Does this change require updates to documentation? If so, please file an issue at https://github.com/opendatakit/docs/issues/new and include the link below.

grzesiek2010 commented 4 years ago

It looks and works well. @kkrawczyk123 if you are free and really want to confirm please fell free if not we'll merge.

kkrawczyk123 commented 4 years ago

Confirmed on all systems. @opendatakit-bot label "behavior verified"