ycallea commented on code in PR #2202:
URL: https://github.com/apache/solr/pull/2202#discussion_r1457446395
##########
solr/core/src/java/org/apache/solr/handler/admin/ContainerPluginsApi.java:
##########
@@ -134,29 +131,25 @@ public void update(PayloadObj<PluginMeta> payload) throws
IOException {
}
private void validateConfig(PayloadObj<PluginMeta> payload, PluginMeta info)
throws IOException {
- if (info.klass.indexOf(':') > 0) {
- if (info.version == null) {
- payload.addError("Using package. must provide a packageVersion");
- return;
- }
- }
- List<String> errs = new ArrayList<>();
- ContainerPluginsRegistry.ApiInfo apiInfo =
-
coreContainer.getContainerPluginsRegistry().createInfo(payload.getDataMap(),
errs);
- if (!errs.isEmpty()) {
- for (String err : errs) payload.addError(err);
+ if (info.klass.indexOf(':') > 0 && info.version == null) {
+ payload.addError("Using package. must provide a packageVersion");
return;
}
- AnnotatedApi api = null;
- try {
- apiInfo.init();
- } catch (Exception e) {
- log.error("Error instantiating plugin ", e);
- errs.add(e.getMessage());
- return;
- } finally {
- closeWhileHandlingException(api);
Review Comment:
The exception was swallowed here because the error message was mistakenly
only added to the local `errs` list (line 151) but never included in the
response's payload.
The removal of the call to `closeWhileHandlingException(...)` is a minor
code clean-up.
In this context, the purpose of this method was to close the `AnnotatedApi`
declared above (line 146), but as it is never instantiated this finally block
always resulted in a no-op.
I therefore removed both this unused local variable declaration and the
finally block which was dedicated to closing this resource.
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]