Skip to content

Commit 7509e1e

Browse files
Fix checkstyle
1 parent 8bd8faa commit 7509e1e

File tree

3 files changed

+29
-50
lines changed

3 files changed

+29
-50
lines changed

bzst-dip-java-client/src/main/java/software/xdev/bzst/dip/client/model/configuration/BzstDipConfigurationBuilder.java

Lines changed: 27 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
/**
3535
* Builder construct for the {@link BzstDipConfiguration}.
3636
*/
37-
@SuppressWarnings({"unused", "UnusedReturnValue"})
37+
@SuppressWarnings({"unused", "UnusedReturnValue", "PMD.GodClass"})
3838
public class BzstDipConfigurationBuilder
3939
{
4040
public static final int DEFAULT_DELAY_BEFORE_CHECKING_RESULTS_IN_MILLIS = 1_000;
@@ -436,38 +436,31 @@ public BzstDipConfiguration buildAndValidate()
436436
this.getSetPropertyOrReadFromFileTransmittingCountry(
437437
this.transmittingCountry,
438438
PropertiesSupplier.PROPERTY_NAME_TRANSMITTING_COUNTRY,
439-
BzstDipCountryCode.DE
440-
),
439+
BzstDipCountryCode.DE),
441440
this.getSetPropertyOrReadFromFileMessageType(
442441
this.messageType,
443442
PropertiesSupplier.PROPERTY_NAME_MESSAGE_TYPE,
444-
BzstCesopMessageTypeEnum.PMT
445-
),
443+
BzstCesopMessageTypeEnum.PMT),
446444
this.getSetPropertyOrReadFromFile(
447445
this.messageRefId,
448446
PropertiesSupplier.PROPERTY_NAME_MESSAGE_REF_ID,
449-
UUID.randomUUID().toString()
450-
),
447+
UUID.randomUUID().toString()),
451448
this.getSetPropertyOrReadFromFile(
452449
this.reportingPeriodCesopYear,
453450
PropertiesSupplier.PROPERTY_NAME_REPORTING_PERIOD_CESOP_YEAR,
454-
String.valueOf(LocalDate.now().getYear())
455-
),
451+
String.valueOf(LocalDate.now().getYear())),
456452
this.getSetPropertyOrReadFromFileInteger(
457453
this.reportingPeriodCesopQuarter,
458454
PropertiesSupplier.PROPERTY_NAME_REPORTING_PERIOD_CESOP_QUARTER,
459-
1
460-
),
455+
1),
461456
this.getSetPropertyOrReadFromFileTimestamp(
462457
this.timestamp,
463458
PropertiesSupplier.PROPERTY_NAME_TIMESTAMP,
464-
ZonedDateTime.now()
465-
),
459+
ZonedDateTime.now()),
466460
this.getSetPropertyOrReadFromFileMessageTypeIndicCesop(
467461
this.messageTypeIndicCesop,
468462
PropertiesSupplier.PROPERTY_NAME_MESSAGE_TYPE_INDIC,
469-
BzstCesopMessageTypeIndicEnum.CESOP_100
470-
),
463+
BzstCesopMessageTypeIndicEnum.CESOP_100),
471464
this.getSetPropertyOrReadFromFileApplicationCode(
472465
this.applicationCode,
473466
PropertiesSupplier.PROPERTY_NAME_APPLICATION_CODE,
@@ -525,32 +518,26 @@ public BzstDipConfiguration buildAndValidate()
525518
this.getSetPropertyOrReadFromFileDuration(
526519
this.delayInBetweenResultChecks,
527520
PropertiesSupplier.PROPERTY_NAME_DELAY_IN_BETWEEN_RESULT_CHECKS_IN_MS,
528-
Duration.ofMillis(DEFAULT_DELAY_IN_BETWEEN_RESULTS_CHECKS_IN_MILLIS))
529-
),
521+
Duration.ofMillis(DEFAULT_DELAY_IN_BETWEEN_RESULTS_CHECKS_IN_MILLIS))),
530522
this.getSetPropertyOrReadFromFile(
531523
this.platformOperatorOrganizationName,
532524
PropertiesSupplier.PROPERTY_NAME_PLATFORM_OPERATOR_ORGANIZATION),
533525
this.getSetPropertyOrReadFromFile(
534526
this.platformOperatorPlatformName,
535527
PropertiesSupplier.PROPERTY_NAME_PLATFORM_OPERATOR_PLATFORM),
536-
this.getSetPropertyOrReadFromFileAddress(this.platformOperatorAddress)
537-
);
528+
this.getSetPropertyOrReadFromFileAddress(this.platformOperatorAddress));
538529
BzstDipConfigurationValidator.validateConfiguration(configuration);
539530
return configuration;
540531
}
541532

542533
private void validateConfiguration(final BzstDipConfiguration configuration)
543534
{
544-
if(
545-
configuration.getDocType().isNewTransmission()
546-
&& (configuration.getPlatformOperatorDocRefId() == null
547-
|| configuration.getPlatformOperatorDocRefId().isBlank())
548-
)
535+
if(configuration.getDocType().isNewTransmission() && (configuration.getPlatformOperatorDocRefId() == null
536+
|| configuration.getPlatformOperatorDocRefId().isBlank()))
549537
{
550538
throw new ConfigurationException(
551539
PropertiesSupplier.PROPERTY_NAME_PLATFORM_OPERATOR_DOC_REF_ID,
552-
"When sending a new transmission (OECD_0) a DocRefId must be set!"
553-
);
540+
"When sending a new transmission (OECD_0) a DocRefId must be set!");
554541
}
555542
}
556543

@@ -577,7 +564,9 @@ private SigningProvider getSigningProvider(final SigningProvider builderProperty
577564
private SigningProviderByJks createJksKeyProvider()
578565
{
579566
final String jksKeystorePassword =
580-
this.propertiesSupplier.getPropertyFromConfig(PropertiesSupplier.PROPERTY_NAME_SIGNING_JKS_KEYSTORE_PASSWORD);
567+
this.propertiesSupplier.getPropertyFromConfig(
568+
PropertiesSupplier.PROPERTY_NAME_SIGNING_JKS_KEYSTORE_PASSWORD
569+
);
581570
final String jksKeystoreFile =
582571
this.propertiesSupplier.getPropertyFromConfig(PropertiesSupplier.PROPERTY_NAME_SIGNING_JKS_KEYSTORE_FILE);
583572
if(jksKeystorePassword == null && jksKeystoreFile == null)
@@ -586,10 +575,7 @@ private SigningProviderByJks createJksKeyProvider()
586575
}
587576
if(jksKeystorePassword != null && jksKeystoreFile != null)
588577
{
589-
return new SigningProviderByJks(
590-
jksKeystoreFile,
591-
jksKeystorePassword
592-
);
578+
return new SigningProviderByJks(jksKeystoreFile, jksKeystorePassword);
593579
}
594580
if(jksKeystoreFile == null)
595581
{
@@ -607,20 +593,20 @@ private SigningProviderByPem createPemKeyProvider()
607593
PropertiesSupplier.PROPERTY_NAME_SIGNING_PEM_SIGNATURE_ALGORITHM,
608594
SigningProviderByPem.DEFAULT_PRIVATE_KEY_ALGORITHM);
609595
final String pemCertificateFile =
610-
this.propertiesSupplier.getPropertyFromConfig(PropertiesSupplier.PROPERTY_NAME_SIGNING_PEM_CERTIFICATE_FILE);
596+
this.propertiesSupplier.getPropertyFromConfig(
597+
PropertiesSupplier.PROPERTY_NAME_SIGNING_PEM_CERTIFICATE_FILE
598+
);
611599
final String pemPrivateKeyFile =
612-
this.propertiesSupplier.getPropertyFromConfig(PropertiesSupplier.PROPERTY_NAME_SIGNING_PEM_PRIVATE_KEY_FILE);
600+
this.propertiesSupplier.getPropertyFromConfig(
601+
PropertiesSupplier.PROPERTY_NAME_SIGNING_PEM_PRIVATE_KEY_FILE
602+
);
613603
if(pemCertificateFile == null && pemPrivateKeyFile == null)
614604
{
615605
return null;
616606
}
617607
if(pemCertificateFile != null && pemPrivateKeyFile != null)
618608
{
619-
return new SigningProviderByPem(
620-
pemCertificateFile,
621-
pemPrivateKeyFile,
622-
signatureAlgorithm
623-
);
609+
return new SigningProviderByPem(pemCertificateFile, pemPrivateKeyFile, signatureAlgorithm);
624610
}
625611
if(pemCertificateFile == null)
626612
{
@@ -667,8 +653,7 @@ private BzstDipAddressFix getSetPropertyOrReadFromFileAddress(final BzstDipAddre
667653
this.getSetPropertyOrReadFromFile(
668654
null,
669655
PropertiesSupplier.PROPERTY_NAME_PLATFORM_OPERATOR_ADDRESS_CITY),
670-
null
671-
);
656+
null);
672657
}
673658

674659
private LocalDate getSetPropertyOrReadFromFileDate(
@@ -750,9 +735,7 @@ private BzstDipOecdDocType getSetPropertyOrReadFromFileOecdDocType(
750735
{
751736
return builderProperty;
752737
}
753-
return BzstDipOecdDocType.valueOf(this.getSetPropertyOrReadFromFile(
754-
null,
755-
propertyNameInFile));
738+
return BzstDipOecdDocType.valueOf(this.getSetPropertyOrReadFromFile(null, propertyNameInFile));
756739
}
757740

758741
private BzstDipDpiMessageType getSetPropertyOrReadFromFileDpiMessageType(
@@ -763,10 +746,7 @@ private BzstDipDpiMessageType getSetPropertyOrReadFromFileDpiMessageType(
763746
{
764747
return builderProperty;
765748
}
766-
final String propertyValue = this.getSetPropertyOrReadFromFile(
767-
null,
768-
propertyNameInFile,
769-
null);
749+
final String propertyValue = this.getSetPropertyOrReadFromFile(null, propertyNameInFile, null);
770750
if(propertyValue != null)
771751
{
772752
return BzstDipDpiMessageType.valueOf(propertyValue);

bzst-dip-java-client/src/test/java/software/xdev/bzst/dip/client/ReportableSellerCsvFileParserTest.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@
4242
import software.xdev.bzst.dip.client.model.configuration.BzstDipOecdDocType;
4343
import software.xdev.bzst.dip.client.model.message.dac7.BzstDipAddressFix;
4444
import software.xdev.bzst.dip.client.parser.ReportableSellerCsvFileParser;
45-
import software.xdev.bzst.dip.client.signing.SigningProvider;
4645
import software.xdev.bzst.dip.client.signing.SigningProviderByPem;
4746
import software.xdev.bzst.dip.client.xmldocument.model.CorrectableReportableSellerType;
4847

bzst-dip-java-client/src/test/java/software/xdev/bzst/dip/client/signing/SigningProviderByJksTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ void getPrivateKey()
4848
}
4949

5050
@Test
51-
void getPrivateKey_wrongPassword()
51+
void getPrivateKeyWrongPassword()
5252
{
5353
final SigningProviderByJks signingProviderByJks = new SigningProviderByJks(
5454
CERTIFICATE_KEYSTORE_PATH,
@@ -61,7 +61,7 @@ void getPrivateKey_wrongPassword()
6161
}
6262

6363
@Test
64-
void getCertificate_wrongPassword()
64+
void getCertificateWrongPassword()
6565
{
6666
final SigningProviderByJks signingProviderByJks = new SigningProviderByJks(
6767
CERTIFICATE_KEYSTORE_PATH,

0 commit comments

Comments
 (0)