Configuration streams not reusable on IBM JVM

Description

This is a follow-up on which added the ability to reset configuration streams to be re-used when calling Configuration#buildValidatorFactory() multiple times. This, however, won't work on IBM JVM because it closes streams when creating an XMLEventReader out of them.

This causes test failures in org.hibernate.validator.test.internal.engine.ConfigurationImplTest - tests testReusableConfigurationWithNonResettableInputStream and testReusableConfigurationWithInputStream

Wrapping the configuration streams into a stream which ignores close() seems to resolve it - see https://github.com/jmartisk/hibernate-validator/commit/2060fb1e0e466155312d429001458d470a7d8251 but I wonder if not closing streams could lead to some resource leaks. Also perhaps this should be used only when IBM JVM is detected..

Also see for a related issue

Environment

None

Activity

Show:
Hardy Ferentschik
October 27, 2015, 11:29 AM

Actually we used the CloseIgnoringInputStream trick before, however, we applied it in XmlMappingParser. With the changes in connection with HV-1007, we thought it would not be required anymore, but this depends obviously on the JVM. I guess we can get this code back to keep the IBM JVM happy.

but I wonder if not closing streams could lead to some resource leaks

I don't think so. I think the documentation is quite clear on this one. It is the responsibility of the client API to close the stream.

Assignee

Unassigned

Reporter

Jan Martiška

Labels

None

Feedback Requested

None

Feedback Requested By

None

backPortable

None

Suitable for new contributors

None

Pull Request

None

backportDecision

None

backportReEvaluate

None

Components

Fix versions

Affects versions

Priority

Minor
Configure