|
|
|
|
|
|
HV can't read validation.xml on IBM JDK, causing a failure during creation of a {{ ValidatorFactory }} - the failure: {noformat} Exception in thread "main" javax.validation.ValidationException: HV000123: Unable to parse META-INF/validation.xml. at org.hibernate.validator.internal.xml.XmlParserHelper.getSchemaVersion(XmlParserHelper.java:112) at org.hibernate.validator.internal.xml.ValidationXmlParser.parseValidationXml(ValidationXmlParser.java:79) at org.hibernate.validator.internal.engine.ConfigurationImpl.getBootstrapConfiguration(ConfigurationImpl.java:287) at org.hibernate.validator.internal.engine.ConfigurationImpl.parseValidationXml(ConfigurationImpl.java:361) at org.hibernate.validator.internal.engine.ConfigurationImpl.buildValidatorFactory(ConfigurationImpl.java:214) at org.jboss.as.ee.beanvalidation.TestingApp.main(TestingApp.java:25) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:95) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:55) at java.lang.reflect.Method.invoke(Method.java:495) at com.intellij.rt.execution.application.AppMain.main(AppMain.java:140) Caused by: java.io.IOException: Stream closed at java.io.BufferedInputStream.getBufIfOpen(BufferedInputStream.java:181) at java.io.BufferedInputStream.reset(BufferedInputStream.java:457) at org.hibernate.validator.internal.xml.XmlParserHelper.getSchemaVersion(XmlParserHelper.java:109) ... 10 more {noformat}
It looks like this is because {{XmlParserHelper}} (line 109) calls {{reset()}} on a {{xmlInputStream}} which was used for creating a {{XMLEventReader}} earlier - and for some reason, IBM JDK behaves in a way that it closes the input stream when creating a {{XMLEventReader}} out of it. So calling {{reset()}} ends with an {{IOException}}.
How to reproduce - have any validation.xml on the classpath and run this code on IBM JDK: {noformat} ValidatorFactory factory = Validation.byProvider(HibernateValidator.class).configure().buildValidatorFactory(); {noformat}
|
|
|
|
|
|