Changeset 2852 in josm for trunk/src/org
- Timestamp:
- 2010-01-13T20:20:51+01:00 (15 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/io
- Files:
-
- 16 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/io/ChangesetQuery.java
r2822 r2852 5 5 6 6 import java.text.DateFormat; 7 import java.text.MessageFormat; 7 8 import java.text.ParseException; 8 9 import java.text.SimpleDateFormat; … … 56 57 public ChangesetQuery forUser(int uid) throws IllegalArgumentException{ 57 58 if (uid <= 0) 58 throw new IllegalArgumentException( tr("Parameter ''{0}'' > 0 expected. Got ''{1}''.", "uid", uid));59 throw new IllegalArgumentException(MessageFormat.format("Parameter ''{0}'' > 0 expected. Got ''{1}''.", "uid", uid)); 59 60 this.uid = uid; 60 61 this.userName = null; … … 359 360 if (k.equals("uid")) { 360 361 if (queryParams.containsKey("display_name")) 361 throw new ChangesetQueryUrlException(tr("Can 't create a changeset query including both the query parameters 'uid' and 'display_name'"));362 throw new ChangesetQueryUrlException(tr("Cannot create a changeset query including both the query parameters ''uid'' and ''display_name''")); 362 363 csQuery.forUser(parseUid(queryParams.get("uid"))); 363 364 } else if (k.equals("display_name")) { 364 365 if (queryParams.containsKey("uid")) 365 throw new ChangesetQueryUrlException(tr("Can 't create a changeset query including both the query parameters 'uid' and 'display_name'"));366 throw new ChangesetQueryUrlException(tr("Cannot create a changeset query including both the query parameters ''uid'' and ''display_name''")); 366 367 csQuery.forUser(queryParams.get("display_name")); 367 368 } else if (k.equals("open")) { -
trunk/src/org/openstreetmap/josm/io/DefaultProxySelector.java
r2822 r2852 150 150 case USE_SYSTEM_SETTINGS: 151 151 if (!JVM_WILL_USE_SYSTEM_PROXIES) { 152 System.err.println(tr("Warning: the JVM is not configured to lookup proxies from the system settings. The property ' java.net.useSystemProxies' was missing at startup time. Won't use a proxy."));152 System.err.println(tr("Warning: the JVM is not configured to lookup proxies from the system settings. The property ''java.net.useSystemProxies'' was missing at startup time. Will not use a proxy.")); 153 153 return Collections.singletonList(Proxy.NO_PROXY); 154 154 } -
trunk/src/org/openstreetmap/josm/io/DiffResultProcessor.java
r2711 r2852 23 23 import org.openstreetmap.josm.gui.progress.NullProgressMonitor; 24 24 import org.openstreetmap.josm.gui.progress.ProgressMonitor; 25 import org.openstreetmap.josm.tools.CheckParameterUtil; 25 26 import org.xml.sax.Attributes; 26 27 import org.xml.sax.InputSource; … … 78 79 progressMonitor = NullProgressMonitor.INSTANCE; 79 80 } 80 if (diffUploadResponse == null) 81 throw new IllegalArgumentException(tr("Parameter ''{0}'' must not be null", "source")); 81 CheckParameterUtil.ensureParameterNotNull(diffUploadResponse, "diffUploadResponse"); 82 82 try { 83 83 progressMonitor.beginTask(tr("Parsing response from server...")); -
trunk/src/org/openstreetmap/josm/io/GpxExporter.java
r2181 r2852 12 12 import java.io.FileOutputStream; 13 13 import java.io.IOException; 14 import java.text.MessageFormat; 14 15 import java.util.Calendar; 15 16 … … 33 34 import org.openstreetmap.josm.gui.layer.Layer; 34 35 import org.openstreetmap.josm.gui.layer.OsmDataLayer; 36 import org.openstreetmap.josm.tools.CheckParameterUtil; 35 37 import org.openstreetmap.josm.tools.GBC; 36 38 … … 52 54 @Override 53 55 public void exportData(File file, Layer layer) throws IOException { 54 if (layer == null) 55 throw new IllegalArgumentException(tr("Parameter ''{0}'' must not be null.", "layer")); 56 CheckParameterUtil.ensureParameterNotNull(layer, "layer"); 56 57 if (!(layer instanceof OsmDataLayer) && !(layer instanceof GpxLayer)) 57 throw new IllegalArgumentException( tr("Expected instance of OsmDataLayer or GpxLayer. Got ''{0}''.", layer58 throw new IllegalArgumentException(MessageFormat.format("Expected instance of OsmDataLayer or GpxLayer. Got ''{0}''.", layer 58 59 .getClass().getName())); 59 if (file == null) 60 throw new IllegalArgumentException(tr("Parameter ''{0}'' must not be null.", "file")); 60 CheckParameterUtil.ensureParameterNotNull(file, "file"); 61 61 62 62 String fn = file.getPath(); -
trunk/src/org/openstreetmap/josm/io/MultiFetchServerObjectReader.java
r2771 r2852 25 25 import org.openstreetmap.josm.gui.progress.NullProgressMonitor; 26 26 import org.openstreetmap.josm.gui.progress.ProgressMonitor; 27 import org.openstreetmap.josm.tools.CheckParameterUtil; 27 28 28 29 /** … … 107 108 */ 108 109 protected void remember(DataSet ds, long id, OsmPrimitiveType type) throws IllegalArgumentException, NoSuchElementException{ 109 if (ds == null) 110 throw new IllegalArgumentException(tr("Parameter ''{0}'' must not be null.", "ds")); 110 CheckParameterUtil.ensureParameterNotNull(ds, "ds"); 111 111 if (id <= 0) return; 112 112 OsmPrimitive primitive = ds.getPrimitiveById(id, type); -
trunk/src/org/openstreetmap/josm/io/OsmApi.java
r2825 r2852 3 3 4 4 import static org.openstreetmap.josm.tools.I18n.tr; 5 import static org.openstreetmap.josm.tools.I18n.trn; 5 6 6 7 import java.io.BufferedReader; … … 33 34 import org.openstreetmap.josm.gui.progress.NullProgressMonitor; 34 35 import org.openstreetmap.josm.gui.progress.ProgressMonitor; 36 import org.openstreetmap.josm.tools.CheckParameterUtil; 35 37 import org.xml.sax.Attributes; 36 38 import org.xml.sax.InputSource; … … 132 134 */ 133 135 protected OsmApi(String serverUrl) { 134 if (serverUrl == null) 135 throw new IllegalArgumentException(tr("Parameter ''{0}'' must not be null.", "serverUrl")); 136 CheckParameterUtil.ensureParameterNotNull(serverUrl, "serverUrl"); 136 137 this.serverUrl = serverUrl; 137 138 } … … 306 307 */ 307 308 public void openChangeset(Changeset changeset, ProgressMonitor progressMonitor) throws OsmTransferException { 308 if (changeset == null) 309 throw new IllegalArgumentException(tr("Parameter ''{0}'' must not be null.", "changeset")); 309 CheckParameterUtil.ensureParameterNotNull(changeset, "changeset"); 310 310 try { 311 311 progressMonitor.beginTask((tr("Creating changeset..."))); … … 338 338 */ 339 339 public void updateChangeset(Changeset changeset, ProgressMonitor monitor) throws OsmTransferException { 340 if (changeset == null) 341 throw new IllegalArgumentException(tr("Parameter ''{0}'' must not be null.", "changeset")); 340 CheckParameterUtil.ensureParameterNotNull(changeset, "changeset"); 342 341 if (monitor == null) { 343 342 monitor = NullProgressMonitor.INSTANCE; … … 379 378 */ 380 379 public void closeChangeset(Changeset changeset, ProgressMonitor monitor) throws OsmTransferException { 381 if (changeset == null) 382 throw new IllegalArgumentException(tr("Parameter ''{0}'' must not be null.", "changeset")); 380 CheckParameterUtil.ensureParameterNotNull(changeset, "changeset"); 383 381 if (monitor == null) { 384 382 monitor = NullProgressMonitor.INSTANCE; … … 423 421 // Upload to the server 424 422 // 425 monitor.indeterminateSubTask(tr("Uploading {0} objects...", list.size())); 423 monitor.indeterminateSubTask( 424 trn("Uploading {0} object...", "Uploading {0} objects...", list.size(), list.size())); 426 425 String diffUploadResponse = sendRequest("POST", "changeset/" + changeset.getId() + "/upload", diffUploadRequest,monitor); 427 426 -
trunk/src/org/openstreetmap/josm/io/OsmChangesetContentParser.java
r2828 r2852 239 239 || qName.equals("relation")) { 240 240 if (currentModificationType == null) { 241 throwException(tr("Illegal document structure. Found node, way, or relation outside of ' create', 'modify', or 'delete'."));241 throwException(tr("Illegal document structure. Found node, way, or relation outside of ''create'', ''modify'', or ''delete''.")); 242 242 } 243 243 data.put(currentPrimitive, currentModificationType); -
trunk/src/org/openstreetmap/josm/io/OsmChangesetParser.java
r2828 r2852 5 5 import java.io.InputStream; 6 6 import java.io.InputStreamReader; 7 import java.text.MessageFormat; 7 8 import java.util.LinkedList; 8 9 import java.util.List; … … 195 196 return User.createOsmUser(id, name); 196 197 } catch(NumberFormatException e) { 197 throwException( tr("Illegal value for attribute ''uid''. Got ''{0}''.", uid));198 throwException(MessageFormat.format("Illegal value for attribute ''uid''. Got ''{0}''.", uid)); 198 199 } 199 200 return null; -
trunk/src/org/openstreetmap/josm/io/OsmExporter.java
r2396 r2852 13 13 import java.io.PrintWriter; 14 14 import java.io.Writer; 15 import java.text.MessageFormat; 15 16 16 17 import javax.swing.JOptionPane; … … 43 44 save(file, (OsmDataLayer) layer); 44 45 } else 45 throw new IllegalArgumentException( tr("Expected instance of OsmDataLayer. Got ''{0}''.", layer46 throw new IllegalArgumentException(MessageFormat.format("Expected instance of OsmDataLayer. Got ''{0}''.", layer 46 47 .getClass().getName())); 47 48 } -
trunk/src/org/openstreetmap/josm/io/OsmReader.java
r2751 r2852 5 5 import java.io.InputStream; 6 6 import java.io.InputStreamReader; 7 import java.text.MessageFormat; 7 8 import java.util.ArrayList; 8 9 import java.util.Collection; … … 33 34 import org.openstreetmap.josm.gui.progress.NullProgressMonitor; 34 35 import org.openstreetmap.josm.gui.progress.ProgressMonitor; 36 import org.openstreetmap.josm.tools.CheckParameterUtil; 35 37 import org.openstreetmap.josm.tools.DateUtils; 36 38 import org.xml.sax.Attributes; … … 325 327 return User.createOsmUser(id, name); 326 328 } catch(NumberFormatException e) { 327 throwException( tr("Illegal value for attribute ''uid''. Got ''{0}''.", uid));329 throwException(MessageFormat.format("Illegal value for attribute ''uid''. Got ''{0}''.", uid)); 328 330 } 329 331 return null; … … 586 588 progressMonitor = NullProgressMonitor.INSTANCE; 587 589 } 588 if (source == null) 589 throw new IllegalArgumentException(tr("Parameter ''{0}'' must not be null", "source")); 590 CheckParameterUtil.ensureParameterNotNull(source, "source"); 590 591 OsmReader reader = new OsmReader(); 591 592 try { -
trunk/src/org/openstreetmap/josm/io/OsmServerBackreferenceReader.java
r2578 r2852 5 5 6 6 import java.io.InputStream; 7 import java.text.MessageFormat; 7 8 import java.util.ArrayList; 8 9 import java.util.Collection; … … 16 17 import org.openstreetmap.josm.gui.progress.NullProgressMonitor; 17 18 import org.openstreetmap.josm.gui.progress.ProgressMonitor; 19 import org.openstreetmap.josm.tools.CheckParameterUtil; 18 20 19 21 /** … … 50 52 */ 51 53 public OsmServerBackreferenceReader(OsmPrimitive primitive) throws IllegalArgumentException { 52 if (primitive == null) 53 throw new IllegalArgumentException(tr("Parameter ''{0}'' must not be null.", "primitive")); 54 if (primitive.isNew()) 55 throw new IllegalArgumentException(tr("ID parameter ''{0}'' > 0 expected. Got ''{1}''.", "primitive", primitive.getId())); 54 CheckParameterUtil.ensureValidPrimitiveId(primitive, "primitive"); 56 55 this.id = primitive.getId(); 57 56 this.primitiveType = OsmPrimitiveType.from(primitive); … … 71 70 public OsmServerBackreferenceReader(long id, OsmPrimitiveType type) throws IllegalArgumentException { 72 71 if (id <= 0) 73 throw new IllegalArgumentException(tr("Parameter ''{0}'' > 0 expected. Got ''{1}''.", "id", id)); 74 if (type == null) 75 throw new IllegalArgumentException(tr("Parameter ''{0}'' must not be null.", "type")); 72 throw new IllegalArgumentException(MessageFormat.format("Parameter ''{0}'' > 0 expected. Got ''{1}''.", "id", id)); 73 CheckParameterUtil.ensureParameterNotNull(type, "type"); 76 74 this.id = id; 77 75 this.primitiveType = type; -
trunk/src/org/openstreetmap/josm/io/OsmServerChangesetReader.java
r2781 r2852 7 7 import java.io.InputStream; 8 8 import java.io.UnsupportedEncodingException; 9 import java.text.MessageFormat; 9 10 import java.util.ArrayList; 10 11 import java.util.Collection; … … 18 19 import org.openstreetmap.josm.gui.progress.NullProgressMonitor; 19 20 import org.openstreetmap.josm.gui.progress.ProgressMonitor; 21 import org.openstreetmap.josm.tools.CheckParameterUtil; 20 22 21 23 /** … … 51 53 */ 52 54 public List<Changeset> queryChangesets(ChangesetQuery query, ProgressMonitor monitor) throws OsmTransferException { 53 if (query == null) 54 throw new IllegalArgumentException(tr("Parameter ''{0}'' must not be null.", "query")); 55 CheckParameterUtil.ensureParameterNotNull(query, "query"); 55 56 if (monitor == null) { 56 57 monitor = NullProgressMonitor.INSTANCE; … … 86 87 public Changeset readChangeset(long id, ProgressMonitor monitor) throws OsmTransferException { 87 88 if (id <= 0) 88 throw new IllegalArgumentException( tr("Parameter ''{0}'' > 0 expected. Got ''{1}''.", "id", id));89 throw new IllegalArgumentException(MessageFormat.format("Parameter ''{0}'' > 0 expected. Got ''{1}''.", "id", id)); 89 90 if (monitor == null) { 90 91 monitor = NullProgressMonitor.INSTANCE; … … 171 172 public ChangesetDataSet downloadChangeset(int id, ProgressMonitor monitor) throws IllegalArgumentException, OsmTransferException { 172 173 if (id <= 0) 173 throw new IllegalArgumentException( tr("Expected value of type integer > 0 for parameter ''{0}'', got {1}", "id", id));174 throw new IllegalArgumentException(MessageFormat.format("Expected value of type integer > 0 for parameter ''{0}'', got {1}", "id", id)); 174 175 if (monitor == null) { 175 176 monitor = NullProgressMonitor.INSTANCE; -
trunk/src/org/openstreetmap/josm/io/OsmServerHistoryReader.java
r2512 r2852 5 5 6 6 import java.io.InputStream; 7 import java.text.MessageFormat; 7 8 8 9 import org.openstreetmap.josm.data.osm.DataSet; … … 10 11 import org.openstreetmap.josm.data.osm.history.HistoryDataSet; 11 12 import org.openstreetmap.josm.gui.progress.ProgressMonitor; 13 import org.openstreetmap.josm.tools.CheckParameterUtil; 12 14 13 15 /** … … 30 32 */ 31 33 public OsmServerHistoryReader(OsmPrimitiveType type, long id) throws IllegalArgumentException { 32 if (type == null) 33 throw new IllegalArgumentException(tr("Parameter ''{0}'' must not be null.", "type")); 34 CheckParameterUtil.ensureParameterNotNull(type, "type"); 34 35 if (id < 0) 35 throw new IllegalArgumentException( tr("Parameter ''{0}'' >= 0 expected. Got ''{1}''.", "id", id));36 throw new IllegalArgumentException(MessageFormat.format("Parameter ''{0}'' >= 0 expected. Got ''{1}''.", "id", id)); 36 37 this.primitiveType = type; 37 38 this.id = id; -
trunk/src/org/openstreetmap/josm/io/OsmServerObjectReader.java
r2711 r2852 6 6 import java.io.IOException; 7 7 import java.io.InputStream; 8 import java.text.MessageFormat; 8 9 9 10 import org.openstreetmap.josm.data.osm.DataSet; … … 13 14 import org.openstreetmap.josm.gui.progress.NullProgressMonitor; 14 15 import org.openstreetmap.josm.gui.progress.ProgressMonitor; 16 import org.openstreetmap.josm.tools.CheckParameterUtil; 15 17 import org.xml.sax.SAXException; 16 18 … … 40 42 public OsmServerObjectReader(long id, OsmPrimitiveType type, boolean full) throws IllegalArgumentException { 41 43 if (id <= 0) 42 throw new IllegalArgumentException(tr("Expected value > 0 for parameter ''{0}'', got {1}", "id", id)); 43 if (type == null) 44 throw new IllegalArgumentException(tr("Parameter ''{0}'' must not be null", "type")); 44 throw new IllegalArgumentException(MessageFormat.format("Expected value > 0 for parameter ''{0}'', got {1}", "id", id)); 45 CheckParameterUtil.ensureParameterNotNull(type, "type"); 45 46 this.id = new SimplePrimitiveId(id, type); 46 47 this.full = full; … … 57 58 */ 58 59 public OsmServerObjectReader(PrimitiveId id, boolean full) { 59 if (id == null) 60 throw new IllegalArgumentException(tr("Parameter ''{0}'' must not be null", "id")); 61 if (id.getUniqueId() <= 0) 62 throw new IllegalArgumentException(tr("Expected value > 0 for parameter ''{0}'', got {1}", "id.getUniqueId()", id.getUniqueId())); 60 CheckParameterUtil.ensureValidPrimitiveId(id, "id"); 63 61 this.id = id; 64 62 this.full = full; -
trunk/src/org/openstreetmap/josm/io/OsmServerReader.java
r2641 r2852 84 84 } catch (Exception e) { 85 85 e.printStackTrace(); 86 throw new OsmTransferException(tr("Could n't connect to the OSM server. Please check your internet connection."), e);86 throw new OsmTransferException(tr("Could not connect to the OSM server. Please check your internet connection."), e); 87 87 } 88 88 try { -
trunk/src/org/openstreetmap/josm/io/OsmServerWriter.java
r2825 r2852 4 4 import static org.openstreetmap.josm.tools.I18n.marktr; 5 5 import static org.openstreetmap.josm.tools.I18n.tr; 6 import static org.openstreetmap.josm.tools.I18n.trn; 6 7 7 8 import java.util.ArrayList; … … 18 19 import org.openstreetmap.josm.gui.progress.NullProgressMonitor; 19 20 import org.openstreetmap.josm.gui.progress.ProgressMonitor; 21 import org.openstreetmap.josm.tools.CheckParameterUtil; 20 22 21 23 /** … … 154 156 chunk.add(it.next()); 155 157 } 156 progressMonitor.setCustomText(tr("({0}/{1}) Uploading {2} objects...", i,numChunks,chunk.size())); 158 progressMonitor.setCustomText( 159 trn("({0}/{1}) Uploading {2} object...", 160 "({0}/{1}) Uploading {2} objects...", 161 chunk.size(), i, numChunks, chunk.size())); 157 162 processed.addAll(api.uploadDiff(chunk, progressMonitor.createSubTaskMonitor(ProgressMonitor.ALL_TICKS, false))); 158 163 } … … 176 181 */ 177 182 public void uploadOsm(UploadStrategySpecification strategy, Collection<OsmPrimitive> primitives, Changeset changeset, ProgressMonitor monitor) throws OsmTransferException { 178 if (changeset == null) 179 throw new IllegalArgumentException(tr("Parameter ''{0}'' must not be null", "changeset")); 183 CheckParameterUtil.ensureParameterNotNull(changeset, "changeset"); 180 184 processed = new LinkedList<OsmPrimitive>(); 181 185 monitor = monitor == null ? NullProgressMonitor.INSTANCE : monitor;
Note:
See TracChangeset
for help on using the changeset viewer.