Browse Source

AbstractTypeHierarchyTraversingFilter leniently ignores non-loadable super classes and interfaces

Issue: SPR-12042
pull/602/merge
Juergen Hoeller 10 years ago
parent
commit
a3163ceb88
  1. 27
      spring-core/src/main/java/org/springframework/core/type/filter/AbstractTypeHierarchyTraversingFilter.java

27
spring-core/src/main/java/org/springframework/core/type/filter/AbstractTypeHierarchyTraversingFilter.java

@ -18,6 +18,9 @@ package org.springframework.core.type.filter; @@ -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; @@ -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 @@ -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 @@ -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() + "]");
}
}
}

Loading…
Cancel
Save