Repository navigation
Commit d4f5dff
Fix overly broad classpath scanning in ReflectUtil.getClassesWithAnnotation() (#13427)
* Fix overly broad classpath scanning in ReflectUtil.getClassesWithAnnotation()
Production logs show a recurring WARN at startup:
"could not get type for name org.conscrypt.AllocatedBuffer"
(org.reflections.ReflectionsException / ClassNotFoundException)
Root cause: ReflectUtil.getClassesWithAnnotation() uses
ClasspathHelper.forPackage() to collect URLs to scan, but this
returns all classpath entries (JARs/directories), not just those
containing the target package. The Reflections library then scans
every .class file in every JAR — including Netty's
ConscryptAlpnSslEngine$BufferAdapter which references the optional
org.conscrypt.AllocatedBuffer type. During expandSuperTypes(),
Reflections tries Class.forName() on that type and fails because
Conscrypt is not (and need not be) on the classpath.
The fix adds a FilterBuilder that restricts bytecode scanning to
only classes whose fully-qualified names match the requested
packages. This prevents Reflections from processing unrelated
classes (e.g., io.netty.handler.ssl.*), eliminating the warning
and reducing startup time by skipping thousands of irrelevant
class files.
Signed-off-by: Ganesh Maharaj Mahalingam <g.mahalingam@apple.com>
* Add missing API command packages to ApiXmlDocWriter's classpath scan list
---------
Signed-off-by: Ganesh Maharaj Mahalingam <g.mahalingam@apple.com>
Co-authored-by: Ganesh Maharaj Mahalingam <g.mahalingam@apple.com>1 parent cdd03d7 commit d4f5dff
2 files changed
Lines changed: 8 additions & 1 deletion
File tree
- server/src/main/java/com/cloud/api/doc
- utils/src/main/java/com/cloud/utils
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
92 | 92 | | |
93 | 93 | | |
94 | 94 | | |
95 | | - | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
96 | 99 | | |
97 | 100 | | |
98 | 101 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
| 45 | + | |
45 | 46 | | |
46 | 47 | | |
47 | 48 | | |
| |||
70 | 71 | | |
71 | 72 | | |
72 | 73 | | |
| 74 | + | |
73 | 75 | | |
74 | 76 | | |
| 77 | + | |
75 | 78 | | |
| 79 | + | |
76 | 80 | | |
77 | 81 | | |
78 | 82 | | |
| |||
0 commit comments