Opened 16 months ago

Closed 15 months ago

Last modified 15 months ago

#17431 closed enhancement (fixed)

Improve readability of code regarding OsmDataLayer.validationErrors and ValidatorTreePanel

Reported by: GerdP Owned by: team
Priority: normal Milestone: 19.03
Component: Core validator Version:
Keywords: Cc:


There is a very confusing relation between the field public OsmDataLayer.validationErrors and the private field ValidatorTreePanel.errors. In some situations both refer to the same instance of ArrayList, but this is not guaranteed by the code. I assume the reason for this are unit tests.
The content of OsmDataLayer.validationErrors is directly modified in ValidateUploadHook and ValidatorErrorExporter.exportData() reads it.
The content of OsmDataLayer.validationErrors is also modified when ValidatorTreePanel.errors refers to the same object. This is controlled in ValidatorDialog.
My current understanding is that we have a single instance of ValidatorDialog and ValidatorTreePanel but possibly multiple instances of OsmDataLayer, so it seems to be correct to keep the error list in OsmDataLayer.validationErrors.
Question is why we don't use that field in the validator classes?

Attachments (0)

Change History (3)

comment:1 Changed 16 months ago by GerdP

In 14857/josm:

see #17401, #17431

  • make sure that list of errors is never null
  • performance: avoid to sort list of errors when only elemets were removed from an already sorted list. This reduces time spent to rebuild the tree when primitives are removed or errors are fixed with the Fix button.

comment:2 Changed 15 months ago by GerdP

Resolution: fixed
Status: newclosed

I think the current code is a bit clearer.

Question is why we don't use that field in the validator classes?

It makes the unit tests less complicated.

comment:3 Changed 15 months ago by Don-vip

Milestone: 19.03

Modify Ticket

Change Properties
Set your email in Preferences
as closed The owner will remain team.
as The resolution will be set.
The resolution will be deleted.

Add Comment

E-mail address and name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.