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 )
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 , 6 years ago
comment:6 by , 5 years ago
Description: | modified (diff) |
---|
comment:8 by , 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 , 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:12 by , 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 , 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.
- Child InputStream task (uses a
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.
comment:14 by , 18 months ago
Cc: | added |
---|
In 14688/josm: