Better clone methods

This commit is contained in:
2025-06-13 11:50:21 -05:00
parent d23dbac0d9
commit 55905d251d
2 changed files with 19 additions and 12 deletions

View File

@ -44,7 +44,7 @@ public class MultiRecordSecurityLock extends RecordSecurityLock implements Clone
**
*******************************************************************************/
@Override
protected MultiRecordSecurityLock clone() throws CloneNotSupportedException
public MultiRecordSecurityLock clone()
{
MultiRecordSecurityLock clone = (MultiRecordSecurityLock) super.clone();

View File

@ -57,20 +57,27 @@ public class RecordSecurityLock implements Cloneable
**
*******************************************************************************/
@Override
protected RecordSecurityLock clone() throws CloneNotSupportedException
public RecordSecurityLock clone()
{
RecordSecurityLock clone = (RecordSecurityLock) super.clone();
/////////////////////////
// deep-clone the list //
/////////////////////////
if(joinNameChain != null)
try
{
clone.joinNameChain = new ArrayList<>();
clone.joinNameChain.addAll(joinNameChain);
}
RecordSecurityLock clone = (RecordSecurityLock) super.clone();
return (clone);
/////////////////////////
// deep-clone the list //
/////////////////////////
if(joinNameChain != null)
{
clone.joinNameChain = new ArrayList<>();
clone.joinNameChain.addAll(joinNameChain);
}
return (clone);
}
catch(CloneNotSupportedException e)
{
throw (new RuntimeException("Could not clone", e));
}
}