1
1
/*
2
- * Copyright 2002-2014 the original author or authors.
2
+ * Copyright 2002-2018 the original author or authors.
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
16
16
17
17
package org .springframework .core .type .classreading ;
18
18
19
+ import java .io .FileNotFoundException ;
19
20
import java .io .IOException ;
20
21
21
22
import org .springframework .core .io .DefaultResourceLoader ;
@@ -72,10 +73,13 @@ public final ResourceLoader getResourceLoader() {
72
73
73
74
@ Override
74
75
public MetadataReader getMetadataReader (String className ) throws IOException {
75
- String resourcePath = ResourceLoader .CLASSPATH_URL_PREFIX +
76
- ClassUtils .convertClassNameToResourcePath (className ) + ClassUtils .CLASS_FILE_SUFFIX ;
77
- Resource resource = this .resourceLoader .getResource (resourcePath );
78
- if (!resource .exists ()) {
76
+ try {
77
+ String resourcePath = ResourceLoader .CLASSPATH_URL_PREFIX +
78
+ ClassUtils .convertClassNameToResourcePath (className ) + ClassUtils .CLASS_FILE_SUFFIX ;
79
+ Resource resource = this .resourceLoader .getResource (resourcePath );
80
+ return getMetadataReader (resource );
81
+ }
82
+ catch (FileNotFoundException ex ) {
79
83
// Maybe an inner class name using the dot name syntax? Need to use the dollar syntax here...
80
84
// ClassUtils.forName has an equivalent check for resolution into Class references later on.
81
85
int lastDotIndex = className .lastIndexOf ('.' );
@@ -86,11 +90,11 @@ public MetadataReader getMetadataReader(String className) throws IOException {
86
90
ClassUtils .convertClassNameToResourcePath (innerClassName ) + ClassUtils .CLASS_FILE_SUFFIX ;
87
91
Resource innerClassResource = this .resourceLoader .getResource (innerClassResourcePath );
88
92
if (innerClassResource .exists ()) {
89
- resource = innerClassResource ;
93
+ return getMetadataReader ( innerClassResource ) ;
90
94
}
91
95
}
96
+ throw ex ;
92
97
}
93
- return getMetadataReader (resource );
94
98
}
95
99
96
100
@ Override
0 commit comments