Issues
- BytecodeProviderImpl throwing java.lang.IndexOutOfBoundsExceptionHHH-19312
- NPE when entity class missing from persistence.xml is id of another entityHHH-19307
- Composite generator may not respect the event types of generators it consits ofHHH-19306Marko Bekhta
- Must import FQCN when generating metamodel class for inner Jakarta Data repository interfaceHHH-19301Resolved issue: HHH-19301Čedomir Igaly
- NodeBuilder collection*() doesn't work with enum collectionsHHH-19294
- Criteria isMember() doesn't work with collections mapped as arrayHHH-19293Resolved issue: HHH-19293
- HBM mapping incorrectly handles reference by non primary keyHHH-19197Resolved issue: HHH-19197
- Key is not resolved when resolving entityHHH-19055
- Bad performance on partitioned tables when joining to partitioned table in PostgreSQLHHH-19027
- IndexOutOfBoundsException when using arrayToString with arrayAggHHH-18981
- Static metamodel generation not working on JDK 21 when using xml mapping with MavenHHH-18722
11 of 11
BytecodeProviderImpl throwing java.lang.IndexOutOfBoundsException
Description
caused by
Details
Assignee
UnassignedUnassignedReporter
Čedomir IgalyČedomir IgalyWorked in
Components
Affects versions
Priority
Major
Details
Details
Assignee
Unassigned
UnassignedReporter
Čedomir Igaly
Čedomir IgalyWorked in
Components
Affects versions
Priority
Created 10 hours ago
Updated 9 hours ago
Activity
Show:
Method
org.hibernate.bytecode.internal.bytebuddy.BytecodeProviderImpl#encodeName)
is invoked with three parameterspropertyNames
,getters
, andsetters
. All three are of typejava.util.List
. Assumption is that all three lists are of equal size. However, this assumption is not correct. First list (propertyNames
) can contain more element from either one or both other lists:if ( getter.getDeclaringClass() == foreignPackageClassInfo.clazz && !Modifier.isPublic( getter.getModifiers() ) ) { foreignPackageClassInfo.getters.add( getter ); found = true; } if ( setter.getDeclaringClass() == foreignPackageClassInfo.clazz && !Modifier.isPublic( setter.getModifiers() ) ) { foreignPackageClassInfo.setters.add( setter ); found = true; } if ( found ) { foreignPackageClassInfo.propertyNames.add( propertyNames[i] ); }
In code above if either getter or setter is not added to corresponding list, property name will be still included, and one list will be shorter than property names list. This will cause `Index x out of bounds for length x` exception to be thrown in
encodeName
method (eithergetters
orsetters
is shorter thanpropertyNames
):for ( int i = 0; i < propertyNames.size(); i++ ) { final String propertyName = propertyNames.get( i ); final Member getter = getters.get( i ); final Member setter = setters.get( i ); // Encode the two member types as 4 bit integer encoded as hex character sb.append( Integer.toHexString( getKind( getter ) << 2 | getKind( setter ) ) ); sb.append( propertyName ); }
[Additionally,
getters.get(i)
andsetters.get(i)
are not necessarily belonging to same property, but this is ‘hidden’ by exception]Pull request #9952 is based on existing tes case by slightly changing model class(es)