List of usage examples for com.google.common.base VerifyException toString
public String toString()
From source file:com.iblsoft.iwxxm.webservice.validator.IwxxmValidator.java
public ValidationResult validate(String iwxxmData, String iwxxmVersion) { Log.INSTANCE.debug("IwxxmWebService.validate request started"); if (iwxxmVersion == null) { iwxxmVersion = defaultIwxxmVersion; }// www . j av a 2s .com String catalogFile = validationCatalogFile.getAbsolutePath(); XML10Validator validator = new XML10Validator(catalogFile); List<ValidationError> errors = new ArrayList<>(); try { printValidatingXMLSchema(catalogFile); ValidationResult xsdValidationResult; try (StringReader reader = new StringReader(iwxxmData)) { xsdValidationResult = validator.validate(reader); errors.addAll(xsdValidationResult.getValidationErrors()); } if (iwxxmVersion.isEmpty()) { iwxxmVersion = xsdValidationResult.getDetectedIwxxmVersion(); if (Log.INSTANCE.isDebugEnabled()) { Log.INSTANCE.debug("IWXXM version detected: {}", iwxxmVersion); } } checkIwxxmVersion(iwxxmVersion); File[] schematronFiles = getSchematronFiles(iwxxmVersion); if (schematronFiles != null && schematronFiles.length > 0) { for (File schematronFile : schematronFiles) { if (Log.INSTANCE.isDebugEnabled()) { Log.INSTANCE.debug("Validating against Schematron rules {}", schematronFile.getName()); } ValidationResult schematronValidationResult = schematronValidator.validate(iwxxmData, schematronFile.getAbsolutePath()); errors.addAll(schematronValidationResult.getValidationErrors()); } } } catch (VerifyException e) { errors.add(new ValidationError(e.getMessage(), "", 0, 0)); } catch (Exception e) { errors.add(new ValidationError(e.toString(), "", 0, 0)); } return new ValidationResult(iwxxmVersion, errors); }