Ignore:
Timestamp:
15.06.2009 20:22:46 (3 years ago)
Author:
Gubaer
Message:

fixed: bug in OsmApi.getOsmApi()
cleanup: exception handling in interfacing with OSM API
new: new action for updating individual elements with the their current state on the server (including new menu item in the file menu)
new: improved user feedback in case of conflicts
new: handles 410 Gone conflicts when uploading a changeset
new: undoable command for "purging" a primitive from the current dataset (necessary if the primitive is already deleted on the server and the user wants to remove it from its local dataset)
new: undoable command for "undeleting" an already deleted primitive on the server (kind of "cloning")
new: after a full upload, checks whether there are primitives in the local dataset which might be deleted on the server.
new: data structures for history data
new: history download support in io package

File:
1 edited

Legend:

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

    r1169 r1670  
    2222    private PleaseWaitDialog pleaseWaitDlg; 
    2323 
    24     public class OsmServerException extends IOException { 
    25         private OsmServerException(String e) { 
    26             super(e); 
    27         } 
    28     } 
    29  
    30     public ProgressInputStream(URLConnection con, PleaseWaitDialog pleaseWaitDlg) throws IOException, OsmServerException { 
     24    public ProgressInputStream(URLConnection con, PleaseWaitDialog pleaseWaitDlg) throws OsmTransferException { 
    3125        this.connection = con; 
    3226 
     
    3529        } catch (IOException e) { 
    3630            if (con.getHeaderField("Error") != null) 
    37                 throw new OsmServerException(tr(con.getHeaderField("Error"))); 
    38             throw e; 
     31                throw new OsmTransferException(tr(con.getHeaderField("Error"))); 
     32            throw new OsmTransferException(e); 
    3933        } 
    4034 
     
    4337        if (pleaseWaitDlg == null) 
    4438            return; 
    45         if (contentLength > 0) 
     39        if (contentLength > 0) { 
    4640            pleaseWaitDlg.progress.setMaximum(contentLength); 
    47         else 
     41        } else { 
    4842            pleaseWaitDlg.progress.setMaximum(0); 
     43        } 
    4944        pleaseWaitDlg.progress.setValue(0); 
    5045    } 
     
    5651    @Override public int read(byte[] b, int off, int len) throws IOException { 
    5752        int read = in.read(b, off, len); 
    58         if (read != -1) 
     53        if (read != -1) { 
    5954            advanceTicker(read); 
     55        } 
    6056        return read; 
    6157    } 
     
    6359    @Override public int read() throws IOException { 
    6460        int read = in.read(); 
    65         if (read != -1) 
     61        if (read != -1) { 
    6662            advanceTicker(1); 
     63        } 
    6764        return read; 
    6865    } 
     
    7673            return; 
    7774 
    78         if (pleaseWaitDlg.progress.getMaximum() == 0 && connection.getContentLength() != -1) 
     75        if (pleaseWaitDlg.progress.getMaximum() == 0 && connection.getContentLength() != -1) { 
    7976            pleaseWaitDlg.progress.setMaximum(connection.getContentLength()); 
     77        } 
    8078 
    8179        readSoFar += amount; 
     
    8987            String cur = pleaseWaitDlg.currentAction.getText(); 
    9088            int i = cur.indexOf(' '); 
    91             if (i != -1) 
     89            if (i != -1) { 
    9290                cur = cur.substring(0, i) + progStr; 
    93             else 
     91            } else { 
    9492                cur += progStr; 
     93            } 
    9594            pleaseWaitDlg.currentAction.setText(cur); 
    9695        } 
Note: See TracChangeset for help on using the changeset viewer.