Modify

Opened 13 months ago

Last modified 3 months ago

#21886 new defect

[WIP patch] Download Dialog incorrectly reports note area rejection

Reported by: gaben Owned by: team
Priority: minor Milestone:
Component: Core Version:
Keywords: template_report download note area reject Cc:

Description

What steps will reproduce the problem?

  1. Open download dialog
  2. Play with the bounding box while only the OSM data download checked
  3. Repeat step 2 with notes checked only

What is the expected result?

For note download the allowed bounding box is 100x greater than data, so the message should reflect that.

What happens instead?

The note's allowed bounding box size (25) ignored, the data restrictions (0.25) used instead.

Please provide any additional information below. Attach a screenshot if possible.

This patch fixes the issue, but the existing code not working as expected. See the comment.

  • src/org/openstreetmap/josm/gui/download/OSMDownloadSource.java

     
    340340            }
    341341
    342342            displaySizeCheckResult(DOWNLOAD_SOURCES.stream()
     343                    // this line doesn't work, but should: .filter(IDownloadSourceType::isEnabled)
     344                    .filter(type -> type.getCheckBox().isSelected())    //this works
    343345                    .anyMatch(type -> type.isDownloadAreaTooLarge(bbox)));
    344346        }
    345347
     
    414416        @Override
    415417        public boolean isDownloadAreaTooLarge(Bounds bound) {
    416418            // see max_request_area in
    417             // https://github.com/openstreetmap/openstreetmap-website/blob/master/config/example.application.yml
     419            // https://github.com/openstreetmap/openstreetmap-website/blob/master/config/settings.yml
    418420            return bound.getArea() > Config.getPref().getDouble("osm-server.max-request-area", 0.25);
    419421        }
    420422    }
     
    492494        @Override
    493495        public boolean isDownloadAreaTooLarge(Bounds bound) {
    494496            // see max_note_request_area in
    495             // https://github.com/openstreetmap/openstreetmap-website/blob/master/config/example.application.yml
     497            // https://github.com/openstreetmap/openstreetmap-website/blob/master/config/settings.yml
    496498            return bound.getArea() > Config.getPref().getDouble("osm-server.max-request-area-notes", 25);
    497499        }
    498500    }

Attachments (0)

Change History (13)

comment:1 Changed 13 months ago by gaben

Keywords: download note area reject added

comment:2 Changed 13 months ago by gaben

Summary: Download Dialog incorrectly reports note area rejection[WIP patch] Download Dialog incorrectly reports note area rejection

comment:3 Changed 12 months ago by gaben

Ping/up/whatever. I have no idea why IDownloadSourceType::isEnabled isn't working.

comment:4 Changed 12 months ago by taylor.smock

It looks like it is due to the preferences not being updated when the checkbox state changes.

isEnabled() calls getBooleanProperty().get().

EDIT: And the answer is in the javadoc

Determines the last state of the download type

Last edited 12 months ago by taylor.smock (previous) (diff)

comment:5 Changed 12 months ago by gaben

Is it desired? Because we are now dealing with two states. One for live and the other for stored checkbox (BooleanProperty) state.

For this reason, the javadoc is misleading.

Last edited 12 months ago by gaben (previous) (diff)

comment:6 Changed 12 months ago by taylor.smock

I cannot remember exactly why I did that, but most likely due to having a Cancel button (AKA don't persist changed state when user has canceled), which would kind of argue against live updates to the property.

comment:7 Changed 12 months ago by gaben

Checkbox states saved on the Download window close, doesn't matter if you cancel or download. See here and here.

comment:8 Changed 12 months ago by taylor.smock

In that case, we might as well add a new checkbox listener that updates the preferences. Which means we can remove the call in rememberSettings. But only if we notify plugins that use it.

comment:9 Changed 12 months ago by gaben

I'm not familiar with Java GUI programming, but I see listeners for download source checkboxes e.g. here.

comment:10 Changed 12 months ago by taylor.smock

Yes. That listener is defined here.

comment:11 Changed 5 months ago by gaben

What could be the solution, a new listener you mentioned in comment:8?

comment:12 in reply to:  8 Changed 3 months ago by gaben

Replying to taylor.smock:

In that case, we might as well add a new checkbox listener that updates the preferences. Which means we can remove the call in rememberSettings. But only if we notify plugins that use it.

How can I check which plugins are using the rememberSettings() function?

comment:13 Changed 3 months ago by taylor.smock

I'd probably start by doing a grep in a JOSM svn checkout (the one with core plugins).

Beyond that, we have a (currently broken) check-plugins ant target, which someone should probably fix.

I had a script for checking plugins using GitLab CI, but I don't know if it still works. It used japi.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as new The owner will remain team.
as The resolution will be set.
to The owner will be changed from team to the specified user.
The owner will change to gaben
as duplicate The resolution will be set to duplicate.The specified ticket will be cross-referenced with this ticket
The owner will be changed from team to anonymous.

Add Comment


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

 
Note: See TracTickets for help on using tickets.