Skip to content

Commit

Permalink
sonar issues
Browse files Browse the repository at this point in the history
  • Loading branch information
rjpmestre committed Jun 21, 2024
1 parent 1b762d2 commit 643e87e
Show file tree
Hide file tree
Showing 6 changed files with 2 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ private ErrorReportingStrategies() {
* @return Supplier of RhnRuntimeException that logs the message and throw the exception
*/
public static Supplier<RhnRuntimeException> 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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -297,14 +297,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());
Expand Down Expand Up @@ -369,14 +361,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());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,11 +126,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);
Expand Down

0 comments on commit 643e87e

Please sign in to comment.