Skip to content

Commit

Permalink
Fix #23956: JsonParsingException when the destination server returns …
Browse files Browse the repository at this point in the history
…200 and a malformed document

In this case, the destination server performed a redirect via javascript in the
response.

git-svn-id: https://josm.openstreetmap.de/svn/trunk@19235 0c6e7542-c601-0410-84e7-c038aed88b3b
  • Loading branch information
taylor.smock committed Oct 8, 2024
1 parent eba1eca commit faed2ac
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions src/org/openstreetmap/josm/data/oauth/OAuthParameters.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import java.util.HashMap;
import java.util.Map;

import jakarta.json.stream.JsonParsingException;
import org.openstreetmap.josm.io.NetworkManager;
import org.openstreetmap.josm.io.OsmApi;
import org.openstreetmap.josm.io.auth.CredentialsAgentException;
Expand Down Expand Up @@ -94,7 +95,7 @@ private static JsonObject getRFC8414Parameters(String apiUrl) {
}
}
}
} catch (URISyntaxException | IOException e) {
} catch (JsonParsingException | URISyntaxException | IOException e) {
throw new JosmRuntimeException(e);
} finally {
if (client != null) {
Expand Down Expand Up @@ -157,7 +158,8 @@ private static OAuth20Parameters getDefaultOAuth20Parameters(String apiUrl) {
}
}
} catch (JosmRuntimeException e) {
if (e.getCause() instanceof URISyntaxException || e.getCause() instanceof IOException) {
if (e.getCause() instanceof URISyntaxException || e.getCause() instanceof IOException
|| e.getCause() instanceof JsonParsingException) {
Logging.trace(e);
} else {
throw e;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ protected JPanel buildHeaderInfoPanel() {
// the authorisation procedure
JMultilineLabel lbl = new JMultilineLabel(AuthorizationProcedure.FULLY_AUTOMATIC.getDescription());
lbl.setFont(lbl.getFont().deriveFont(Font.PLAIN));
pnl.add(lbl, GBC.std());
pnl.add(lbl, GBC.eol());

if (!Config.getUrls().getDefaultOsmApiUrl().equals(apiUrl)) {
final HtmlPanel pnlWarning = new HtmlPanel();
Expand Down

0 comments on commit faed2ac

Please sign in to comment.