From 81e683b3ee8bcad4df97f04b59397dcdc9942e14 Mon Sep 17 00:00:00 2001 From: Juergen Hoeller Date: Thu, 26 Mar 2009 23:15:23 +0000 Subject: [PATCH] CachedIntrospectionResults always caches bean classes except in case of custom BeanInfo (SPR-4876) --- .../springframework/beans/CachedIntrospectionResults.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/org.springframework.beans/src/main/java/org/springframework/beans/CachedIntrospectionResults.java b/org.springframework.beans/src/main/java/org/springframework/beans/CachedIntrospectionResults.java index 5bd63e8857..8e9798f8b7 100644 --- a/org.springframework.beans/src/main/java/org/springframework/beans/CachedIntrospectionResults.java +++ b/org.springframework.beans/src/main/java/org/springframework/beans/CachedIntrospectionResults.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2009 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. @@ -141,8 +141,11 @@ public class CachedIntrospectionResults { if (results == null) { // can throw BeansException results = new CachedIntrospectionResults(beanClass); + // On JDK 1.5 and higher, it is almost always safe to cache the bean class... + // The sole exception is a custom BeanInfo class being provided in a non-safe ClassLoader. if (ClassUtils.isCacheSafe(beanClass, CachedIntrospectionResults.class.getClassLoader()) || - isClassLoaderAccepted(beanClass.getClassLoader())) { + isClassLoaderAccepted(beanClass.getClassLoader()) || + !ClassUtils.isPresent(beanClass.getName() + "BeanInfo", beanClass.getClassLoader())) { classCache.put(beanClass, results); } else {