protected static Result parseResponse ( String response ) throws SonarBreakException { ObjectMapper mapper = new ObjectMapper ( ) ; final DateFormat df = new SimpleDateFormat ( "yyyy-MM-dd'T'HH:mm:ss" ) ; mapper . setDateFormat ( df ) ; List < Result > results ; try { results = mapper . readValue ( response , new TypeReference < List < Result > > ( ) { } ) ; } catch ( IOException e ) { throw new SonarBreakException ( "Unable to parse the json into a List of QualityGateResults. Json is: " + response , e ) ; } if ( results == null || results . size ( ) != 1 ) { throw new SonarBreakException ( "Unable to deserialize JSON response: " + response ) ; } return results . get ( 0 ) ; }
Parses the string response from sonar into POJOs .