/** * Lazy getter for SAX parser. */ private SAXParser getSaxParser() { if (saxParser == null) { try { SAXParserFactory factory = SAXParserFactory.newInstance(); saxParser = factory.newSAXParser(); } catch (ParserConfigurationException | SAXException e) { String msg = "ValidationXMLReader initialization failed. Exception: " + e.getMessage(); LOGGER.severe(msg); throw new BeanValidationException(msg, e); } } return saxParser; }
/** * Lazy getter for SAX parser. */ private SAXParser getSaxParser() { if (saxParser == null) { try { SAXParserFactory factory = SAXParserFactory.newInstance(); saxParser = factory.newSAXParser(); } catch (ParserConfigurationException | SAXException e) { String msg = "ValidationXMLReader initialization failed. Exception: " + e.getMessage(); LOGGER.severe(msg); throw new BeanValidationException(msg, e); } } return saxParser; }
/** * Lazy getter for SAX parser. */ private SAXParser getSaxParser() { if (saxParser == null) { try { SAXParserFactory factory = XMLHelper.createParserFactory(false); saxParser = factory.newSAXParser(); } catch (ParserConfigurationException | SAXException e) { String msg = "ValidationXMLReader initialization failed. Exception: " + e.getMessage(); LOGGER.severe(msg); throw new BeanValidationException(msg, e); } } return saxParser; }
public static BeanValidationException constraintViolation(Object[] args, Throwable internalException) { BeanValidationException bve = new BeanValidationException(ExceptionMessageGenerator.buildMessage (BeanValidationException.class, CONSTRAINT_VIOLATION, args), internalException); bve.setErrorCode(CONSTRAINT_VIOLATION); return bve; }
public static BeanValidationException providerNotFound(String prefix, Throwable internalException) { BeanValidationException bve = new BeanValidationException(ExceptionMessageGenerator.buildMessage (BeanValidationException.class, PROVIDER_NOT_FOUND, new Object[]{prefix}), internalException); bve.setErrorCode(PROVIDER_NOT_FOUND); return bve; }
public static BeanValidationException illegalValidationMode(String prefix, String modeName) { BeanValidationException bve = new BeanValidationException(ExceptionMessageGenerator.buildMessage (BeanValidationException.class, ILLEGAL_VALIDATION_MODE, new Object[]{prefix, modeName})); bve.setErrorCode(ILLEGAL_VALIDATION_MODE); return bve; }
public static BeanValidationException constraintViolation(Object[] args, Throwable internalException) { BeanValidationException bve = new BeanValidationException(ExceptionMessageGenerator.buildMessage (BeanValidationException.class, CONSTRAINT_VIOLATION, args), internalException); bve.setErrorCode(CONSTRAINT_VIOLATION); return bve; }
public static BeanValidationException notNullAndNillable(String propertyName) { BeanValidationException bve = new BeanValidationException(ExceptionMessageGenerator.buildMessage (BeanValidationException.class, NOT_NULL_AND_NILLABLE, new Object[]{propertyName})); bve.setErrorCode(NOT_NULL_AND_NILLABLE); return bve; } }
public static BeanValidationException providerNotFound(String prefix, Throwable internalException) { BeanValidationException bve = new BeanValidationException(ExceptionMessageGenerator.buildMessage (BeanValidationException.class, PROVIDER_NOT_FOUND, new Object[]{prefix}), internalException); bve.setErrorCode(PROVIDER_NOT_FOUND); return bve; }
public static BeanValidationException illegalValidationMode(String prefix, String modeName) { BeanValidationException bve = new BeanValidationException(ExceptionMessageGenerator.buildMessage (BeanValidationException.class, ILLEGAL_VALIDATION_MODE, new Object[]{prefix, modeName})); bve.setErrorCode(ILLEGAL_VALIDATION_MODE); return bve; }
public static BeanValidationException notNullAndNillable(String propertyName) { BeanValidationException bve = new BeanValidationException(ExceptionMessageGenerator.buildMessage (BeanValidationException.class, NOT_NULL_AND_NILLABLE, new Object[]{propertyName})); bve.setErrorCode(NOT_NULL_AND_NILLABLE); return bve; } }