diff options
author | Zipeng WU <zipeng.wu@sonarsource.com> | 2021-04-01 18:43:48 +0200 |
---|---|---|
committer | sonartech <sonartech@sonarsource.com> | 2021-04-01 20:03:45 +0000 |
commit | 39abd3de73733b18e99c5e81ab7f2dec45d9aec7 (patch) | |
tree | 99969d4909635846b354ed00c8df95f56f3917b7 | |
parent | e953a52312c1809ee1b46bf5d3186be4cc21cd94 (diff) | |
download | sonarqube-39abd3de73733b18e99c5e81ab7f2dec45d9aec7.tar.gz sonarqube-39abd3de73733b18e99c5e81ab7f2dec45d9aec7.zip |
Revert "SONAR-14642 - SSF-142"
This reverts commit 0810d5dcbc8e49b4f064223cd271225acb397e83.
3 files changed, 5 insertions, 14 deletions
diff --git a/server/sonar-webserver-ws/src/test/java/org/sonar/server/ws/WebServiceEngineTest.java b/server/sonar-webserver-ws/src/test/java/org/sonar/server/ws/WebServiceEngineTest.java index 7b86c69e5e7..fad9268dae5 100644 --- a/server/sonar-webserver-ws/src/test/java/org/sonar/server/ws/WebServiceEngineTest.java +++ b/server/sonar-webserver-ws/src/test/java/org/sonar/server/ws/WebServiceEngineTest.java @@ -208,7 +208,7 @@ public class WebServiceEngineTest { DumbResponse response = run(request, newWs("api/foo", a -> a.setHandler((req, resp) -> request.param("unknown")))); - assertThat(response.stream().outputAsString()).isEqualTo("{\"errors\":[{\"msg\":\"BUG - parameter \\u0027unknown\\u0027 is undefined for action \\u0027foo\\u0027\"}]}"); + assertThat(response.stream().outputAsString()).isEqualTo("{\"errors\":[{\"msg\":\"BUG - parameter 'unknown' is undefined for action 'foo'\"}]}"); assertThat(response.stream().status()).isEqualTo(400); } @@ -221,7 +221,7 @@ public class WebServiceEngineTest { a.setHandler((req, resp) -> request.mandatoryParam("bar")); })); - assertThat(response.stream().outputAsString()).isEqualTo("{\"errors\":[{\"msg\":\"The \\u0027bar\\u0027 parameter is missing\"}]}"); + assertThat(response.stream().outputAsString()).isEqualTo("{\"errors\":[{\"msg\":\"The 'bar' parameter is missing\"}]}"); assertThat(response.stream().status()).isEqualTo(400); } @@ -235,7 +235,7 @@ public class WebServiceEngineTest { a.setHandler((req, resp) -> request.param("bar")); })); - assertThat(response.stream().outputAsString()).isEqualTo("{\"errors\":[{\"msg\":\"The \\u0027bar\\u0027 parameter is missing\"}]}"); + assertThat(response.stream().outputAsString()).isEqualTo("{\"errors\":[{\"msg\":\"The 'bar' parameter is missing\"}]}"); assertThat(response.stream().status()).isEqualTo(400); } @@ -287,7 +287,7 @@ public class WebServiceEngineTest { a.setHandler((req, resp) -> resp.stream().output().write(req.mandatoryParam("format").getBytes(UTF_8))); })); - assertThat(response.stream().outputAsString()).isEqualTo("{\"errors\":[{\"msg\":\"Value of parameter \\u0027format\\u0027 (yml) must be one of: [json, xml]\"}]}"); + assertThat(response.stream().outputAsString()).isEqualTo("{\"errors\":[{\"msg\":\"Value of parameter 'format' (yml) must be one of: [json, xml]\"}]}"); assertThat(response.stream().status()).isEqualTo(400); } diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/utils/text/JsonWriter.java b/sonar-plugin-api/src/main/java/org/sonar/api/utils/text/JsonWriter.java index 569045ff18f..132978badd3 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/utils/text/JsonWriter.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/utils/text/JsonWriter.java @@ -74,7 +74,6 @@ public class JsonWriter implements AutoCloseable { this.stream = new com.google.gson.stream.JsonWriter(writer); this.stream.setSerializeNulls(false); this.stream.setLenient(false); - this.stream.setHtmlSafe(true); this.serializeEmptyStrings = true; } diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/utils/text/JsonWriterTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/utils/text/JsonWriterTest.java index 9ae97fcfa35..ad523fb74f9 100644 --- a/sonar-plugin-api/src/test/java/org/sonar/api/utils/text/JsonWriterTest.java +++ b/sonar-plugin-api/src/test/java/org/sonar/api/utils/text/JsonWriterTest.java @@ -152,15 +152,7 @@ public class JsonWriterTest { underTest.beginObject() .prop("foo", "<hello \"world\">") .endObject().close(); - expect("{\"foo\":\"\\u003chello \\\"world\\\"\\u003e\"}"); - } - - @Test - public void escape_html_characters() { - underTest.beginObject() - .prop("foo", "123<>abc") - .endObject().close(); - expect("{\"foo\":\"123\\u003c\\u003eabc\"}"); + expect("{\"foo\":\"<hello \\\"world\\\">\"}"); } @Test |