Consistent use of Collection.toArray with zero-sized array argument
Includes consistent use of ClassUtils.toClassArray (as non-null variant) Issue: SPR-16523
This commit is contained in:
@@ -418,9 +418,8 @@ public abstract class AbstractEntityManagerFactoryBean implements
|
||||
}
|
||||
ifcs.add(EntityManagerFactoryInfo.class);
|
||||
try {
|
||||
return (EntityManagerFactory) Proxy.newProxyInstance(
|
||||
this.beanClassLoader, ifcs.toArray(new Class<?>[ifcs.size()]),
|
||||
new ManagedEntityManagerFactoryInvocationHandler(this));
|
||||
return (EntityManagerFactory) Proxy.newProxyInstance(this.beanClassLoader,
|
||||
ClassUtils.toClassArray(ifcs), new ManagedEntityManagerFactoryInvocationHandler(this));
|
||||
}
|
||||
catch (IllegalArgumentException ex) {
|
||||
if (entityManagerFactoryInterface != null) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2017 the original author or authors.
|
||||
* Copyright 2002-2018 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -232,7 +232,7 @@ public abstract class ExtendedEntityManagerCreator {
|
||||
ifcs.add(EntityManagerProxy.class);
|
||||
return (EntityManager) Proxy.newProxyInstance(
|
||||
(cl != null ? cl : ExtendedEntityManagerCreator.class.getClassLoader()),
|
||||
ifcs.toArray(new Class<?>[ifcs.size()]),
|
||||
ClassUtils.toClassArray(ifcs),
|
||||
new ExtendedEntityManagerInvocationHandler(
|
||||
rawEm, exceptionTranslator, jta, containerManaged, synchronizedWithTransaction));
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2017 the original author or authors.
|
||||
* Copyright 2002-2018 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -150,7 +150,7 @@ final class PersistenceUnitReader {
|
||||
throw new IllegalArgumentException("Internal error parsing persistence unit from " + resourceLocation);
|
||||
}
|
||||
|
||||
return infos.toArray(new SpringPersistenceUnitInfo[infos.size()]);
|
||||
return infos.toArray(new SpringPersistenceUnitInfo[0]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user