Ignore:
Timestamp:
2021-10-17T15:17:42+02:00 (3 years ago)
Author:
Don-vip
Message:

fix #21427 - further simplify UploadDialog (patch by marcello, modified)

  • The dialog was simplified by combining the function of two radiobuttons and one combobox into one combobox.
  • When an open changeset was selected on tab 2, existing tags on the open changeset could overwrite the data the user entered on tab 1. The user might spot this by looking closely at the tag table on tab 2, but then he may not. This non-obvious behaviour was removed.
  • The exception thrown when closing an already closed changeset was fixed.
  • More cosmetic changes to the dialog.
  • Maybe also a solution to #19319, #21387 (added revalidate()).
Location:
trunk/src/org/openstreetmap/josm/io
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/io/ChangesetClosedException.java

    r17840 r18283  
    3131    public static final String ERROR_HEADER_PATTERN = "The changeset (\\d+) was closed at (.*)";
    3232
     33    /**
     34     * Identifies when the changeset exception occurred.
     35     */
    3336    public enum Source {
    3437        /**
     
    4346         */
    4447        UPLOAD_DATA,
     48        /**
     49         * The exception was thrown when we tried to close a changeset.  Probably the changeset
     50         * already timed out on the server.
     51         * @since 18283
     52         */
     53        CLOSE_CHANGESET,
    4554        /**
    4655         * Unspecified source
     
    163172    }
    164173
     174    /**
     175     * Sets the source where the exception was thrown
     176     *
     177     * @param source the source where the exception was thrown
     178     */
    165179    public void setSource(Source source) {
    166180        this.source = source == null ? Source.UNSPECIFIED : source;
  • trunk/src/org/openstreetmap/josm/io/OsmApi.java

    r17506 r18283  
    388388                }
    389389            }
     390        } catch (ChangesetClosedException e) {
     391            e.setSource(ChangesetClosedException.Source.UPDATE_CHANGESET);
     392            throw e;
    390393        } catch (NumberFormatException e) {
    391394            throw new OsmTransferException(errHandler.apply(ret), e);
     
    529532            // send "\r\n" instead of empty string, so we don't send zero payload - workaround bugs in proxy software
    530533            sendPutRequest("changeset/" + changeset.getId() + "/close", "\r\n", monitor);
     534        } catch (ChangesetClosedException e) {
     535            e.setSource(ChangesetClosedException.Source.CLOSE_CHANGESET);
     536            throw e;
     537        } finally {
    531538            changeset.setOpen(false);
    532         } finally {
    533539            monitor.finishTask();
    534540        }
     
    565571            throws OsmTransferException {
    566572        try {
     573            ensureValidChangeset();
    567574            monitor.beginTask("", list.size() * 2);
    568             if (changeset == null)
    569                 throw new OsmTransferException(tr("No changeset present for diff upload."));
    570575
    571576            initialize(monitor);
     
    594599                    monitor.createSubTaskMonitor(ProgressMonitor.ALL_TICKS, false)
    595600            );
    596         } catch (OsmTransferException e) {
     601        } catch (ChangesetClosedException e) {
     602            e.setSource(ChangesetClosedException.Source.UPLOAD_DATA);
    597603            throw e;
    598604        } catch (XmlParsingException e) {
     
    752758                case HttpURLConnection.HTTP_CONFLICT:
    753759                    if (ChangesetClosedException.errorHeaderMatchesPattern(errorHeader))
    754                         throw new ChangesetClosedException(errorBody, ChangesetClosedException.Source.UPLOAD_DATA);
     760                        throw new ChangesetClosedException(errorBody, ChangesetClosedException.Source.UNSPECIFIED);
    755761                    else
    756762                        throw new OsmApiException(retCode, errorHeader, errorBody);
  • trunk/src/org/openstreetmap/josm/io/UploadStrategySpecification.java

    r12687 r18283  
    151151
    152152    @Override
     153    public String toString() {
     154        return String.format("Strategy: %s, ChunkSize: %d, Policy: %s, Close after: %b",
     155            strategy.toString(), chunkSize, policy == null ? "none" : policy.toString(), closeChangesetAfterUpload);
     156    }
     157
     158    @Override
    153159    public int hashCode() {
    154160        return Objects.hash(strategy, chunkSize, policy, closeChangesetAfterUpload);
Note: See TracChangeset for help on using the changeset viewer.