Skip to content

Commit b118768

Browse files
committed
- adds final finalizer to avoid finalizer attacks on defensive programming
Signed-off-by: Vincent Biret <[email protected]>
1 parent 85a9d2d commit b118768

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/main/java/com/microsoft/graph/core/requests/BaseGraphRequestAdapter.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,11 +153,14 @@ public BaseGraphRequestAdapter(@Nonnull AuthenticationProvider authenticationPro
153153
this(authenticationProvider, determineBaseAddress(cloud, version), graphClientOption);
154154
}
155155

156-
private static String determineBaseAddress(@Nullable Clouds nationalCloud, @Nullable String version) throws IllegalArgumentException {
157-
String cloud = nationalCloud == null ? getCloudList().get(Clouds.GLOBAL_CLOUD) : getCloudList().get(nationalCloud);
156+
private static String determineBaseAddress(@Nullable final Clouds nationalCloud, @Nullable final String version) {
157+
final String cloud = nationalCloud == null ? getCloudList().get(Clouds.GLOBAL_CLOUD) : getCloudList().get(nationalCloud);
158158
if(cloud == null) {
159159
throw new IllegalArgumentException(nationalCloud+" is an unexpected national cloud.");
160160
}
161161
return version == null ? (cloud+"/v1.0") : (cloud+"/"+version);
162162
}
163+
protected final void finalize() throws Throwable{
164+
// to avoid finalizer attacks on the constructors defensive programming
165+
}
163166
}

0 commit comments

Comments
 (0)