question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Import invalid XML file (applies to all delimited import parsers)

See original GitHub issue

Description

Created a text file containing the following:

This is bad data
This is bad data
This is bad data
This is bad data

Try to import it using the XML importer - exceptions occur, then the importer reports successful import with a heap of exceptions.

Steps to Reproduce

  1. Create a file containing the above lines and save as baddata.xml
  2. Select File->Import->From Delimited File…
  3. Set Import file Parser to XML, then press the “+” button and locate the file, and press Open.
  4. Acknowledge warning dialog twice (this is an issue - see below)
  5. On the main import dialog press the Import button. (this is enabled despite no data being valid in file) Expected behaviour: [What you expect to happen]

Actual behaviour: At step 3, the following dialog is shown (twice) image After acknowledging twice, user is returned to main Import dialog, with the Import button enabled …

At step 5, despite data being invalid - so nothing to import, a dialog is raised suggesting “X” lines of data were imported along with multiple Exception dialogs. See below: image

Reproduces how often: 100%

Additional Information

One of the issues here is the code generating the “Success dialog” is independant of the actual import and just counting lines of text in the file.

So there are really 4 problems:

  1. Invalid XML files don’t get neatly handled up front … a single warning should be displayed.
  2. The import button is enabled (I can live with that if it doesn’t die ugly) - but when clicked tries to import invalid data.
  3. Press the import button and excpetions are thrown (ugly)
  4. The number of “rows” imported is in no way correlated to rows of records … in fact, this occurs even if the import XML is successful as the counter is assuming one record per line is is the case for CSV files. Surely we can get the number of records from the importer record list instead ?

This problem really needs to be checked for all importers in case there is similar.

Note: I fond the warning dialogs seem to pop up behind the import dialog generally so are hard to see… which means context is taken away from the user and the tool becomes un-useable until usr clicks back on the main window … at which point the warning dialogs appear.

Note 2: The “Success” dialog is displayed before the data is imported… surely you can only show success after the import is completed.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6

github_iconTop GitHub Comments

1reaction
Auriga2commented, Jun 26, 2020

Hi @arcturus2 Moving this to “In progress” as we are still working on this case.

1reaction
serpens24commented, Jun 11, 2020

I believe some refactoring related to the import dialog needs to be done to do 2 things:

  1. Dont provide the Import button unless it is known that there is data to import
  2. Refactor the dialog indicating how many rows were imported to use the actual values - rather than the number of lines in the source file … this is being created in CoreImportExportPlugins\src\au\gov\asd\tac\constellation\plugins\importexport\delimited\ActionPane.java line 92:

displayAlert("Success", "Successfully imported " + noOfRows + " rows from the following file(s):\n" + String.join("\n", filenames), true);

Read more comments on GitHub >

github_iconTop Results From Across the Web

Import XML data - Microsoft Support
This problem can occur when you select more than one XML data file to import, and Excel can't find a matching XML Map...
Read more >
An invalid XML character (Unicode: 0x1f) was found in ... - IBM
The importer tool generates XML from the spreadsheet's data to post the content to the ETM server. If the content contains invalid character, ......
Read more >
XML import fails if the file contains invalid XML characters #4928
There is no question that the file is not valid XML. It contains a single invalid character which has both its location (line...
Read more >
"Content is not allowed in prolog" when parsing perfectly valid ...
This error message is always caused by the invalid XML content in the beginning element. For example, extra small dot “.” in the...
Read more >
Importing XML - Wolfram Language Documentation
The first argument specifies the file to be imported. You can also specify an optional second argument to control the form of the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found