* @throws java.io.IOException
*/
private Map<String, String> parseErrors(Representation repr, Locale locale) throws IOException, JAXBException {
JAXBContext context = JAXBContext.newInstance(Errors.class);
Unmarshaller unmarshaller = context.createUnmarshaller();
Errors errorsRepr = (Errors) unmarshaller.unmarshal(repr.getStream());
Map<String, String> errors = new HashMap<>();
ResourceBundle resourceBundle = ResourceBundle.getBundle("ValidationMessages", locale);
for (org.jtalks.jcommune.plugin.auth.poulpe.dto.Error error : errorsRepr.getErrorList()) {
if (error.getCode() != null && !error.getCode().isEmpty()) {
Map.Entry<String, String> errorEntry = parseErrorCode(error.getCode(), resourceBundle);
if (errorEntry != null) {
errors.put(errorEntry.getKey(), errorEntry.getValue());
}