SOLR-9134: Fix RestManager.addManagedResource return value.

This commit is contained in:
Christine Poerschke 2016-05-23 16:22:20 +01:00
parent a35057fff2
commit 1b809e784a
2 changed files with 5 additions and 3 deletions

View File

@ -229,6 +229,8 @@ Bug Fixes
* SOLR-8801: /bin/solr create script always returns exit code 0 when a collection/core already exists.
(Khalid Alharbi, Marius Grama via Steve Rowe)
* SOLR-9134: Fix RestManager.addManagedResource return value. (Christine Poerschke)
Optimizations
----------------------
* SOLR-8722: Don't force a full ZkStateReader refresh on every Overseer operation.

View File

@ -647,11 +647,11 @@ public class RestManager {
* Restlet router. Returns the corresponding instance.
*/
public synchronized ManagedResource addManagedResource(String resourceId, Class<? extends ManagedResource> clazz) {
ManagedResource res = null;
ManagedResourceRegistration existingReg = registry.registered.get(resourceId);
final ManagedResource res;
final ManagedResourceRegistration existingReg = registry.registered.get(resourceId);
if (existingReg == null) {
registry.registerManagedResource(resourceId, clazz, null);
addRegisteredResource(registry.registered.get(resourceId));
res = addRegisteredResource(registry.registered.get(resourceId));
} else {
res = getManagedResource(resourceId);
}