Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
f87062c
Bump android-actions/setup-android from 2 to 2.0.6
dependabot[bot] May 12, 2021
c351f95
Bump actions/checkout from 2 to 2.3.4
dependabot[bot] May 12, 2021
33bfd76
Merge pull request #202 from microsoftgraph/dependabot/github_actions…
baywet May 12, 2021
cc4037a
Merge pull request #201 from microsoftgraph/dependabot/github_actions…
baywet May 12, 2021
73e25f8
Bump mockito-inline from 3.9.0 to 3.10.0
dependabot[bot] May 13, 2021
72ef15b
Merge pull request #204 from microsoftgraph/dependabot/gradle/org.moc…
baywet May 13, 2021
f8c1d5a
Bump mockito-inline from 3.9.0 to 3.10.0
dependabot[bot] May 13, 2021
c5675e3
Merge pull request #205 from microsoftgraph/dependabot/maven/org.mock…
baywet May 13, 2021
dd831f0
Bump junit-jupiter-api from 5.7.1 to 5.7.2
dependabot[bot] May 17, 2021
82ff3cb
Merge pull request #207 from microsoftgraph/dependabot/gradle/org.jun…
baywet May 17, 2021
9e88bc4
Bump junit-jupiter-engine from 5.7.1 to 5.7.2
dependabot[bot] May 17, 2021
08c5eaa
Bump junit-jupiter-api from 5.7.1 to 5.7.2
dependabot[bot] May 17, 2021
aa91de8
Merge pull request #206 from microsoftgraph/dependabot/gradle/org.jun…
baywet May 17, 2021
fc42c3c
Merge pull request #208 from microsoftgraph/dependabot/maven/org.juni…
baywet May 17, 2021
b645493
Bump gson from 2.8.6 to 2.8.7
dependabot[bot] May 25, 2021
bde72da
Bump gson from 2.8.6 to 2.8.7
dependabot[bot] May 25, 2021
9107ed8
Merge pull request #211 from microsoftgraph/dependabot/maven/com.goog…
baywet May 25, 2021
023336b
Merge pull request #210 from microsoftgraph/dependabot/gradle/com.goo…
baywet May 25, 2021
ea528a4
Bump android-actions/setup-android from 2.0.6 to 2.0.7
dependabot[bot] May 26, 2021
1a212de
Merge pull request #212 from microsoftgraph/dependabot/github_actions…
baywet May 26, 2021
00a250c
- fixes #213 changes annotations to nonnull for build request methods
baywet May 26, 2021
7884517
- bumps patch version number
baywet May 26, 2021
b5e0deb
Merge pull request #214 from microsoftgraph/bugfix/buildrequest-nonnull
baywet May 26, 2021
859776a
- fixes #209 a bug where batch errors would not respect configured lo…
baywet May 26, 2021
96ac49f
- adds unit tests for batch response steps exception verbosity
baywet May 26, 2021
c5f4936
Merge pull request #215 from microsoftgraph/bugfix/batch-error-verbose
baywet May 26, 2021
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
4 changes: 2 additions & 2 deletions .github/workflows/api-level-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ jobs:
lint-api-level:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v2.3.4
- uses: actions/setup-java@v2
with:
distribution: 'adopt'
java-version: 16
- name: Setup Android SDK
uses: android-actions/setup-android@v2
uses: android-actions/setup-android@v2.0.7
- name: Add execution right to the script
run: chmod +x gradlew
working-directory: ./android
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v2.3.4
with:
# We must fetch at least the immediate parents so that if this is
# a pull request then we can checkout the head.
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/sample-build-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
samples-build-check-device-code:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v2.3.4
- uses: actions/setup-java@v2
with:
distribution: 'adopt'
Expand All @@ -24,7 +24,7 @@ jobs:
samples-build-check-interactive:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v2.3.4
- uses: actions/setup-java@v2
with:
distribution: 'adopt'
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 = 2
mavenMinorVersion = 0
mavenPatchVersion = 2
mavenPatchVersion = 3
mavenArtifactSuffix =

#These values are used to run functional tests
Expand Down
8 changes: 4 additions & 4 deletions gradle/dependencies.gradle
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
dependencies {
// Use JUnit test framework
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.7.1'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.7.1'
testImplementation 'org.mockito:mockito-inline:3.9.0'
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.7.2'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.7.2'
testImplementation 'org.mockito:mockito-inline:3.10.0'

api 'com.squareup.okhttp3:okhttp:4.9.1'

implementation 'com.google.guava:guava:30.1.1-jre'

implementation 'com.google.code.gson:gson:2.8.6'
implementation 'com.google.code.gson:gson:2.8.7'
api 'com.azure:azure-core:1.16.0'
}
6 changes: 3 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.6</version>
<version>2.8.7</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
Expand All @@ -40,13 +40,13 @@
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>5.7.1</version>
<version>5.7.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-inline</artifactId>
<version>3.9.0</version>
<version>3.10.0</version>
<scope>test</scope>
</dependency>
</dependencies>
Expand Down
4 changes: 2 additions & 2 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ repositories {

dependencies {
// Include the sdk as a dependency
implementation 'com.microsoft.graph:microsoft-graph-core:2.0.2'
implementation 'com.microsoft.graph:microsoft-graph-core:2.0.3'
// This dependency is only needed if you are using the TokenCrendentialAuthProvider
implementation 'com.azure:azure-identity:1.2.5'
}
Expand All @@ -35,7 +35,7 @@ Add the dependency in `dependencies` in pom.xml
<!-- Include the sdk as a dependency -->
<groupId>com.microsoft.graph</groupId>
<artifactId>microsoft-graph-core</artifactId>
<version>2.0.2</version>
<version>2.0.3</version>
<!-- This dependency is only needed if you are using the TokenCrendentialAuthProvider -->
<groupId>com.azure</groupId>
<artifactId>azure-identity</artifactId>
Expand Down
13 changes: 11 additions & 2 deletions src/main/java/com/microsoft/graph/content/BatchResponseStep.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@
import com.microsoft.graph.http.GraphErrorResponse;
import com.microsoft.graph.http.GraphFatalServiceException;
import com.microsoft.graph.http.GraphServiceException;
import com.microsoft.graph.logger.ILogger;
import com.microsoft.graph.logger.LoggerLevel;
import com.microsoft.graph.serializer.DefaultSerializer;
import com.microsoft.graph.serializer.ISerializer;

/** Response for the batch step */
Expand Down Expand Up @@ -61,7 +64,13 @@ public <T2> T2 getDeserializedBody(@Nonnull final Class<T2> resultClass) throws
final GraphErrorResponse error = serializer.deserializeObject((JsonElement)body, GraphErrorResponse.class);
if(error == null || error.error == null) {
return serializer.deserializeObject((JsonElement)body, resultClass);
} else
throw GraphServiceException.createFromResponse("", "", new ArrayList<>(), "", headers, "", status, error, false);
} else {
boolean verboseError = false;
if(serializer instanceof DefaultSerializer) {
final ILogger logger = ((DefaultSerializer)serializer).getLogger();
verboseError = logger != null && logger.getLoggingLevel() == LoggerLevel.DEBUG;
}
throw GraphServiceException.createFromResponse("", "", new ArrayList<>(), "", headers, "", status, error, verboseError);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public BaseCollectionRequestBuilder(@Nonnull final String requestUrl, @Nonnull f
* @param requestOptions the options for this request
* @return the IUserRequest instance
*/
@Nullable
@Nonnull
public T5 buildRequest(@Nullable final com.microsoft.graph.options.Option... requestOptions) {
return buildRequest(getOptions(requestOptions));
}
Expand All @@ -57,7 +57,7 @@ public T5 buildRequest(@Nullable final com.microsoft.graph.options.Option... req
* @param requestOptions the options for this request
* @return the IUserRequest instance
*/
@Nullable
@Nonnull
public T5 buildRequest(@Nullable final java.util.List<? extends com.microsoft.graph.options.Option> requestOptions) {
try {
return collRequestClass.getConstructor(String.class, IBaseClient.class, java.util.List.class)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public BaseReferenceRequestBuilder(@Nonnull final String requestUrl, @Nonnull fi
* @param requestOptions the options for this request
* @return The ReferenceRequest instance
*/
@Nullable
@Nonnull
public T2 buildRequest(@Nullable final com.microsoft.graph.options.Option... requestOptions) {
return buildRequest(getOptions(requestOptions));
}
Expand All @@ -68,7 +68,7 @@ public T2 buildRequest(@Nullable final com.microsoft.graph.options.Option... req
* @param requestOptions the options for this request
* @return the ReferenceRequest instance
*/
@Nullable
@Nonnull
public T2 buildRequest(@Nullable final java.util.List<? extends com.microsoft.graph.options.Option> requestOptions) {
try {
return refRequestClass.getConstructor(String.class, IBaseClient.class, java.util.List.class)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public BaseWithReferenceRequestBuilder(@Nonnull final String requestUrl, @Nonnul
* @param requestOptions the options for this request
* @return the ReferenceRequest instance
*/
@Nullable
@Nonnull
public T2 buildRequest(@Nullable final com.microsoft.graph.options.Option... requestOptions) {
return buildRequest(getOptions(requestOptions));
}
Expand All @@ -74,7 +74,7 @@ public T2 buildRequest(@Nullable final com.microsoft.graph.options.Option... req
* @param requestOptions the options for this request
* @return the ReferenceRequest instance
*/
@Nullable
@Nonnull
public T2 buildRequest(@Nullable final java.util.List<? extends com.microsoft.graph.options.Option> requestOptions) {
try {
return wReferenceRequestClass.getConstructor(String.class, IBaseClient.class, java.util.List.class)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public class TelemetryHandler implements Interceptor{
/**
* Current SDK version
*/
public static final String VERSION = "v2.0.2";
public static final String VERSION = "v2.0.3";
/**
* Verion prefix
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,6 @@ public Class<?> getDerivedClass(@Nonnull final JsonObject jsonObject, @Nullable
*
* @return a logger
*/
@VisibleForTesting
@Nullable
public ILogger getLogger() {
return logger;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@
import com.google.gson.JsonElement;
import com.microsoft.graph.http.GraphErrorResponse;
import com.microsoft.graph.http.GraphServiceException;
import com.microsoft.graph.logger.DefaultLogger;
import com.microsoft.graph.logger.ILogger;
import com.microsoft.graph.logger.LoggerLevel;
import com.microsoft.graph.serializer.DefaultSerializer;
import com.microsoft.graph.serializer.ISerializer;

Expand Down Expand Up @@ -114,4 +116,52 @@ public void deserializesErrorsProperly() {
} else
fail("batch response was null");
}
@Test
public void includeVerboseInformation() {
String responsebody = "{\"responses\":[{\"id\":\"1\",\"status\":400,\"headers\":{\"Cache-Control\":\"no-cache\",\"x-ms-resource-unit\":\"1\",\"Content-Type\":\"application/json\"},\"body\":{\"error\":{\"code\":\"Request_BadRequest\",\"message\":\"Avalueisrequiredforproperty'displayName'ofresource'User'.\",\"innerError\":{\"date\":\"2021-02-02T19:19:38\",\"request-id\":\"408b8e64-4047-4c97-95b6-46e9f212ab48\",\"client-request-id\":\"102910da-260c-3028-0fb3-7d6903a02622\"}}}}]}";
ISerializer serializer = new DefaultSerializer(new DefaultLogger() {{
setLoggingLevel(LoggerLevel.DEBUG);
}});
BatchResponseContent batchresponse = serializer.deserializeObject(responsebody, BatchResponseContent.class);
if(batchresponse != null) {
if(batchresponse.responses != null) // this is done by the batch request in the fluent API
for(final BatchResponseStep<?> step : batchresponse.responses) {
step.serializer = serializer;
}
try {
batchresponse.getResponseById("1").getDeserializedBody(BatchRequestContent.class);
} catch(GraphServiceException ex) {
final GraphErrorResponse response = ex.getError();
assertNotNull(response);
assertNotNull(response.error);
assertNotNull(response.error.message);
assertEquals(ex.getMessage(true), ex.getMessage());
}
} else
fail("batch response was null");
}
@Test
public void doesNotIncludeVerboseInformation() {
String responsebody = "{\"responses\":[{\"id\":\"1\",\"status\":400,\"headers\":{\"Cache-Control\":\"no-cache\",\"x-ms-resource-unit\":\"1\",\"Content-Type\":\"application/json\"},\"body\":{\"error\":{\"code\":\"Request_BadRequest\",\"message\":\"Avalueisrequiredforproperty'displayName'ofresource'User'.\",\"innerError\":{\"date\":\"2021-02-02T19:19:38\",\"request-id\":\"408b8e64-4047-4c97-95b6-46e9f212ab48\",\"client-request-id\":\"102910da-260c-3028-0fb3-7d6903a02622\"}}}}]}";
ISerializer serializer = new DefaultSerializer(new DefaultLogger() {{
setLoggingLevel(LoggerLevel.ERROR);
}});
BatchResponseContent batchresponse = serializer.deserializeObject(responsebody, BatchResponseContent.class);
if(batchresponse != null) {
if(batchresponse.responses != null) // this is done by the batch request in the fluent API
for(final BatchResponseStep<?> step : batchresponse.responses) {
step.serializer = serializer;
}
try {
batchresponse.getResponseById("1").getDeserializedBody(BatchRequestContent.class);
} catch(GraphServiceException ex) {
final GraphErrorResponse response = ex.getError();
assertNotNull(response);
assertNotNull(response.error);
assertNotNull(response.error.message);
assertEquals(ex.getMessage(false), ex.getMessage());
}
} else
fail("batch response was null");
}
}