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