|
1 | 1 | /*
|
2 |
| - * Copyright 2002-2009 the original author or authors. |
| 2 | + * Copyright 2002-2014 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.
|
@@ -73,7 +73,23 @@ public final ResourceLoader getResourceLoader() {
|
73 | 73 | public MetadataReader getMetadataReader(String className) throws IOException {
|
74 | 74 | String resourcePath = ResourceLoader.CLASSPATH_URL_PREFIX +
|
75 | 75 | ClassUtils.convertClassNameToResourcePath(className) + ClassUtils.CLASS_FILE_SUFFIX;
|
76 |
| - return getMetadataReader(this.resourceLoader.getResource(resourcePath)); |
| 76 | + Resource resource = this.resourceLoader.getResource(resourcePath); |
| 77 | + if (!resource.exists()) { |
| 78 | + // Maybe an inner class name using the dot name syntax? Need to use the dollar syntax here... |
| 79 | + // ClassUtils.forName has an equivalent check for resolution into Class references later on. |
| 80 | + int lastDotIndex = className.lastIndexOf('.'); |
| 81 | + if (lastDotIndex != -1) { |
| 82 | + String innerClassName = |
| 83 | + className.substring(0, lastDotIndex) + '$' + className.substring(lastDotIndex + 1); |
| 84 | + String innerClassResourcePath = ResourceLoader.CLASSPATH_URL_PREFIX + |
| 85 | + ClassUtils.convertClassNameToResourcePath(innerClassName) + ClassUtils.CLASS_FILE_SUFFIX; |
| 86 | + Resource innerClassResource = this.resourceLoader.getResource(innerClassResourcePath); |
| 87 | + if (innerClassResource.exists()) { |
| 88 | + resource = innerClassResource; |
| 89 | + } |
| 90 | + } |
| 91 | + } |
| 92 | + return getMetadataReader(resource); |
77 | 93 | }
|
78 | 94 |
|
79 | 95 | public MetadataReader getMetadataReader(Resource resource) throws IOException {
|
|
0 commit comments