1919 */
2020package org .sonarsource .scanner .lib ;
2121
22- import com .eclipsesource .json .Json ;
23- import com .eclipsesource .json .JsonObject ;
24- import com .eclipsesource .json .JsonObject .Member ;
25- import com .eclipsesource .json .JsonValue ;
22+ import com .google .gson .stream .JsonReader ;
2623import java .io .File ;
2724import java .io .FileOutputStream ;
2825import java .io .IOException ;
2926import java .io .OutputStream ;
27+ import java .io .StringReader ;
3028import java .nio .file .FileVisitResult ;
3129import java .nio .file .Files ;
3230import java .nio .file .Path ;
@@ -49,18 +47,14 @@ public static Properties loadEnvironmentProperties(Map<String, String> env) {
4947 Properties props = new Properties ();
5048
5149 if (scannerParams != null ) {
52- try {
53-
54- JsonValue jsonValue = Json .parse (scannerParams );
55- JsonObject jsonObject = jsonValue .asObject ();
56- Iterator <Member > it = jsonObject .iterator ();
57-
58- while (it .hasNext ()) {
59- Member member = it .next ();
60- String key = member .getName ();
61- String value = member .getValue ().asString ();
50+ try (JsonReader reader = new JsonReader (new StringReader (scannerParams ))) {
51+ reader .beginObject ();
52+ while (reader .hasNext ()) {
53+ String key = reader .nextName ();
54+ String value = reader .nextString ();
6255 props .put (key , value );
6356 }
57+ reader .endObject ();
6458 } catch (Exception e ) {
6559 throw new IllegalStateException ("Failed to parse JSON in SONARQUBE_SCANNER_PARAMS environment variable" , e );
6660 }
0 commit comments