StringIndexOutOfBoundsException in BooleanTypeDescriptor

Description

There is a small programming oversight in the wrap(...) function of org.hibernate.type.descriptor.java.BooleanTypeDescriptor.

Whenever an empty String is passed as the parameter, a _java.lang.StringIndexOutOfBoundsException_will be thrown in the following line:

This occurs because there is no test whether the string is empty (there is a test to see if it is null). It can easily be solved by adding that check.

In attachment there is simple PoC that triggers this problem.

Environment

Any version of Hibernate

Status

Assignee

Chris Cranford

Reporter

seymanurN

Fix versions

Labels

backPortable

None

Suitable for new contributors

Yes, likely

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Affects versions

Priority

Minor
Configure