Skip to content

Commit 3be4c4b

Browse files
committed
- fixes implementation difference for large file upload session
1 parent 2c1684d commit 3be4c4b

File tree

3 files changed

+24
-2
lines changed

3 files changed

+24
-2
lines changed

src/main/java/com/microsoft/graph/core/models/IUploadSession.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public interface IUploadSession extends Parsable, AdditionalDataHolder {
2929
* A collection of byte ranges that the server is missing for the file. These ranges are zero indexed and of the format 'start-end' (e.g. '0-26' to indicate the first 27 bytes of the file). When uploading files as Outlook attachments, instead of a collection of ranges, this property always indicates a single value '{start}', the location in the file where the next upload should begin.
3030
* @return the Next Expected Ranges.
3131
*/
32-
@Nonnull
32+
@Nullable
3333
List<String> getNextExpectedRanges();
3434
/**
3535
* Sets the ranges that are yet to be uploaded.

src/main/java/com/microsoft/graph/core/models/UploadSession.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,12 @@ public void setUploadUrl(@Nonnull final String uploadUrl) {
5555
* Get the next upload byte ranges to be uploaded.
5656
* @return The byte ranges to be uploaded.
5757
*/
58-
@Nonnull
58+
@Nullable
5959
@Override
6060
public List<String> getNextExpectedRanges() {
61+
if (nextExpectedRanges == null) {
62+
return null;
63+
}
6164
return new ArrayList<>(nextExpectedRanges);
6265
}
6366
/**
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
package com.microsoft.graph.core.requests.upload;
2+
3+
import static org.junit.jupiter.api.Assertions.assertNull;
4+
5+
import java.util.List;
6+
7+
import org.junit.jupiter.api.Test;
8+
9+
import com.microsoft.graph.core.models.UploadSession;
10+
11+
class UploadSessionTest {
12+
@Test
13+
void getNextExpectedRangesDoesNotFailOnDefault()
14+
{
15+
final UploadSession uploadSession = new UploadSession();
16+
final List<String> result = uploadSession.getNextExpectedRanges();
17+
assertNull(result);
18+
}
19+
}

0 commit comments

Comments
 (0)