From 9e660ec082ebcc69f6bded50d12772d6d5e775bd Mon Sep 17 00:00:00 2001 From: Gabriel Roldan Date: Fri, 15 Mar 2024 15:36:45 -0300 Subject: [PATCH] qa: fix some sonarcloud reported code smells --- .../RemoteEventDataDirectoryProcessor.java | 24 +++++++++---------- .../CatalogInfoRepositoryHolderImpl.java | 1 + 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/src/catalog/backends/datadir/src/main/java/org/geoserver/cloud/event/remote/datadir/RemoteEventDataDirectoryProcessor.java b/src/catalog/backends/datadir/src/main/java/org/geoserver/cloud/event/remote/datadir/RemoteEventDataDirectoryProcessor.java index be3349603..411b50dfb 100644 --- a/src/catalog/backends/datadir/src/main/java/org/geoserver/cloud/event/remote/datadir/RemoteEventDataDirectoryProcessor.java +++ b/src/catalog/backends/datadir/src/main/java/org/geoserver/cloud/event/remote/datadir/RemoteEventDataDirectoryProcessor.java @@ -135,7 +135,7 @@ public void onRemoteAddEvent(InfoAdded event) { case CatalogInfo info -> facade.add(info); case ServiceInfo config -> configFacade.add(config); case SettingsInfo config -> configFacade.add(config); - case LoggingInfo config -> log.debug("ignoring unused LoggingInfo"); + case LoggingInfo config -> log.debug("ignoring unused LoggingInfo {}", config); default -> log.warn("Don't know how to handle remote envent {})", event); } } @@ -189,18 +189,16 @@ private Info loadInfo(InfoModified event) { Class ctype = (Class) type.getType(); return catalogFacade().get(objectId, ctype).orElse(null); } - Info configInfo = - switch (type) { - case GEOSERVER -> configFacade.getGlobal(); - case SERVICE -> configFacade.getService(objectId, ServiceInfo.class); - case SETTINGS -> configFacade.getSettings(objectId); - case LOGGING -> configFacade.getLogging(); - default -> { - log.warn("Don't know how to handle remote modify envent {}", event); - yield null; - } - }; - return configInfo; + return switch (type) { + case GEOSERVER -> configFacade.getGlobal(); + case SERVICE -> configFacade.getService(objectId, ServiceInfo.class); + case SETTINGS -> configFacade.getSettings(objectId); + case LOGGING -> configFacade.getLogging(); + default -> { + log.warn("Don't know how to handle remote modify envent {}", event); + yield null; + } + }; } @EventListener(DefaultWorkspaceSet.class) diff --git a/src/catalog/plugin/src/main/java/org/geoserver/catalog/plugin/CatalogInfoRepositoryHolderImpl.java b/src/catalog/plugin/src/main/java/org/geoserver/catalog/plugin/CatalogInfoRepositoryHolderImpl.java index cb4e38a3f..bb33279f0 100644 --- a/src/catalog/plugin/src/main/java/org/geoserver/catalog/plugin/CatalogInfoRepositoryHolderImpl.java +++ b/src/catalog/plugin/src/main/java/org/geoserver/catalog/plugin/CatalogInfoRepositoryHolderImpl.java @@ -50,6 +50,7 @@ public > R repositoryF return (R) repos.forObject(info); } + @SuppressWarnings("java:S1452") public List> all() { return repos.getAll(); }