Changeset 6582 in josm for trunk/src/org
- Timestamp:
- 2014-01-01T11:57:38+01:00 (11 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/oauth/OAuthParameters.java
r6453 r6582 91 91 */ 92 92 static public OAuthParameters createFromPreferences(Preferences pref) { 93 OAuthParameters parameters = createDefault(pref.get("osm-server.url" ));93 OAuthParameters parameters = createDefault(pref.get("osm-server.url", OsmApi.DEFAULT_API_URL)); 94 94 parameters.setConsumerKey(pref.get("oauth.settings.consumer-key", parameters.getConsumerKey())); 95 95 parameters.setConsumerSecret(pref.get("oauth.settings.consumer-secret", parameters.getConsumerSecret())); -
trunk/src/org/openstreetmap/josm/gui/oauth/OsmOAuthAuthorizationClient.java
r6268 r6582 35 35 import org.openstreetmap.josm.gui.progress.NullProgressMonitor; 36 36 import org.openstreetmap.josm.gui.progress.ProgressMonitor; 37 import org.openstreetmap.josm.io.OsmApi; 37 38 import org.openstreetmap.josm.io.OsmTransferCanceledException; 38 39 import org.openstreetmap.josm.tools.CheckParameterUtil; … … 61 62 */ 62 63 public OsmOAuthAuthorizationClient() { 63 oauthProviderParameters = OAuthParameters.createDefault(Main.pref.get("osm-server.url" ));64 oauthProviderParameters = OAuthParameters.createDefault(Main.pref.get("osm-server.url", OsmApi.DEFAULT_API_URL)); 64 65 consumer = oauthProviderParameters.buildConsumer(); 65 66 provider = oauthProviderParameters.buildProvider(consumer); -
trunk/src/org/openstreetmap/josm/gui/preferences/server/OsmApiUrlInputPanel.java
r6529 r6582 128 128 */ 129 129 public void initFromPreferences() { 130 String url = Main.pref.get("osm-server.url", null); 131 if (url == null) { 132 cbUseDefaultServerUrl.setSelected(true); 133 firePropertyChange(API_URL_PROP, null, OsmApi.DEFAULT_API_URL); 134 } else if (url.trim().equals(OsmApi.DEFAULT_API_URL)) { 130 String url = Main.pref.get("osm-server.url", OsmApi.DEFAULT_API_URL); 131 if (url.trim().equals(OsmApi.DEFAULT_API_URL)) { 135 132 cbUseDefaultServerUrl.setSelected(true); 136 133 firePropertyChange(API_URL_PROP, null, OsmApi.DEFAULT_API_URL); … … 146 143 */ 147 144 public void saveToPreferences() { 148 String old_url = Main.pref.get("osm-server.url", null);145 String old_url = Main.pref.get("osm-server.url", OsmApi.DEFAULT_API_URL); 149 146 if (cbUseDefaultServerUrl.isSelected()) { 150 147 Main.pref.put("osm-server.url", null); … … 154 151 Main.pref.put("osm-server.url", tfOsmServerUrl.getText().trim()); 155 152 } 156 String new_url = Main.pref.get("osm-server.url", null);153 String new_url = Main.pref.get("osm-server.url", OsmApi.DEFAULT_API_URL); 157 154 158 155 // When API URL changes, re-initialize API connection so we may adjust 159 156 // server-dependent settings. 160 if ( (old_url == null && new_url != null) || (old_url != null && !old_url.equals(new_url))) {157 if (!old_url.equals(new_url)) { 161 158 try { 162 159 OsmApi.getOsmApi().initialize(null); -
trunk/src/org/openstreetmap/josm/io/OsmApi.java
r6552 r6582 99 99 * 100 100 * @return the OsmApi 101 * @throws IllegalStateException thrown, if the preference <code>osm-server.url</code> is not set102 *103 101 */ 104 102 static public OsmApi getOsmApi() { 105 103 String serverUrl = Main.pref.get("osm-server.url", DEFAULT_API_URL); 106 if (serverUrl == null)107 throw new IllegalStateException(tr("Preference ''{0}'' missing. Cannot initialize OsmApi.", "osm-server.url"));108 104 return getOsmApi(serverUrl); 109 105 } -
trunk/src/org/openstreetmap/josm/tools/ExceptionUtil.java
r6362 r6582 52 52 String msg = tr( 53 53 "<html>Failed to initialize communication with the OSM server {0}.<br>" 54 + "Check the server URL in your preferences and your internet connection.", Main.pref.get(55 54 + "Check the server URL in your preferences and your internet connection.", 55 Main.pref.get("osm-server.url", OsmApi.DEFAULT_API_URL)); 56 56 return msg; 57 57 }
Note:
See TracChangeset
for help on using the changeset viewer.