From 98075c33c6a39a8c4c57357dbaf65294d9ca77a9 Mon Sep 17 00:00:00 2001 From: Phillip Webb Date: Fri, 28 Sep 2012 10:55:13 -0700 Subject: [PATCH] Chain exception cause on create failure Propogate root cause of exceptions thrown from createCollection and createMap. Issue: SPR-9285 Backport-Commit: 2e48656906ebeb18843fe2963fb6478d2edc1018 --- .../java/org/springframework/core/CollectionFactory.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/org.springframework.core/src/main/java/org/springframework/core/CollectionFactory.java b/org.springframework.core/src/main/java/org/springframework/core/CollectionFactory.java index f9354a8603..047989b525 100644 --- a/org.springframework.core/src/main/java/org/springframework/core/CollectionFactory.java +++ b/org.springframework.core/src/main/java/org/springframework/core/CollectionFactory.java @@ -255,7 +255,8 @@ public abstract class CollectionFactory { return (Collection) collectionType.newInstance(); } catch (Exception ex) { - throw new IllegalArgumentException("Could not instantiate Collection type: " + collectionType.getName()); + throw new IllegalArgumentException("Could not instantiate Collection type: " + + collectionType.getName(), ex); } } } @@ -322,7 +323,8 @@ public abstract class CollectionFactory { return (Map) mapType.newInstance(); } catch (Exception ex) { - throw new IllegalArgumentException("Could not instantiate Map type: " + mapType.getName()); + throw new IllegalArgumentException("Could not instantiate Map type: " + + mapType.getName(), ex); } } }