Java tutorial
/** * Copyright(c)2015 IntelCorporation * * LicensedundertheApacheLicense,Version2.0(the"License"); * youmaynotusethisfileexceptincompliancewiththeLicense. * YoumayobtainacopyoftheLicenseat * * http://www.apache.org/licenses/LICENSE-2.0 * * Unlessrequiredbyapplicablelaworagreedtoinwriting,software * distributedundertheLicenseisdistributedonan"ASIS"BASIS, * WITHOUTWARRANTIESORCONDITIONSOFANYKIND,eitherexpressorimplied. * SeetheLicenseforthespecificlanguagegoverningpermissionsand * limitationsundertheLicense. */ package org.trustedanalytics.user.common; import com.fasterxml.jackson.databind.ObjectMapper; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.springframework.web.client.HttpStatusCodeException; import java.io.IOException; public class UaaProblemReader { private static final Log LOGGER = LogFactory.getLog(UaaProblemReader.class); private UaaProblemReader() { } public static UaaProblem read(HttpStatusCodeException e) { ObjectMapper objectMapper = new ObjectMapper(); try { return objectMapper.readValue(e.getResponseBodyAsString(), UaaProblem.class); } catch (IOException e1) { LOGGER.error(e1); return null; } } }