Modify

Opened 6 years ago

Last modified 18 months ago

#17201 new task

fix common typo in progressMonitor beginTask()

Reported by: GerdP Owned by: team
Priority: normal Milestone:
Component: Core Version:
Keywords: progressmonitor Cc: gaben

Description (last modified by Don-vip)

Due to copy+paste we have quite a lot of sources with this error pattern:
Instead of

  progressMonitor.beginTask(tr("Contacting Server...", 10));

it should be

  progressMonitor.beginTask(tr("Contacting Server..."), 10);

The effect is that many progress monitors show no progress because the default tick number is 10000.
I found this in the o5m plugin and in some core sources.

Other plugins matching the search pattern "beginTask\(tr.*[0..9]+\)\)" are:

plugins\cadastre-fr\src\org\openstreetmap\josm\plugins\fr\cadastre\download\CadastreServerReader.java
plugins\poly\src\poly\DownloadPolyTask.java
plugins\imagery-xml-bounds\src\org\openstreetmap\josm\plugins\imageryxmlbounds\io\JosmServerLocationReader.java
plugins\pbf\src\org\openstreetmap\josm\plugins\pbf\io\PbfServerReader.java

There may be more where the tick count is not given as a numerical constant.

Attachments (0)

Change History (14)

comment:1 by GerdP, 6 years ago

In 14688/josm:

see #17201 improve progressMonitor for internal osm (xml) importer

comment:2 by GerdP, 6 years ago

o5m plugin see [o34820]
pbf plugin see [o34848:34849]

comment:3 by GerdP, 6 years ago

In 14716/josm:

see #17201: Improve progress monitor: Let OsmImporter decide what task is following the parser

comment:4 by GerdP, 6 years ago

Oops, that did not yet work with some plugins. Reverted with r14717.

comment:5 by GerdP, 6 years ago

poly plugin see [o34965]

comment:6 by Don-vip, 5 years ago

Description: modified (diff)

comment:7 by Don-vip, 5 years ago

is this ticket fixed?

comment:8 by GerdP, 5 years ago

No, I still find these three sources with the mentioned pattern:

core\src\org\openstreetmap\josm\io\OsmServerLocationReader.java
plugins\cadastre-fr\src\org\openstreetmap\josm\plugins\fr\cadastre\download\CadastreServerReader.java
plugins\imagery-xml-bounds\src\org\openstreetmap\josm\plugins\imageryxmlbounds\io\JosmServerLocationReader.java

It is easy to fix the typo itself but it takes some time to really make the progress bar show a progress.

comment:9 by taylor.smock, 2 years ago

Slightly better regex: beginTask\(tr\([^){}]*?,.

Current locations:

plugins/pdfimport/src/org/openstreetmap/josm/plugins/pdfimport/pdfbox/PdfBoxParser.java
plugins/imagery-xml-bounds/src/org/openstreetmap/josm/plugins/imageryxmlbounds/io/JosmServerLocationReader.java
plugins/cadastre-fr/src/org/openstreetmap/josm/plugins/fr/cadastre/download/CadastreServerReader.java
plugins/trustosm/src/org/openstreetmap/josm/plugins/trustosm/io/SigReader.java
core/src/org/openstreetmap/josm/io/OsmServerLocationReader.java

comment:10 by taylor.smock, 2 years ago

In 36039/osm:

See #17201: fix common typo in progressMonitor beginTask()

comment:11 by taylor.smock, 2 years ago

In 18611/josm:

See #17201: fix common typo in progressMonitor beginTask()

comment:12 by GerdP, 2 years ago

Didn't check but did you also make sure that the progress bars really work? Typically it is not enough to fix the typo.

comment:13 by taylor.smock, 2 years ago

Keywords: progressmonitor added

It does work, with the caveat that nothing is actually setting the ticks in the doParse code. It is ticked in the parser code later, but not well.

Note: I don't actually consider the problem to be a typo -- we really ought to be throwing an exception of some kind when there is tr("messageWithoutPlaceholders", objectsForMessage).

What is happening (and why it effectively shows no progress) is that all the progress gets reported when everything is done.

So

  • Parent task
    • Child InputStream task (uses a StreamProgressUpdater to update the progress monitor, theoretically). This is supposed to modify the window title with the amount of data downloaded. It is not currently doing so.
    • Child Parser task which uses the InputStream from the InputStream task.

The inputstream task only provides progress at the end (unless the server gives us a content length) when the parser task closes the inputstream. Except we don't have it -- this is due to having a ChildProgress at this point.

Now the inputstream task is supposed to be indeterminate when that happens, so we should have the bouncing bar.

Anyway, we have a few levels of indirection that mean things don't work properly for ChildProgress dialogs.

Last edited 2 years ago by taylor.smock (previous) (diff)

comment:14 by gaben, 18 months ago

Cc: gaben added

Modify Ticket

Change Properties
Set your email in Preferences
Action
as new The owner will remain team.
as The resolution will be set. Next status will be 'closed'.
to The owner will be changed from team to the specified user.
Next status will be 'needinfo'. The owner will be changed from team to GerdP.
as duplicate The resolution will be set to duplicate. Next status will be 'closed'. The specified ticket will be cross-referenced with this ticket.
The owner will be changed from team to anonymous. Next status will be 'assigned'.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.