Ignore:
Timestamp:
2016-05-30T09:24:08+02:00 (3 years ago)
Author:
Don-vip
Message:

fix #12583 - fix unit tests by adding a new mode to HttpClient. Don't know if it's the best way to do it...

File:
1 edited

Legend:

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

    r9669 r10302  
    1919    private final StreamProgressUpdater updater;
    2020    private final OutputStream out;
     21    private final boolean finishOnClose;
    2122
    2223    /**
     
    2627     * @param size the total size which will be sent
    2728     * @param progressMonitor the monitor to report to
     29     * @param finishOnClose whether to call {@link ProgressMonitor#finishTask} when this stream is closed
     30     * @since 10302
    2831     */
    29     public ProgressOutputStream(OutputStream out, long size, ProgressMonitor progressMonitor) {
    30         if (progressMonitor == null) {
    31             progressMonitor = NullProgressMonitor.INSTANCE;
    32         }
    33         this.updater = new StreamProgressUpdater(size, progressMonitor, tr("Uploading data ..."));
     32    public ProgressOutputStream(OutputStream out, long size, ProgressMonitor progressMonitor, boolean finishOnClose) {
     33        this.updater = new StreamProgressUpdater(size,
     34                progressMonitor != null ? progressMonitor : NullProgressMonitor.INSTANCE, tr("Uploading data ..."));
    3435        this.out = out;
     36        this.finishOnClose = finishOnClose;
    3537    }
    3638
     
    5254            out.close();
    5355        } finally {
    54             updater.finishTask();
     56            if (finishOnClose) {
     57                updater.finishTask();
     58            }
    5559        }
    5660    }
Note: See TracChangeset for help on using the changeset viewer.