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) { private LockOptions buildLockOptions(LockModeType lockModeType, Map<String, Object> properties) {
final LockOptions output = this.lockOptions.makeCopy(); LockOptions lockOptions = new LockOptions();
output.setLockMode( LockModeTypeHelper.getLockMode( lockModeType ) ); if ( this.lockOptions != null ) { //otherwise the default LockOptions constructor is the same as DEFAULT_LOCK_OPTIONS
if ( properties != null ) { LockOptions.copy( this.lockOptions, lockOptions );
LockOptionsHelper.applyPropertiesToLockOptions( properties, () -> output );
} }
return output; lockOptions.setLockMode( LockModeTypeHelper.getLockMode( lockModeType ) );
if ( properties != null ) {
LockOptionsHelper.applyPropertiesToLockOptions( properties, () -> lockOptions );
}
return lockOptions;
} }
@Override @Override