Fix SessionImpl#buildLockOptions causing NPE

This commit is contained in:
Andrea Boriero 2020-07-20 09:08:05 +01:00
parent 9ba18b8c5d
commit 3e3db6d352

View File

@ -2919,12 +2919,15 @@ public void refresh(Object entity, LockModeType lockModeType, Map<String, Object
}
private LockOptions buildLockOptions(LockModeType lockModeType, Map<String, Object> properties) {
final LockOptions output = this.lockOptions.makeCopy();
output.setLockMode( LockModeTypeHelper.getLockMode( lockModeType ) );
if ( properties != null ) {
LockOptionsHelper.applyPropertiesToLockOptions( properties, () -> output );
LockOptions lockOptions = new LockOptions();
if ( this.lockOptions != null ) { //otherwise the default LockOptions constructor is the same as DEFAULT_LOCK_OPTIONS
LockOptions.copy( this.lockOptions, lockOptions );
}
return output;
lockOptions.setLockMode( LockModeTypeHelper.getLockMode( lockModeType ) );
if ( properties != null ) {
LockOptionsHelper.applyPropertiesToLockOptions( properties, () -> lockOptions );
}
return lockOptions;
}
@Override