Browse Source

collect exceptions across all constructors that have been tried (SPR-6720)

pull/23217/head
Juergen Hoeller 15 years ago
parent
commit
45448463b8
  1. 8
      org.springframework.beans/src/main/java/org/springframework/beans/factory/support/ConstructorResolver.java

8
org.springframework.beans/src/main/java/org/springframework/beans/factory/support/ConstructorResolver.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2009 the original author or authors. * Copyright 2002-2010 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -157,6 +157,7 @@ class ConstructorResolver {
AutowireUtils.sortConstructors(candidates); AutowireUtils.sortConstructors(candidates);
int minTypeDiffWeight = Integer.MAX_VALUE; int minTypeDiffWeight = Integer.MAX_VALUE;
Set<Constructor> ambiguousConstructors = null; Set<Constructor> ambiguousConstructors = null;
List<Exception> causes = null;
for (int i = 0; i < candidates.length; i++) { for (int i = 0; i < candidates.length; i++) {
Constructor<?> candidate = candidates[i]; Constructor<?> candidate = candidates[i];
@ -175,8 +176,6 @@ class ConstructorResolver {
} }
ArgumentsHolder args; ArgumentsHolder args;
List<Exception> causes = null;
if (resolvedValues != null) { if (resolvedValues != null) {
try { try {
String[] paramNames = null; String[] paramNames = null;
@ -215,7 +214,6 @@ class ConstructorResolver {
} }
} }
} }
else { else {
// Explicit arguments given -> arguments length must match exactly. // Explicit arguments given -> arguments length must match exactly.
if (paramTypes.length != explicitArgs.length) { if (paramTypes.length != explicitArgs.length) {
@ -383,7 +381,7 @@ class ConstructorResolver {
// Need to determine the factory method... // Need to determine the factory method...
// Try all methods with this name to see if they match the given arguments. // Try all methods with this name to see if they match the given arguments.
factoryClass = ClassUtils.getUserClass(factoryClass); factoryClass = ClassUtils.getUserClass(factoryClass);
Method[] rawCandidates = null; Method[] rawCandidates;
final Class factoryClazz = factoryClass; final Class factoryClazz = factoryClass;
if (System.getSecurityManager() != null) { if (System.getSecurityManager() != null) {

Loading…
Cancel
Save