From a3163ceb884fcd995bf72824bbb17e9c740bf27d Mon Sep 17 00:00:00 2001 From: Juergen Hoeller Date: Mon, 28 Jul 2014 22:05:20 +0200 Subject: [PATCH] AbstractTypeHierarchyTraversingFilter leniently ignores non-loadable super classes and interfaces Issue: SPR-12042 --- ...AbstractTypeHierarchyTraversingFilter.java | 27 +++++++++++++++---- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/spring-core/src/main/java/org/springframework/core/type/filter/AbstractTypeHierarchyTraversingFilter.java b/spring-core/src/main/java/org/springframework/core/type/filter/AbstractTypeHierarchyTraversingFilter.java index 244f7774a2..b10db84aa6 100644 --- a/spring-core/src/main/java/org/springframework/core/type/filter/AbstractTypeHierarchyTraversingFilter.java +++ b/spring-core/src/main/java/org/springframework/core/type/filter/AbstractTypeHierarchyTraversingFilter.java @@ -18,6 +18,9 @@ package org.springframework.core.type.filter; import java.io.IOException; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + import org.springframework.core.type.ClassMetadata; import org.springframework.core.type.classreading.MetadataReader; import org.springframework.core.type.classreading.MetadataReaderFactory; @@ -36,6 +39,8 @@ import org.springframework.core.type.classreading.MetadataReaderFactory; */ public abstract class AbstractTypeHierarchyTraversingFilter implements TypeFilter { + protected final Log logger = LogFactory.getLog(getClass()); + private final boolean considerInherited; private final boolean considerInterfaces; @@ -72,10 +77,16 @@ public abstract class AbstractTypeHierarchyTraversingFilter implements TypeFilte } else { // Need to read super class to determine a match... - if (match(metadata.getSuperClassName(), metadataReaderFactory)) { - return true; + try { + if (match(metadata.getSuperClassName(), metadataReaderFactory)) { + return true; + } } - } + catch (IOException ex) { + logger.debug("Could not read super class [" + metadata.getSuperClassName() + + "] of type-filtered class [" + metadata.getClassName() + "]"); + } + } } } @@ -90,8 +101,14 @@ public abstract class AbstractTypeHierarchyTraversingFilter implements TypeFilte } else { // Need to read interface to determine a match... - if (match(ifc, metadataReaderFactory)) { - return true; + try { + if (match(ifc, metadataReaderFactory)) { + return true; + } + } + catch (IOException ex) { + logger.debug("Could not read interface [" + ifc + "] for type-filtered class [" + + metadata.getClassName() + "]"); } } }