/** * Converts a ContentValidationException to a parse exception, with a * separate exception for each parser error that was encountered. */ public ParseException toParseException() { ParseException result = null; Map<Element, List<ErrorContent>> errors = vc.getErrors(); for (Map.Entry<Element, List<ErrorContent>> entry : errors.entrySet()) { Element element = entry.getKey(); String location = element.getElementKey().getId().toString(); List<ErrorContent> codes = entry.getValue(); for (ErrorContent errorCode : codes) { ParseException pe = new ParseException(errorCode); pe.setLocation(location); if (result == null) { result = pe; } else { result.addSibling(pe); } } } return result; } }
/** * Converts a ContentValidationException to a parse exception, with a * separate exception for each parser error that was encountered. */ public ParseException toParseException() { ParseException result = null; Map<Element, List<ErrorContent>> errors = vc.getErrors(); for (Map.Entry<Element, List<ErrorContent>> entry : errors.entrySet()) { Element element = entry.getKey(); String location = element.getElementKey().getId().toString(); List<ErrorContent> codes = entry.getValue(); for (ErrorContent errorCode : codes) { ParseException pe = new ParseException(errorCode); pe.setLocation(location); if (result == null) { result = pe; } else { result.addSibling(pe); } } } return result; } }
/** * Converts a ContentValidationException to a parse exception, with a * separate exception for each parser error that was encountered. */ public ParseException toParseException() { ParseException result = null; Map<Element, List<ErrorContent>> errors = vc.getErrors(); for (Map.Entry<Element, List<ErrorContent>> entry : errors.entrySet()) { Element element = entry.getKey(); String location = element.getElementKey().getId().toString(); List<ErrorContent> codes = entry.getValue(); for (ErrorContent errorCode : codes) { ParseException pe = new ParseException(errorCode); pe.setLocation(location); if (result == null) { result = pe; } else { result.addSibling(pe); } } } return result; } }