Skip to content

Commit a9328d9

Browse files
authored
[House keeping] Fix PMD warnings (#342)
1 parent 5030375 commit a9328d9

File tree

8 files changed

+12
-13
lines changed

8 files changed

+12
-13
lines changed

.pipeline/config.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -29,5 +29,5 @@ stages:
2929
low: '0'
3030
pmd:
3131
high: '0'
32-
normal: '6'
33-
low: '2'
32+
normal: '1'
33+
low: '0'

cloudplatform/cloudplatform-connectivity/src/main/java/com/sap/cloud/sdk/cloudplatform/connectivity/UriPathMerger.java

+4-9
Original file line numberDiff line numberDiff line change
@@ -94,15 +94,10 @@ public URI merge( @Nonnull final URI primaryUri, @Nullable final URI secondaryUr
9494
private void assertSecondaryHostMatchesPrimaryHost( @Nonnull final URI primaryUri, @Nonnull final URI secondaryUri )
9595
throws DestinationPathsNotMergeableException
9696
{
97-
if( secondaryUri.getRawAuthority() != null ) {
98-
if( !primaryUri.getRawAuthority().equals(secondaryUri.getRawAuthority()) ) {
99-
throw new DestinationPathsNotMergeableException(
100-
String
101-
.format(
102-
"URIs defined in destination '%s' and supplied by application code '%s' differ.",
103-
primaryUri,
104-
secondaryUri));
105-
}
97+
if( secondaryUri.getRawAuthority() != null
98+
&& !primaryUri.getRawAuthority().equals(secondaryUri.getRawAuthority()) ) {
99+
final String msg = "URIs defined in destination '%s' and supplied by application code '%s' differ.";
100+
throw new DestinationPathsNotMergeableException(String.format(msg, primaryUri, secondaryUri));
106101
}
107102
}
108103

cloudplatform/cloudplatform-core/src/main/java/com/sap/cloud/sdk/cloudplatform/thread/ThreadContextExecutor.java

+1
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,7 @@ public void execute( @Nonnull final Executable executable )
274274
}
275275

276276
@Nullable
277+
@SuppressWarnings( "PMD.SignatureDeclareThrowsException" ) // callable.call() throws Exception. We're not catching it here.
277278
private <T> T call( @Nonnull final Callable<T> callable )
278279
throws Exception
279280
{

cloudplatform/connectivity-destination-service/src/main/java/com/sap/cloud/sdk/cloudplatform/connectivity/DestinationKeyStoreExtractor.java

+1
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646

4747
@Slf4j
4848
@RequiredArgsConstructor
49+
@SuppressWarnings( "PMD.TooManyStaticImports" )
4950
class DestinationKeyStoreExtractor
5051
{
5152
// See the supported key store file extensions:

datamodel/datamodel-metadata-generator/src/main/java/com/sap/cloud/sdk/datamodel/metadata/generator/DefaultMavenRepositoryAccessor.java

+1-2
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,7 @@ private String obtainLatestVersionViaHttp( final MavenCoordinate mavenCoordinate
8787
+ ".");
8888
}
8989
final String latestVersion;
90-
try {
91-
final InputStream stream = response.getEntity().getContent();
90+
try( InputStream stream = response.getEntity().getContent() ) {
9291
final JsonNode tree = new XmlMapper().readTree(stream);
9392
latestVersion = tree.path("versioning").path("latest").asText();
9493
}

datamodel/odata/odata-generator/src/main/java/com/sap/cloud/sdk/datamodel/odata/generator/NamespaceClassGenerator.java

+1
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@
6060
/**
6161
* For internal use only.
6262
*/
63+
@SuppressWarnings( "PMD.TooManyStaticImports" )
6364
class NamespaceClassGenerator
6465
{
6566
private static final Logger logger = MessageCollector.getLogger(NamespaceClassGenerator.class);

s4hana/s4hana-core/src/main/java/com/sap/cloud/sdk/s4hana/serialization/DecimalBasedErpType.java

+1
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ private static BigDecimal fromErpToJavaDecimal( @Nullable String str )
126126
return new BigDecimal(str);
127127
}
128128

129+
@SuppressWarnings( "PMD.UselessParentheses" )
129130
private String toErpString()
130131
{
131132
if( value == null ) {

s4hana/s4hana-core/src/main/java/com/sap/cloud/sdk/s4hana/serialization/IntegerBasedErpType.java

+1
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,7 @@ public String toString()
185185
return toErpString();
186186
}
187187

188+
@SuppressWarnings( "PMD.UselessParentheses" )
188189
private String toErpString()
189190
{
190191
if( value == null ) {

0 commit comments

Comments
 (0)