Fix some sonar findings

Fix some sonar findings
This commit is contained in:
Stanislav Trailov
2023-06-30 09:52:54 +03:00
committed by GitHub
3 changed files with 10 additions and 3 deletions

View File

@@ -77,9 +77,14 @@ public class JpaAutoConfirmationStatus extends AbstractJpaTenantAwareBaseEntity
final String remarkMessage = StringUtils.hasText(remark) ? remark : "n/a"; final String remarkMessage = StringUtils.hasText(remark) ? remark : "n/a";
final String formattedInitiator = StringUtils.hasText(initiator) ? initiator : "n/a"; final String formattedInitiator = StringUtils.hasText(initiator) ? initiator : "n/a";
final String createdByRolloutsUser = StringUtils.hasText(getCreatedBy()) ? getCreatedBy() : "n/a"; final String createdByRolloutsUser = StringUtils.hasText(getCreatedBy()) ? getCreatedBy() : "n/a";
return String.format("Assignment automatically confirmed by initiator '%s'. \n\n" // // https://docs.oracle.com/en/java/javase/17/text-blocks/index.html#normalization-of-line-terminators
+ "Auto confirmation activated by system user: '%s' \n\n" // // nevertheless of the end of line of the file (\r\n, \n or \r) the result will contains \n
+ "Remark: %s", formattedInitiator, createdByRolloutsUser, remarkMessage); return """
Assignment automatically confirmed by initiator '%s'.\040
Auto confirmation activated by system user: '%s'\040
Remark: %s""".formatted(formattedInitiator, createdByRolloutsUser, remarkMessage);
} }
@Override @Override

View File

@@ -118,6 +118,7 @@ public class ControllerPreAuthenticatedSecurityHeaderFilter extends AbstractCont
* if we find the hash in any the trusted CA chain to accept this request for * if we find the hash in any the trusted CA chain to accept this request for
* this tenant. * this tenant.
*/ */
@SuppressWarnings("java:S2629") // check if debug is enabled is maybe heavier then evaluation
private String getIssuerHashHeader(final DmfTenantSecurityToken securityToken, final String knownIssuerHashes) { private String getIssuerHashHeader(final DmfTenantSecurityToken securityToken, final String knownIssuerHashes) {
// there may be several knownIssuerHashes configured for the tenant // there may be several knownIssuerHashes configured for the tenant
final List<String> knownHashes = splitMultiHashBySemicolon(knownIssuerHashes); final List<String> knownHashes = splitMultiHashBySemicolon(knownIssuerHashes);

View File

@@ -227,6 +227,7 @@ public class ArtifactUploadState implements Serializable {
return inProgressCount; return inProgressCount;
} }
@SuppressWarnings("java:S2629") // error shall be enable almost every time and evaluation is light
private static void assertFileStateConsistency(final int inProgressCount, final int overallUploadCount, private static void assertFileStateConsistency(final int inProgressCount, final int overallUploadCount,
final int succeededUploadCount, final int failedUploadCount) { final int succeededUploadCount, final int failedUploadCount) {
if (inProgressCount < 0) { if (inProgressCount < 0) {