Skip to content

Commit 2da8811

Browse files
authored
Merge branch 'dev' into feature/v2
2 parents 81639b6 + 317c35f commit 2da8811

4 files changed

Lines changed: 11 additions & 8 deletions

File tree

‎gradle.properties‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ mavenGroupId = com.microsoft.graph
2525
mavenArtifactId = microsoft-graph-core
2626
mavenMajorVersion = 1
2727
mavenMinorVersion = 0
28-
mavenPatchVersion = 6
28+
mavenPatchVersion = 7
2929
mavenArtifactSuffix =
3030
nightliesUrl = http://dl.bintray.com/MicrosoftGraph/Maven
3131

‎readme.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ repositories {
2020

2121
dependencies {
2222
// Include the sdk as a dependency
23-
implementation 'com.microsoft.graph:microsoft-graph-core:1.0.6'
23+
implementation 'com.microsoft.graph:microsoft-graph-core:1.0.7'
2424
}
2525
```
2626

@@ -32,7 +32,7 @@ Add the dependency in `dependencies` in pom.xml
3232
<dependency>
3333
<groupId>com.microsoft.graph</groupId>
3434
<artifactId>microsoft-graph-core</artifactId>
35-
<version>1.0.6</version>
35+
<version>1.0.7</version>
3636
</dependency>
3737
```
3838

‎src/main/java/com/microsoft/graph/httpcore/TelemetryHandler.java‎

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public class TelemetryHandler implements Interceptor{
2525
/**
2626
* Current SDK version
2727
*/
28-
public static final String VERSION = "v1.0.6";
28+
public static final String VERSION = "v1.0.7";
2929
/**
3030
* Verion prefix
3131
*/
@@ -42,6 +42,7 @@ public class TelemetryHandler implements Interceptor{
4242
* The client request ID header
4343
*/
4444
public static final String CLIENT_REQUEST_ID = "client-request-id";
45+
private static final String DEFAULT_VERSION_VALUE = "0";
4546

4647
@Override
4748
@Nullable
@@ -56,7 +57,9 @@ public Response intercept(@Nonnull final Chain chain) throws IOException {
5657
final String featureUsage = "(featureUsage=" + telemetryOptions.getFeatureUsage() + ")";
5758
final String javaVersion = System.getProperty("java.version");
5859
final String androidVersion = getAndroidAPILevel();
59-
final String sdkversion_value = GRAPH_VERSION_PREFIX + "/" + VERSION + " " + featureUsage + " " + JAVA_VERSION_PREFIX + "/" + javaVersion + " " + ANDROID_VERSION_PREFIX + "/" + androidVersion;
60+
final String sdkversion_value = GRAPH_VERSION_PREFIX + "/" + VERSION + " " + featureUsage +
61+
(javaVersion == DEFAULT_VERSION_VALUE ? "" : (", " + JAVA_VERSION_PREFIX + "/" + javaVersion)) +
62+
(androidVersion == DEFAULT_VERSION_VALUE ? "" : (", " + ANDROID_VERSION_PREFIX + "/" + androidVersion));
6063
telemetryAddedBuilder.addHeader(SDK_VERSION, sdkversion_value);
6164

6265
if(request.header(CLIENT_REQUEST_ID) == null) {
@@ -87,10 +90,10 @@ private String getAndroidAPILevelInternal() {
8790
final Field sdkVersionField = versionClass.getField("SDK_INT");
8891
final Object value = sdkVersionField.get(null);
8992
final String valueStr = String.valueOf(value);
90-
return valueStr == null || valueStr == "" ? "0" : valueStr;
93+
return valueStr == null || valueStr == "" ? DEFAULT_VERSION_VALUE : valueStr;
9194
} catch (IllegalAccessException | ClassNotFoundException | NoSuchFieldException ex) {
9295
// we're not on android and return "0" to align with java version which returns "0" when running on android
93-
return "0";
96+
return DEFAULT_VERSION_VALUE;
9497
}
9598
}
9699
}

‎src/test/java/com/microsoft/graph/httpcore/TelemetryHandlerTest.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public Request authenticateRequest(Request request) {
3333
final Response response = client.newCall(request).execute();
3434
assertNotNull(response);
3535
assertTrue(response.request().header(TelemetryHandler.SDK_VERSION).contains(expectedHeader));
36-
assertTrue(response.request().header(TelemetryHandler.SDK_VERSION).contains(TelemetryHandler.ANDROID_VERSION_PREFIX));
36+
assertTrue(!response.request().header(TelemetryHandler.SDK_VERSION).contains(TelemetryHandler.ANDROID_VERSION_PREFIX)); // Android version is not going to be present on unit tests runnning on java platform
3737
assertTrue(response.request().header(TelemetryHandler.SDK_VERSION).contains(TelemetryHandler.JAVA_VERSION_PREFIX));
3838
}
3939

0 commit comments

Comments
 (0)