Skip to content
Permalink
Browse files
Simplify array cloning.
  • Loading branch information
garydgregory committed Jan 3, 2021
1 parent 5d9c447 commit 9a65b47b2615102710306fe4320390cdd0c75e57
Showing 1 changed file with 3 additions and 7 deletions.
@@ -39,8 +39,7 @@ public class DataSourceCompositeResolver extends DataSourceBaseResolver
*/
public DataSourceCompositeResolver(final DataSourceResolver[] dataSourceResolvers)
{
this.dataSourceResolvers = new DataSourceResolver[dataSourceResolvers.length];
System.arraycopy(dataSourceResolvers, 0, this.dataSourceResolvers, 0, dataSourceResolvers.length);
this.dataSourceResolvers = dataSourceResolvers.clone();
}

/**
@@ -52,8 +51,7 @@ public DataSourceCompositeResolver(final DataSourceResolver[] dataSourceResolver
public DataSourceCompositeResolver(final DataSourceResolver[] dataSourceResolvers, final boolean isLenient)
{
super(isLenient);
this.dataSourceResolvers = new DataSourceResolver[dataSourceResolvers.length];
System.arraycopy(dataSourceResolvers, 0, this.dataSourceResolvers, 0, dataSourceResolvers.length);
this.dataSourceResolvers = dataSourceResolvers.clone();
}

/**
@@ -64,9 +62,7 @@ public DataSourceCompositeResolver(final DataSourceResolver[] dataSourceResolver
public DataSourceResolver[] getDataSourceResolvers()
{
// clone the internal array to prevent external modification (see EMAIL-116)
final DataSourceResolver[] resolvers = new DataSourceResolver[dataSourceResolvers.length];
System.arraycopy(dataSourceResolvers, 0, resolvers, 0, dataSourceResolvers.length);
return resolvers;
return dataSourceResolvers.clone();
}

/** {@inheritDoc} */

0 comments on commit 9a65b47

Please sign in to comment.