Skip to content

Commit b6a37a6

Browse files
committed
PMD
1 parent 9ad0c52 commit b6a37a6

6 files changed

Lines changed: 13 additions & 4 deletions

File tree

cloudplatform/connectivity-apache-httpclient5/src/main/java/com/sap/cloud/sdk/cloudplatform/connectivity/ApacheHttpClient5Wrapper.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,8 +135,7 @@ public RequestConfig getConfig()
135135
public URI mergeRequestUri( @Nonnull final URI requestUri )
136136
{
137137
final UriPathMerger merger = new UriPathMerger();
138-
URI merged;
139-
merged = merger.merge(destination.getUri(), requestUri);
138+
final URI merged = merger.merge(destination.getUri(), requestUri);
140139
final String queryString = String.join("&", QueryParamGetter.getQueryParameters(destination));
141140
return merger.merge(merged, URI.create("/?" + queryString));
142141
}

datamodel/odata-client-apache-httpclient5/src/main/java/com/sap/cloud/sdk/datamodel/odata/client/request/HttpEntityReader.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ static <T> T read(
112112
* @throws ODataDeserializationException
113113
* When streamed deserialization process failed.
114114
*/
115+
@SuppressWarnings( "PMD.CloseResource" ) // response lifecycle is owned by the caller via ODataRequestResult (Closeable)
115116
static <T> T stream(
116117
@Nonnull final ODataRequestResult result,
117118
@Nonnull final CheckedFunction1<JsonReader, T> readerConsumer )

datamodel/odata-client-apache-httpclient5/src/main/java/com/sap/cloud/sdk/datamodel/odata/client/request/MultipartHttpResponse.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ private static ContentType withFallbackCharset( @Nonnull final ContentType conte
132132
return contentType;
133133
}
134134
return contentType
135-
.withParameters(new BasicNameValuePair("charset", MultipartHttpResponse.DEFAULT_CHARSET.name()));
135+
.withParameters(new BasicNameValuePair("charset", DEFAULT_CHARSET.name()));
136136
}
137137

138138
@Nonnull
@@ -150,13 +150,19 @@ private static StatusLine getStatusLine( @Nonnull final String firstLine )
150150
return new StatusLine(HttpVersion.HTTP_1_1, 0, "Unknown");
151151
}
152152

153+
// Parameters are mandated by the Java serialization mechanism and cannot be removed.
154+
// The method unconditionally throws to prevent serialization of this class.
155+
@SuppressWarnings( "PMD.UnusedFormalParameter" )
153156
@Serial
154157
private void readObject( java.io.ObjectInputStream in )
155158
throws java.io.NotSerializableException
156159
{
157160
throw new java.io.NotSerializableException(getClass().getName());
158161
}
159162

163+
// Parameters are mandated by the Java serialization mechanism and cannot be removed.
164+
// The method unconditionally throws to prevent serialization of this class.
165+
@SuppressWarnings( "PMD.UnusedFormalParameter" )
160166
@Serial
161167
private void writeObject( java.io.ObjectOutputStream out )
162168
throws java.io.NotSerializableException

datamodel/odata-client-apache-httpclient5/src/main/java/com/sap/cloud/sdk/datamodel/odata/client/request/ODataHealthyResponseValidator.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ class ODataHealthyResponseValidator
3636
* @throws ODataServiceErrorException
3737
* When the response contains an OData error message according to specification.
3838
*/
39+
@SuppressWarnings( "PMD.CloseResource" ) // response lifecycle is owned by the caller
3940
static void requireHealthyResponse( @Nonnull final ODataRequestResult result )
4041
{
4142
final ODataRequestGeneric originalRequest = result.getODataRequest();

datamodel/odata-client-apache-httpclient5/src/main/java/com/sap/cloud/sdk/datamodel/odata/client/request/ODataRequestResultGeneric.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
import org.apache.hc.core5.http.ClassicHttpResponse;
2626
import org.apache.hc.core5.http.ContentType;
2727
import org.apache.hc.core5.http.HttpEntity;
28-
import org.apache.hc.core5.http.HttpResponse;
2928
import org.apache.hc.core5.http.io.entity.EntityUtils;
3029
import org.apache.hc.core5.http.message.StatusLine;
3130

@@ -402,6 +401,7 @@ private <T> T getPrimitiveObjectFromJson(
402401
e));
403402
}
404403

404+
@SuppressWarnings( "PMD.CloseResource" ) // The response is not being consumed here, closing it here would prematurely end the response.
405405
@Nonnull
406406
private <T> T getPrimitiveObjectFromPlainText( @Nonnull final Class<T> objectType )
407407
throws ODataDeserializationException

datamodel/odata-client-apache-httpclient5/src/main/java/com/sap/cloud/sdk/datamodel/odata/client/request/ODataRequestResultMultipartGeneric.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ public ODataRequestBatch getODataRequest()
9494
* @throws ODataServiceErrorException
9595
* When the response contains an OData error message according to specification.
9696
*/
97+
@SuppressWarnings( "PMD.CloseResource" ) // response lifecycle is owned by the caller
9798
@Nonnull
9899
@Override
99100
public ODataRequestResultGeneric getResult( @Nonnull final ODataRequestGeneric request )
@@ -166,6 +167,7 @@ private Try<List<List<ClassicHttpResponse>>> loadBatchResponses()
166167
*
167168
* @since 5.5.0
168169
*/
170+
@SuppressWarnings( "PMD.CloseResource" )
169171
@Override
170172
public void close()
171173
{

0 commit comments

Comments
 (0)