11/*
2- * Copyright 2002-2017 the original author or authors.
2+ * Copyright 2002-2018 the original author or authors.
33 *
44 * Licensed under the Apache License, Version 2.0 (the "License");
55 * you may not use this file except in compliance with the License.
1616
1717package org .springframework .core .type .classreading ;
1818
19+ import java .io .FileNotFoundException ;
1920import java .io .IOException ;
2021
2122import org .springframework .core .io .DefaultResourceLoader ;
@@ -73,10 +74,13 @@ public final ResourceLoader getResourceLoader() {
7374
7475 @ Override
7576 public MetadataReader getMetadataReader (String className ) throws IOException {
76- String resourcePath = ResourceLoader .CLASSPATH_URL_PREFIX +
77- ClassUtils .convertClassNameToResourcePath (className ) + ClassUtils .CLASS_FILE_SUFFIX ;
78- Resource resource = this .resourceLoader .getResource (resourcePath );
79- if (!resource .exists ()) {
77+ try {
78+ String resourcePath = ResourceLoader .CLASSPATH_URL_PREFIX +
79+ ClassUtils .convertClassNameToResourcePath (className ) + ClassUtils .CLASS_FILE_SUFFIX ;
80+ Resource resource = this .resourceLoader .getResource (resourcePath );
81+ return getMetadataReader (resource );
82+ }
83+ catch (FileNotFoundException ex ) {
8084 // Maybe an inner class name using the dot name syntax? Need to use the dollar syntax here...
8185 // ClassUtils.forName has an equivalent check for resolution into Class references later on.
8286 int lastDotIndex = className .lastIndexOf ('.' );
@@ -87,11 +91,11 @@ public MetadataReader getMetadataReader(String className) throws IOException {
8791 ClassUtils .convertClassNameToResourcePath (innerClassName ) + ClassUtils .CLASS_FILE_SUFFIX ;
8892 Resource innerClassResource = this .resourceLoader .getResource (innerClassResourcePath );
8993 if (innerClassResource .exists ()) {
90- resource = innerClassResource ;
94+ return getMetadataReader ( innerClassResource ) ;
9195 }
9296 }
97+ throw ex ;
9398 }
94- return getMetadataReader (resource );
9599 }
96100
97101 @ Override
0 commit comments