Skip to content

Commit

Permalink
RM-3669: Fix SonarQube found issues (#4)
Browse files Browse the repository at this point in the history
RM-3669: Fix SonarQube found issues
  • Loading branch information
OlesjaSmirnov committed Sep 2, 2024
1 parent 8ad6d2c commit f0a81dc
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public class ClientAuthCertRevocationCustomizer implements TomcatConnectorCustom
private boolean revocationCheckEnabled;

@Override
@SuppressWarnings("LineLength")
@SuppressWarnings({"LineLength", "java:S125"})
public void customize(Connector connector) {
//https://docs.oracle.com/en/java/javase/17/security/java-pki-programmers-guide.html#GUID-650D0D53-B617-4055-AFD3-AF5C2629CBBF
// run with -Djava.security.debug="certpath" to produce detailed log
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,7 @@ void testPKCS11Client() throws Exception {
var protectionParameter = new KeyStore.PasswordProtection(PKCS11_CONF.pin());

//Or ask pin interactively
@SuppressWarnings("java:S125")
//KeyStore.ProtectionParameter protectionParameter = getKeyStoreCallbackProtectionParameter("PIN1");

KeyStore clientKeyStore = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import org.springframework.stereotype.Component;

import ee.cyber.cdoc2.server.config.DbConnectionConfigProperties;
import ee.cyber.cdoc2.server.exeptions.JobFailureException;


/**
Expand Down Expand Up @@ -50,7 +51,7 @@ public void cleanUpExpiredCapsules() {
} catch (SQLException e) {
String errorMsg = "Expired key capsules deletion has failed";
log.error(errorMsg);
throw new RuntimeException(errorMsg, e);
throw new JobFailureException(errorMsg, e);
}
}

Expand All @@ -64,7 +65,7 @@ private Connection createDbConnection() {
} catch (SQLException e) {
String errorMsg = "Failed to establish database connection";
log.error(errorMsg);
throw new RuntimeException(errorMsg, e);
throw new JobFailureException(errorMsg, e);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
@Configuration
@EnableWebSecurity
@RequiredArgsConstructor
@SuppressWarnings("java:S4502")
public class SecurityConfiguration {

private final ConfigProperties credentials;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package ee.cyber.cdoc2.server.exeptions;


/**
* Thrown when scheduled job execution has failed.
*/
public class JobFailureException extends RuntimeException {

/**
* Error message constructor
* @param message error message text
* @param exception thrown exception
*/
public JobFailureException(String message, Throwable exception) {
super(message, exception);
}

}

0 comments on commit f0a81dc

Please sign in to comment.