Changeset 2862 in josm for trunk/src/org/openstreetmap
- Timestamp:
- 2010-01-15T11:29:36+01:00 (15 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 1 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/ExceptionDialogUtil.java
r2801 r2862 15 15 import org.openstreetmap.josm.Main; 16 16 import org.openstreetmap.josm.io.ChangesetClosedException; 17 import org.openstreetmap.josm.io.MissingOAuthAccessTokenException; 17 18 import org.openstreetmap.josm.io.OsmApiException; 18 19 import org.openstreetmap.josm.io.OsmApiInitializationException; … … 269 270 270 271 /** 272 * Explains a {@see OsmApiException} which was thrown because accessing a protected 273 * resource was forbidden. 274 * 275 * @param e the exception 276 */ 277 public static void explainMissingOAuthAccessTokenException(MissingOAuthAccessTokenException e) { 278 HelpAwareOptionPane.showOptionDialog( 279 Main.parent, 280 ExceptionUtil.explainMissingOAuthAccessTokenException(e), 281 tr("Authenticationi failed"), 282 JOptionPane.ERROR_MESSAGE, 283 ht("/ErrorMessages#MissingOAuthAccessToken") 284 ); 285 } 286 287 /** 271 288 * Explains a {@see UnknownHostException} which has caused an {@see OsmTransferException}. 272 289 * This is most likely happening when there is an error in the API URL or when … … 340 357 } 341 358 359 if (e instanceof MissingOAuthAccessTokenException) { 360 explainMissingOAuthAccessTokenException((MissingOAuthAccessTokenException)e); 361 return; 362 } 363 342 364 if (e instanceof OsmApiException) { 343 365 OsmApiException oae = (OsmApiException) e; … … 368 390 return; 369 391 } 370 explainGeneric(e);371 }392 } 393 explainGeneric(e); 372 394 } 373 395 -
trunk/src/org/openstreetmap/josm/gui/io/UploadPrimitivesTask.java
r2825 r2862 228 228 @Override protected void realRun() throws SAXException, IOException { 229 229 try { 230 uploadloop: 230 uploadloop:while(true) { 231 231 try { 232 232 getProgressMonitor().subTask(tr("Uploading {0} objects ...", toUpload.getSize())); … … 241 241 break; 242 242 } catch(OsmTransferCancelledException e) { 243 e.printStackTrace(); 243 244 uploadCancelled = true; 244 245 return; … … 343 344 handleFailedUpload(lastException); 344 345 } 345 346 346 } 347 347 }; -
trunk/src/org/openstreetmap/josm/io/OsmConnection.java
r2801 r2862 118 118 OAuthAccessTokenHolder holder = OAuthAccessTokenHolder.getInstance(); 119 119 if (! holder.containsAccessToken()) 120 throw new OsmTransferException(tr("Failed to add an OAuth authentication header. There is currently no OAuth Access Token configured.")); 121 120 throw new MissingOAuthAccessTokenException(); 122 121 consumer.setTokenWithSecret(holder.getAccessTokenKey(), holder.getAccessTokenSecret()); 123 122 try { -
trunk/src/org/openstreetmap/josm/tools/ExceptionUtil.java
r2853 r2862 21 21 import org.openstreetmap.josm.gui.preferences.server.OAuthAccessTokenHolder; 22 22 import org.openstreetmap.josm.io.ChangesetClosedException; 23 import org.openstreetmap.josm.io.MissingOAuthAccessTokenException; 23 24 import org.openstreetmap.josm.io.OsmApi; 24 25 import org.openstreetmap.josm.io.OsmApiException; … … 41 42 + "Check the server URL in your preferences and your internet connection.</html>", Main.pref.get( 42 43 "osm-server.url", "http://api.openstreetmap.org/api")); 44 return msg; 45 } 46 47 48 /** 49 * Creates the error message 50 * 51 * @param e the exception 52 */ 53 public static String explainMissingOAuthAccessTokenException(MissingOAuthAccessTokenException e) { 54 e.printStackTrace(); 55 String msg = tr( 56 "<html>Failed to authenticate at the OSM server ''{0}''.<br>" 57 + "You are using OAuth to authenticate but currently there is no<br>" 58 + "OAuth Access Token configured.<br>" 59 + "Please open the Preferences Dialog and generate or enter an Access Token." 60 + "</html>", 61 Main.pref.get("osm-server.url", "http://api.openstreetmap.org/api") 62 ); 43 63 return msg; 44 64 }
Note:
See TracChangeset
for help on using the changeset viewer.