Skip to content

Commit 8ebdcd8

Browse files
committed
Fix npe
1 parent 32dbfa1 commit 8ebdcd8

1 file changed

Lines changed: 12 additions & 8 deletions

File tree

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

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -756,15 +756,19 @@ private void assertResultTypeIsNotVoid( @Nonnull final Class<?> cls )
756756
@Nonnull
757757
private String removeDuplicateQueryParameters( @Nonnull String nextLink )
758758
{
759+
if( !(httpClient instanceof UriQueryMerger) ) {
760+
return nextLink;
761+
}
762+
final String query = ((UriQueryMerger) httpClient).mergeRequestUri(URI.create("")).getRawQuery();
763+
if( query == null ) {
764+
return nextLink;
765+
}
759766
boolean changed = false;
760-
if( httpClient instanceof UriQueryMerger ) {
761-
final URI baseUri = ((UriQueryMerger) httpClient).mergeRequestUri(URI.create(""));
762-
final String[] queryArguments = baseUri.getRawQuery().split("&");
763-
for( final String argument : queryArguments ) {
764-
if( nextLink.contains(argument) ) {
765-
changed = true;
766-
nextLink = nextLink.replace(argument, "");
767-
}
767+
final String[] queryArguments = query.split("&");
768+
for( final String argument : queryArguments ) {
769+
if( nextLink.contains(argument) ) {
770+
changed = true;
771+
nextLink = nextLink.replace(argument, "");
768772
}
769773
}
770774
if( changed ) {

0 commit comments

Comments
 (0)