Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
68 commits
Select commit Hold shift + click to select a range
bd69f87
- fixes reference to removed tag for github release action
baywet Mar 28, 2024
5963f55
Merge pull request #1558 from microsoftgraph/bugfix/release-wf
baywet Apr 2, 2024
d777f8b
chore(deps): bump com.gradle:gradle-enterprise-gradle-plugin in /android
dependabot[bot] Apr 3, 2024
1f4fcb0
Merge pull request #1559 from microsoftgraph/dependabot/gradle/androi…
github-actions[bot] Apr 3, 2024
32cd158
chore(deps): bump the kiota-dependencies group
dependabot[bot] Apr 4, 2024
ea80c30
Merge pull request #1560 from microsoftgraph/dependabot/gradle/androi…
github-actions[bot] Apr 4, 2024
1e3a749
chore(deps): bump com.azure:azure-core from 1.47.0 to 1.48.0 in /android
dependabot[bot] Apr 8, 2024
d06ce8b
Merge pull request #1561 from microsoftgraph/dependabot/gradle/androi…
github-actions[bot] Apr 8, 2024
391c958
chore(deps): bump com.azure:azure-core from 1.47.0 to 1.48.0
dependabot[bot] Apr 8, 2024
2b5c371
Merge pull request #1565 from microsoftgraph/dependabot/maven/com.azu…
github-actions[bot] Apr 8, 2024
2bc9688
chore(deps): bump com.github.spotbugs:spotbugs-annotations
dependabot[bot] Apr 8, 2024
ed2aba5
Merge pull request #1564 from microsoftgraph/dependabot/maven/com.git…
github-actions[bot] Apr 8, 2024
c1707f4
chore(deps): bump jakarta.annotation:jakarta.annotation-api in /android
dependabot[bot] Apr 8, 2024
ac7591e
chore(deps): bump jakarta.annotation:jakarta.annotation-api
dependabot[bot] Apr 8, 2024
bac4e72
Merge pull request #1562 from microsoftgraph/dependabot/gradle/androi…
andrueastman Apr 8, 2024
0e39266
Merge pull request #1566 from microsoftgraph/dependabot/gradle/jakart…
andrueastman Apr 8, 2024
64647a5
chore(deps): bump android-actions/setup-android from 3.2.0 to 3.2.1
dependabot[bot] Apr 8, 2024
ed9ddad
Merge pull request #1563 from microsoftgraph/dependabot/github_action…
github-actions[bot] Apr 8, 2024
76dd7cb
chore(deps): bump com.github.spotbugs from 6.0.9 to 6.0.10
dependabot[bot] Apr 9, 2024
4dd3a68
Merge pull request #1567 from microsoftgraph/dependabot/gradle/com.gi…
github-actions[bot] Apr 9, 2024
5d1bb8d
chore(deps): bump io.opentelemetry:opentelemetry-context
dependabot[bot] Apr 9, 2024
6a0e21e
Merge pull request #1568 from microsoftgraph/dependabot/gradle/io.ope…
github-actions[bot] Apr 9, 2024
5db5257
chore(deps): bump io.opentelemetry:opentelemetry-api
dependabot[bot] Apr 9, 2024
73ecf3f
chore(deps): bump io.opentelemetry:opentelemetry-api in /android
dependabot[bot] Apr 9, 2024
fa8f04f
Merge pull request #1570 from microsoftgraph/dependabot/gradle/androi…
github-actions[bot] Apr 9, 2024
dd01644
Merge pull request #1569 from microsoftgraph/dependabot/gradle/io.ope…
github-actions[bot] Apr 9, 2024
9167293
chore(deps): bump com.android.tools.build:gradle in /android
dependabot[bot] Apr 10, 2024
6fb236d
Merge pull request #1571 from microsoftgraph/dependabot/gradle/androi…
github-actions[bot] Apr 11, 2024
b7152a0
chore(deps): bump com.gradle:gradle-enterprise-gradle-plugin in /android
dependabot[bot] Apr 11, 2024
9753b06
Merge pull request #1572 from microsoftgraph/dependabot/gradle/androi…
github-actions[bot] Apr 11, 2024
b440759
chore(deps): bump com.github.spotbugs from 6.0.10 to 6.0.11
dependabot[bot] Apr 11, 2024
68306dc
Merge pull request #1573 from microsoftgraph/dependabot/gradle/com.gi…
github-actions[bot] Apr 11, 2024
107d675
chore(deps): bump the kiota-dependencies group
dependabot[bot] Apr 12, 2024
2382b83
chore(deps): bump the kiota-dependencies group with 7 updates
dependabot[bot] Apr 12, 2024
fea6cba
Merge pull request #1574 from microsoftgraph/dependabot/gradle/androi…
github-actions[bot] Apr 12, 2024
f1d1347
Merge pull request #1576 from microsoftgraph/dependabot/gradle/kiota-…
github-actions[bot] Apr 12, 2024
10ee943
chore(deps): bump com.github.spotbugs from 6.0.11 to 6.0.12
dependabot[bot] Apr 12, 2024
9a3c8f4
Merge pull request #1578 from microsoftgraph/dependabot/gradle/com.gi…
github-actions[bot] Apr 12, 2024
422e2ea
chore(deps): bump io.github.std-uritemplate:std-uritemplate
dependabot[bot] Apr 12, 2024
2ba8b10
Merge pull request #1577 from microsoftgraph/dependabot/gradle/io.git…
github-actions[bot] Apr 12, 2024
92c0cfa
chore(deps): bump com.gradle:gradle-enterprise-gradle-plugin in /android
dependabot[bot] Apr 18, 2024
5699824
Merge pull request #1579 from microsoftgraph/dependabot/gradle/androi…
github-actions[bot] Apr 18, 2024
2ad9271
Update LargeFileUploadTask.java
ffcdf Mar 1, 2024
2ebc118
Update LargeFileUploadTask.java
ffcdf Mar 4, 2024
d4c751f
Update LargeFileUploadTask.java
ffcdf Mar 4, 2024
61baa39
Update CHANGELOG.md
ffcdf Mar 11, 2024
8cd9696
Update tests to use mock HTTP client
Ndiritu Mar 20, 2024
1821a88
Handle empty response body with location header
Ndiritu Mar 20, 2024
7f8baf5
Update CHANGELOG and bump version
Ndiritu Mar 20, 2024
4e1a12b
- bumps patch version
baywet Mar 28, 2024
f328241
- bumps telemetry patch version
baywet Mar 28, 2024
3b1681e
add 'canBeParsed' check
ramsessanchez Apr 8, 2024
005cab2
Update test implementation dependencies
Ndiritu Apr 15, 2024
c411888
Simplify upload response handling
Ndiritu Apr 16, 2024
13187be
Restore using nativeResponseHandler in GET uploadSession to handle er…
Ndiritu Apr 17, 2024
0ccd9e3
Check for response body using content-length or content type
Ndiritu Apr 17, 2024
d770fd7
Check for empty response body using content type and content length
Ndiritu Apr 18, 2024
458cca4
Update CHANGELOG
Ndiritu Apr 18, 2024
22920ad
Remove unused import
Ndiritu Apr 18, 2024
924fff5
Document content length context
Ndiritu Apr 18, 2024
e4baffb
chore(deps): bump io.github.std-uritemplate:std-uritemplate
dependabot[bot] Apr 19, 2024
98754a7
Merge pull request #1580 from microsoftgraph/dependabot/gradle/io.git…
github-actions[bot] Apr 19, 2024
272db13
Merge branch 'dev' into fix/lfu
baywet Apr 19, 2024
4cc5fa8
Bump Kiota libs and remove opentelemetry alpha dependency
Ndiritu Apr 22, 2024
c13f9d6
Resolve merge conflicts
Ndiritu Apr 22, 2024
3f3d8e7
chore(deps): bump the kiota-dependencies group with 7 updates
dependabot[bot] Apr 22, 2024
64b1e20
Merge pull request #1581 from microsoftgraph/dependabot/gradle/kiota-…
github-actions[bot] Apr 22, 2024
0f88740
Merge pull request #1548 from microsoftgraph/fix/lfu
baywet Apr 22, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/api-level-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
distribution: 'temurin'
java-version: 20
- name: Setup Android SDK
uses: android-actions/setup-android@v3.2.0
uses: android-actions/setup-android@v3.2.1
- name: Add execution right to the script
run: chmod +x gradlew
working-directory: ./android
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-and-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ jobs:
with:
tag: ${{ steps.GetVersion.outputs.tag }}
- name: Queue Git Release
uses: benc-uk/workflow-dispatch@v121
uses: benc-uk/workflow-dispatch@v1
with:
workflow: Git Release
token: ${{ secrets.PERSONAL_TOKEN }}
Expand Down
36 changes: 22 additions & 14 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Changed

## [3.1.8]

### Added

### Changed
- Changed chunkInputStream method in LargeFileUploadTask to resolve IndexOutOfBoundsException when uploading large files
- Fix Large File Upload bug where exception was thrown for completed successful uploads

## [3.1.7] - 2024-03-28

### Changed
Expand Down Expand Up @@ -60,13 +68,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed

- Version bump for Java SDK GA release.
- Bumps Kiota-Java abstractions, authentication, http, and serialization components for Java SDK 6.1.0 release.
- Bumps Kiota-Java abstractions, authentication, http, and serialization components for Java SDK 6.1.0 release.

## [3.0.12] - 2023-12-15

### Fixed
### Fixed

- Fixes a bug where a null collection for allowedHosts would result in failure to initialize client. [#1411](https://github.com/microsoftgraph/msgraph-sdk-java-core/pull/1411)
- Fixes a bug where a null collection for allowedHosts would result in failure to initialize client. [#1411](https://github.com/microsoftgraph/msgraph-sdk-java-core/pull/1411)

## [3.0.11] - 2023-12-08

Expand All @@ -77,7 +85,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [3.0.10] - 2023-11-27

### Changed
### Changed

- Removed the usage of reflection for enum deserialization and reordered RequestAdapter method arguments. [Kiota-Java #840](https://github.com/microsoft/kiota-java/issues/840)

Expand All @@ -100,13 +108,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Removed

- Removes 'SuppressFBWarnings' annotations and dependency.
- Removes 'SuppressFBWarnings' annotations and dependency.

## [3.0.7] - 2023-07-20

### Added

- Adds graph-java-sdk implementation of the `UrlReplaceHandler` middleware including default replacement pairs.
- Adds graph-java-sdk implementation of the `UrlReplaceHandler` middleware including default replacement pairs.
- Default replacement pair: '/users/TokenToReplace' -> '/me'

## [3.0.6] - 2023-07-11
Expand All @@ -123,11 +131,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [3.0.4] - 2023-05-03

### Added
- Added LargeFileUploadTask functionality for kiota generated service libraries.
### Added

- Added LargeFileUploadTask functionality for kiota generated service libraries.

### Fixed
### Fixed

- Fixes formatting used in the headers added by the telemetry handler to align with the [msGraph sdk spec.](https://github.com/microsoftgraph/msgraph-sdk-design/blob/master/middleware/TelemetryHandler.md)

Expand Down Expand Up @@ -171,7 +179,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
private OkHttpClient createClient(@Nonnull final IAuthenticationProvider auth) {
return HttpClients.createDefault(auth);
}

// then create the GraphServiceClient
IAuthenticationProvider authenticationProvider = ...;
GraphServiceClient
Expand All @@ -183,16 +191,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [2.0.20] - 2023-10-23

### Changed
### Changed

- Updates Okhttp3 to avoid transient vulnerabilty. [#1038](https://github.com/microsoftgraph/msgraph-sdk-java-core/issues/1038)
- Updates Okhttp3 to avoid transient vulnerabilty. [#1038](https://github.com/microsoftgraph/msgraph-sdk-java-core/issues/1038)

## [2.0.19] - 2023-06-20

### Changed

- Remove explicit logging of GraphServiceException in the CoreHttpProvider class. [#885](https://github.com/microsoftgraph/msgraph-sdk-java-core/issues/885)
- Thank you to @MaHa6543 for the contribution.
- Thank you to @MaHa6543 for the contribution.

## [2.0.18] - 2023-04-06

Expand Down
4 changes: 2 additions & 2 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ buildscript {
}

dependencies {
classpath "com.gradle:gradle-enterprise-gradle-plugin:3.16.2"
classpath "com.android.tools.build:gradle:8.3.1"
classpath "com.gradle:gradle-enterprise-gradle-plugin:3.17.2"
classpath "com.android.tools.build:gradle:8.3.2"
classpath "com.github.ben-manes:gradle-versions-plugin:0.51.0"
}
}
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ plugins {
id 'maven-publish'
id 'signing'
id 'jacoco'
id 'com.github.spotbugs' version '6.0.9'
id 'com.github.spotbugs' version '6.0.12'
id "org.sonarqube" version "5.0.0.4638"
}

Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ mavenGroupId = com.microsoft.graph
mavenArtifactId = microsoft-graph-core
mavenMajorVersion = 3
mavenMinorVersion = 1
mavenPatchVersion = 7
mavenPatchVersion = 8
mavenArtifactSuffix =

#These values are used to run functional tests
Expand Down
25 changes: 12 additions & 13 deletions gradle/dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,21 @@ dependencies {
testImplementation 'org.junit.jupiter:junit-jupiter-params:5.10.2'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.10.2'
testImplementation 'org.mockito:mockito-inline:5.2.0'
testImplementation 'io.opentelemetry:opentelemetry-api:1.36.0'
testImplementation 'io.opentelemetry:opentelemetry-context:1.36.0'
testImplementation 'io.github.std-uritemplate:std-uritemplate:0.0.55'

testImplementation 'io.opentelemetry:opentelemetry-api:1.37.0'
testImplementation 'io.opentelemetry:opentelemetry-context:1.37.0'
testImplementation 'io.github.std-uritemplate:std-uritemplate:0.0.57'
implementation 'com.google.code.gson:gson:2.10.1'

implementation 'jakarta.annotation:jakarta.annotation-api:2.1.1'
implementation 'jakarta.annotation:jakarta.annotation-api:3.0.0'

api 'com.squareup.okhttp3:okhttp:4.12.0'
api 'com.azure:azure-core:1.47.0'
api 'com.azure:azure-core:1.48.0'

api 'com.microsoft.kiota:microsoft-kiota-abstractions:1.1.2'
implementation 'com.microsoft.kiota:microsoft-kiota-authentication-azure:1.1.2'
implementation 'com.microsoft.kiota:microsoft-kiota-http-okHttp:1.1.2'
implementation 'com.microsoft.kiota:microsoft-kiota-serialization-json:1.1.2'
implementation 'com.microsoft.kiota:microsoft-kiota-serialization-text:1.1.2'
implementation 'com.microsoft.kiota:microsoft-kiota-serialization-form:1.1.2'
implementation 'com.microsoft.kiota:microsoft-kiota-serialization-multipart:1.1.2'
api 'com.microsoft.kiota:microsoft-kiota-abstractions:1.1.6'
implementation 'com.microsoft.kiota:microsoft-kiota-authentication-azure:1.1.6'
implementation 'com.microsoft.kiota:microsoft-kiota-http-okHttp:1.1.6'
implementation 'com.microsoft.kiota:microsoft-kiota-serialization-json:1.1.6'
implementation 'com.microsoft.kiota:microsoft-kiota-serialization-text:1.1.6'
implementation 'com.microsoft.kiota:microsoft-kiota-serialization-form:1.1.6'
implementation 'com.microsoft.kiota:microsoft-kiota-serialization-multipart:1.1.6'
}
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-core</artifactId>
<version>1.47.0</version>
<version>1.48.0</version>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
Expand All @@ -53,7 +53,7 @@
<dependency>
<groupId>com.github.spotbugs</groupId>
<artifactId>spotbugs-annotations</artifactId>
<version>4.8.3</version>
<version>4.8.4</version>
</dependency>
</dependencies>
</project>
2 changes: 1 addition & 1 deletion src/main/java/com/microsoft/graph/core/CoreConstants.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ private CoreConstants() {}
private static class VersionValues {
private static final int MAJOR = 3;
private static final int MINOR = 1;
private static final int PATCH = 7;
private static final int PATCH = 8;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,36 +52,46 @@ public <T extends Parsable> UploadResult<T> handleResponse(@Nonnull final Respon
Objects.requireNonNull(response);
Objects.requireNonNull(factory);
try (final ResponseBody body = response.body()) {
if (Objects.isNull(body)) {
UploadResult<T> uploadResult = new UploadResult<>();
String contentLengthHeader = response.headers().get("content-length");
// rely on content-type OR content-length headers to determine if response body is empty.
// Response body() may be non-null despite being empty in raw response https://square.github.io/okhttp/3.x/okhttp/okhttp3/Response.html#body--
// content-length header is not always present in Graph responses. Content-type is more reliable
if (Objects.isNull(body)
|| Objects.isNull(body.contentType())
|| (!Objects.isNull(contentLengthHeader) && Integer.parseInt(contentLengthHeader) == 0)
) {
if (response.code() == HttpURLConnection.HTTP_CREATED) {
final String location = response.headers().get("location");
if(!Objects.isNull(location) && !location.isEmpty()) {
uploadResult.location = new URI(location);
return uploadResult;
}
}
throw new ApiException(ErrorConstants.Messages.NO_RESPONSE_FOR_UPLOAD);
}
try(final InputStream in = body.byteStream()){
final String contentType = body.contentType().toString().split(";")[0]; //contentType.toString() returns in format <mediaType>;<charset>, we only want the mediaType.
if(!response.isSuccessful()) {
throw new ApiExceptionBuilder()
.withMessage(ErrorConstants.Codes.GENERAL_EXCEPTION)
.withResponseStatusCode(response.code())
.withResponseHeaders(HeadersCompatibility.getResponseHeaders(response.headers()))
.build();
}
UploadResult<T> uploadResult = new UploadResult<>();
if (response.code() == HttpURLConnection.HTTP_CREATED) {
if (body.contentLength() > 0) {
final ParseNode uploadTypeParseNode = parseNodeFactory.getParseNode(contentType, in);
uploadResult.itemResponse = uploadTypeParseNode.getObjectValue(factory);
}
final String location = response.headers().get("location");
if(!Objects.isNull(location) && !location.isEmpty()) {
uploadResult.location = new URI(location);
}
} else {
boolean canBeParsed = (!Objects.isNull(contentLengthHeader) && Integer.parseInt(contentLengthHeader) > 0) || !Objects.isNull(body.contentType());
String contentType = canBeParsed ? body.contentType().toString().split(";")[0] : null; //contentType.toString() returns in format <mediaType>;<charset>, we only want the mediaType.
if (canBeParsed) {
final ParseNode parseNode = parseNodeFactory.getParseNode(contentType, in);
final UploadSession uploadSession = parseNode.getObjectValue(UploadSession::createFromDiscriminatorValue);
final List<String> nextExpectedRanges = uploadSession.getNextExpectedRanges();
if (!(nextExpectedRanges == null || nextExpectedRanges.isEmpty())) {
uploadResult.uploadSession = uploadSession;
} else {
if (response.code() == HttpURLConnection.HTTP_CREATED) {
uploadResult.itemResponse = parseNode.getObjectValue(factory);
} else {
final UploadSession uploadSession = parseNode.getObjectValue(UploadSession::createFromDiscriminatorValue);
final List<String> nextExpectedRanges = uploadSession.getNextExpectedRanges();
if (!(nextExpectedRanges == null || nextExpectedRanges.isEmpty())) {
uploadResult.uploadSession = uploadSession;
} else {
uploadResult.itemResponse = parseNode.getObjectValue(factory);
}
}
}
return uploadResult;
Expand All @@ -91,6 +101,7 @@ public <T extends Parsable> UploadResult<T> handleResponse(@Nonnull final Respon
throw new RuntimeException(ex);
}
}

}


Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ public IUploadSession updateSessionStatus() {
return session;
}
private UploadResult<T> uploadSlice(UploadSliceRequestBuilder<T> uploadSliceRequestBuilder, ArrayList<Throwable> exceptionsList) throws IOException {
byte[] buffer = chunkInputStream(uploadStream,(int) uploadSliceRequestBuilder.getRangeBegin(), (int)uploadSliceRequestBuilder.getRangeLength());
byte[] buffer = chunkInputStream(uploadStream, (int)uploadSliceRequestBuilder.getRangeLength());
ByteArrayInputStream chunkStream = new ByteArrayInputStream(buffer);
try {
return uploadSliceRequestBuilder.put(chunkStream);
Expand Down Expand Up @@ -275,9 +275,9 @@ private long nextSliceSize(long rangeBegin, long rangeEnd) {
long size = rangeEnd - rangeBegin + 1;
return Math.min(size, this.maxSliceSize);
}
private byte[] chunkInputStream(InputStream stream, int begin, int length) throws IOException {
private byte[] chunkInputStream(InputStream stream, int length) throws IOException {
byte[] buffer = new byte[length];
int lengthAssert = stream.read(buffer, begin, length);
int lengthAssert = stream.read(buffer);
assert lengthAssert == length;
return buffer;
}
Expand Down
Loading