muse-dev[bot] commented on a change in pull request #6537:
URL: https://github.com/apache/skywalking/pull/6537#discussion_r592188952
##########
File path:
oap-server/server-library/library-module/src/main/java/org/apache/skywalking/oap/server/library/module/ModuleManager.java
##########
@@ -40,21 +40,19 @@ public void init(
ServiceLoader<ModuleDefine> moduleServiceLoader =
ServiceLoader.load(ModuleDefine.class);
ServiceLoader<ModuleProvider> moduleProviderLoader =
ServiceLoader.load(ModuleProvider.class);
- LinkedList<String> moduleList = new
LinkedList<>(Arrays.asList(moduleNames));
+ HashSet<String> moduleSet = new HashSet<>(Arrays.asList(moduleNames));
for (ModuleDefine module : moduleServiceLoader) {
- for (String moduleName : moduleNames) {
- if (moduleName.equals(module.name())) {
- module.prepare(this,
applicationConfiguration.getModuleConfiguration(moduleName),
moduleProviderLoader);
- loadedModules.put(moduleName, module);
- moduleList.remove(moduleName);
- }
+ if (moduleSet.contains(module.name())) {
+ module.prepare(this,
applicationConfiguration.getModuleConfiguration(module.name()),
moduleProviderLoader);
Review comment:
*NULL_DEREFERENCE:* object returned by
`applicationConfiguration.getModuleConfiguration(module.name())` could be null
and is dereferenced by call to `prepare(...)` at line 46.
(at-me [in a reply](https://docs.muse.dev/docs/talk-to-muse/) with `help` or
`ignore`)
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]