Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RM-3669: Fix SonarQube found issues #4

Merged
merged 4 commits into from
Sep 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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);
}

}