diff --git a/java/code/src/com/redhat/rhn/common/ErrorReportingStrategies.java b/java/code/src/com/redhat/rhn/common/ErrorReportingStrategies.java index a2dc4d9abd2a..fb3787fb2adf 100644 --- a/java/code/src/com/redhat/rhn/common/ErrorReportingStrategies.java +++ b/java/code/src/com/redhat/rhn/common/ErrorReportingStrategies.java @@ -40,7 +40,7 @@ private ErrorReportingStrategies() { * @return Supplier of RhnRuntimeException that logs the message and throw the exception */ public static Supplier raiseAndLog(Object obj, String message) { - Logger logger = OBJ_LOGGER.computeIfAbsent(obj, (key) -> LogManager.getLogger(obj.getClass().getName())); + Logger logger = OBJ_LOGGER.computeIfAbsent(obj, key -> LogManager.getLogger(obj.getClass().getName())); return () -> { logger.error(message); return new RhnRuntimeException(message); diff --git a/java/code/src/com/redhat/rhn/frontend/xmlrpc/proxy/ProxyHandler.java b/java/code/src/com/redhat/rhn/frontend/xmlrpc/proxy/ProxyHandler.java index a77397f8c098..d96099dfb2ae 100644 --- a/java/code/src/com/redhat/rhn/frontend/xmlrpc/proxy/ProxyHandler.java +++ b/java/code/src/com/redhat/rhn/frontend/xmlrpc/proxy/ProxyHandler.java @@ -24,7 +24,6 @@ import com.redhat.rhn.domain.user.User; import com.redhat.rhn.frontend.dto.SystemOverview; import com.redhat.rhn.frontend.xmlrpc.BaseHandler; -import com.redhat.rhn.frontend.xmlrpc.IOFaultException; import com.redhat.rhn.frontend.xmlrpc.InvalidParameterException; import com.redhat.rhn.frontend.xmlrpc.InvalidProxyVersionException; import com.redhat.rhn.frontend.xmlrpc.MethodInvalidParamException; @@ -34,7 +33,6 @@ import com.redhat.rhn.frontend.xmlrpc.ProxyNotActivatedException; import com.redhat.rhn.frontend.xmlrpc.ProxySystemIsSatelliteException; import com.redhat.rhn.frontend.xmlrpc.SSLCertFaultException; -import com.redhat.rhn.frontend.xmlrpc.SystemIdInstantiationException; import com.redhat.rhn.frontend.xmlrpc.system.XmlRpcSystemHelper; import com.redhat.rhn.manager.entitlement.EntitlementManager; import com.redhat.rhn.manager.system.SystemManager; @@ -48,7 +46,6 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import java.io.IOException; import java.util.ArrayList; import java.util.Collections; import java.util.List; @@ -297,14 +294,6 @@ public byte[] containerConfig(User loggedInUser, String proxyName, Integer proxy maxCache.longValue(), email, rootCA, intermediateCAs, proxyCrtKey, null, null, null, new SSLCertManager()); } - catch (InstantiationException e) { - LOG.error("Failed to generate proxy system id", e); - throw new SystemIdInstantiationException(); - } - catch (IOException e) { - LOG.error("Failed to generate container config", e); - throw new IOFaultException(e); - } catch (SSLCertGenerationException e) { LOG.error("Failed to generate SSL certificate", e); throw new SSLCertFaultException(e.getMessage()); @@ -369,14 +358,6 @@ public byte[] containerConfig(User loggedInUser, String proxyName, Integer proxy maxCache.longValue(), email, null, List.of(), null, caCrtKey, caPassword, certData, new SSLCertManager()); } - catch (InstantiationException e) { - LOG.error("Failed to generate proxy system id", e); - throw new SystemIdInstantiationException(); - } - catch (IOException e) { - LOG.error("Failed to generate container config", e); - throw new IOFaultException(e); - } catch (SSLCertGenerationException e) { LOG.error("Failed to generate SSL certificate", e); throw new SSLCertFaultException(e.getMessage()); diff --git a/java/code/src/com/redhat/rhn/manager/system/SystemManager.java b/java/code/src/com/redhat/rhn/manager/system/SystemManager.java index 392d0cf6eab7..a421a4ebffa2 100644 --- a/java/code/src/com/redhat/rhn/manager/system/SystemManager.java +++ b/java/code/src/com/redhat/rhn/manager/system/SystemManager.java @@ -145,7 +145,6 @@ import org.apache.logging.log4j.Logger; import org.hibernate.Session; -import java.io.IOException; import java.net.IDN; import java.security.SecureRandom; import java.sql.Date; @@ -2155,7 +2154,7 @@ public byte[] createProxyContainerConfig(User user, String proxyName, Integer pr SSLCertPair proxyCertKey, SSLCertPair caPair, String caPassword, SSLCertData certData, SSLCertManager certManager) - throws IOException, InstantiationException, SSLCertGenerationException { + throws SSLCertGenerationException { return new ProxyContainerConfigCreate().create( saltApi, systemEntitlementManager, user, server, proxyName, proxyPort, maxCache, email, diff --git a/java/code/src/com/redhat/rhn/manager/system/proxycontainerconfig/ProxyContainerConfigCreateAcquisitor.java b/java/code/src/com/redhat/rhn/manager/system/proxycontainerconfig/ProxyContainerConfigCreateAcquisitor.java index f079b07750a1..eef88b0a321d 100644 --- a/java/code/src/com/redhat/rhn/manager/system/proxycontainerconfig/ProxyContainerConfigCreateAcquisitor.java +++ b/java/code/src/com/redhat/rhn/manager/system/proxycontainerconfig/ProxyContainerConfigCreateAcquisitor.java @@ -39,8 +39,6 @@ import com.suse.manager.webui.services.impl.runner.MgrUtilRunner; import org.apache.commons.lang3.RandomStringUtils; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; import java.security.SecureRandom; import java.util.HashSet; @@ -53,7 +51,6 @@ * Acquires and validates all necessary data for the Proxy container configuration creation files. */ public class ProxyContainerConfigCreateAcquisitor implements ProxyContainerConfigCreateContextHandler { - private static final Logger LOG = LogManager.getLogger(SystemManagerUtils.class); private SaltApi saltApi; diff --git a/java/code/src/com/redhat/rhn/manager/system/proxycontainerconfig/ProxyContainerConfigCreateContext.java b/java/code/src/com/redhat/rhn/manager/system/proxycontainerconfig/ProxyContainerConfigCreateContext.java index a0bd2ba529a9..ecee14e5db34 100644 --- a/java/code/src/com/redhat/rhn/manager/system/proxycontainerconfig/ProxyContainerConfigCreateContext.java +++ b/java/code/src/com/redhat/rhn/manager/system/proxycontainerconfig/ProxyContainerConfigCreateContext.java @@ -25,9 +25,6 @@ import com.suse.manager.webui.services.iface.SaltApi; import com.suse.manager.webui.services.impl.runner.MgrUtilRunner; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; - import java.util.HashMap; import java.util.List; import java.util.Map; @@ -37,8 +34,6 @@ */ public class ProxyContainerConfigCreateContext { - private static final Logger LOG = LogManager.getLogger(ProxyContainerConfigCreateContext.class); - // provided private final SaltApi saltApi; private final User user; diff --git a/java/code/src/com/suse/manager/webui/controllers/ProxyController.java b/java/code/src/com/suse/manager/webui/controllers/ProxyController.java index 7e2ed974a063..64ef593411f8 100644 --- a/java/code/src/com/suse/manager/webui/controllers/ProxyController.java +++ b/java/code/src/com/suse/manager/webui/controllers/ProxyController.java @@ -41,7 +41,6 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import java.io.IOException; import java.time.LocalDateTime; import java.util.HashMap; import java.util.Map; @@ -126,11 +125,6 @@ public String generateContainerConfig(Request request, Response response, User u return SparkApplicationHelper.json(response, filename + "-config.tar.gz"); } - catch (IOException | InstantiationException e) { - LOG.error("Failed to generate proxy container configuration", e); - return jsonError(response, HttpStatus.SC_INTERNAL_SERVER_ERROR, - "Failed to generate proxy container configuration"); - } catch (SystemsExistException e) { String msg = String.format("Cannot create proxy as an existing system has FQDN '%s'", data.getProxyFqdn()); LOG.error(msg);