Skip to content

Commit 480b521

Browse files
committed
- avoid instantiating a builder when it's not needed
1 parent c7b27a8 commit 480b521

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

‎src/main/java/com/microsoft/graph/http/BaseCollectionRequest.java‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,10 +120,10 @@ protected java.util.concurrent.CompletableFuture<T2> sendAsync() throws ClientEx
120120
public T3 buildFromResponse(@Nonnull final T2 response) {
121121
final List<com.microsoft.graph.options.Option> options = new java.util.ArrayList<com.microsoft.graph.options.Option>();
122122
try {
123-
final Object builder = this.collRequestBuilderClass
123+
final Object builder = response.nextLink() == null ? null : this.collRequestBuilderClass
124124
.getConstructor(String.class, IBaseClient.class, java.util.List.class)
125125
.newInstance(response.nextLink(), getBaseRequest().getClient(), options);
126-
final T3 page = (T3)this.collectionPageClass.getConstructor(response.getClass(), builder.getClass()).newInstance(response, response.nextLink() == null ? null : builder);
126+
final T3 page = (T3)this.collectionPageClass.getConstructor(response.getClass(), this.collRequestBuilderClass).newInstance(response, builder);
127127
return page;
128128
} catch(IllegalArgumentException | InstantiationException | IllegalAccessException | InvocationTargetException | NoSuchMethodException | SecurityException ex) {
129129
throw new ClientException("Could not find the required class", ex);

0 commit comments

Comments
 (0)