Changeset 2078 in josm for trunk/src


Ignore:
Timestamp:
2009-09-07T23:58:54+02:00 (15 years ago)
Author:
Gubaer
Message:

fixed #3413: ProgressException when uploading osmChange file

Location:
trunk/src/org/openstreetmap/josm/io
Files:
2 edited

Legend:

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

    r2070 r2078  
    338338                String value = atts.getValue("v");
    339339                current.rememberTag(key, value);
     340            } else {
     341                throwException(tr("Undefined element ''{0}'' found in input stream. Aborting.", qName));
    340342            }
    341343        }
  • trunk/src/org/openstreetmap/josm/io/OsmServerWriter.java

    r2074 r2078  
    9090    protected void uploadChangesIndividually(Collection<OsmPrimitive> primitives, Changeset changeset, ChangesetProcessingType changesetProcessingType, ProgressMonitor progressMonitor) throws OsmTransferException {
    9191        try {
     92            progressMonitor.beginTask(tr("Starting to upload with one request per primitive ..."));
    9293            progressMonitor.setTicksCount(primitives.size());
    9394            if (changesetProcessingType.isUseNew()) {
     
    102103                String msg = "";
    103104                switch(OsmPrimitiveType.from(osm)) {
    104                     case NODE: msg = marktr("{0}% ({1}/{2}), {3} left. Uploading node ''{4}'' (id: {5})"); break;
    105                     case WAY: msg = marktr("{0}% ({1}/{2}), {3} left. Uploading way ''{4}'' (id: {5})"); break;
    106                     case RELATION: msg = marktr("{0}% ({1}/{2}), {3} left. Uploading relation ''{4}'' (id: {5})"); break;
     105                case NODE: msg = marktr("{0}% ({1}/{2}), {3} left. Uploading node ''{4}'' (id: {5})"); break;
     106                case WAY: msg = marktr("{0}% ({1}/{2}), {3} left. Uploading way ''{4}'' (id: {5})"); break;
     107                case RELATION: msg = marktr("{0}% ({1}/{2}), {3} left. Uploading relation ''{4}'' (id: {5})"); break;
    107108                }
    108109                progressMonitor.subTask(
     
    135136                closeException.setChangeset(api.getCurrentChangeset());
    136137                throw closeException;
     138            } finally {
     139                progressMonitor.finishTask();
    137140            }
    138141        }
     
    150153        //
    151154        try {
     155            progressMonitor.beginTask(tr("Starting to upload in one request ..."));
    152156            if (changesetProcessingType.isUseNew()) {
    153157                api.createChangeset(changeset,progressMonitor.createSubTaskMonitor(0, false));
     
    167171                closeException.setChangeset(api.getCurrentChangeset());
    168172                throw closeException;
    169             }
     173            } finally {
     174                progressMonitor.finishTask();
     175            }
     176
    170177        }
    171178    }
     
    179186    public void uploadOsm(String apiVersion, Collection<OsmPrimitive> primitives, Changeset changeset, ChangesetProcessingType changesetProcessingType, ProgressMonitor progressMonitor) throws OsmTransferException {
    180187        processed = new LinkedList<OsmPrimitive>();
    181 
     188        progressMonitor.beginTask(tr("Uploading data ..."));
    182189        api.initialize(progressMonitor);
    183190        try {
     
    185192            //
    186193            boolean casUseDiffUploads = api.hasSupportForDiffUploads();
     194            if (apiVersion == null) {
     195                System.out.println(tr("WARNING: no API version defined for data to upload. Falling back to version 0.6"));
     196                apiVersion = "0.6";
     197            }
    187198            boolean useDiffUpload = Main.pref.getBoolean("osm-server.atomic-upload", apiVersion.compareTo("0.6")>=0);
    188199            if (useDiffUpload && ! casUseDiffUploads) {
     
    192203
    193204            if (useDiffUpload) {
    194                 progressMonitor.beginTask(tr("Starting to upload in one request ..."));
    195                 uploadChangesAsDiffUpload(primitives,changeset, changesetProcessingType, progressMonitor);
     205                uploadChangesAsDiffUpload(primitives,changeset, changesetProcessingType, progressMonitor.createSubTaskMonitor(0,false));
    196206            } else {
    197                 progressMonitor.beginTask(tr("Starting to upload with one request per primitive ..."));
    198                 uploadChangesIndividually(primitives,changeset,changesetProcessingType,  progressMonitor);
     207                uploadChangesIndividually(primitives,changeset,changesetProcessingType,  progressMonitor.createSubTaskMonitor(0,false));
    199208            }
    200209        } finally {
Note: See TracChangeset for help on using the changeset viewer.