Skip to content
This repository was archived by the owner on May 20, 2025. It is now read-only.

Commit f26c466

Browse files
Reformat code
1 parent 9abe1a5 commit f26c466

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

android/app/src/main/java/com/microsoft/codepush/react/CodePushUpdateUtils.java

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99

1010
import java.security.interfaces.*;
1111

12-
1312
import org.json.JSONArray;
1413
import org.json.JSONException;
1514
import org.json.JSONObject;
@@ -86,8 +85,12 @@ private static String computeHash(InputStream dataStream) {
8685
throw new CodePushUnknownException("Unable to compute hash of update contents.", e);
8786
} finally {
8887
try {
89-
if (digestInputStream != null) digestInputStream.close();
90-
if (dataStream != null) dataStream.close();
88+
if (digestInputStream != null) {
89+
digestInputStream.close();
90+
}
91+
if (dataStream != null) {
92+
dataStream.close();
93+
}
9194
} catch (IOException e) {
9295
e.printStackTrace();
9396
}
@@ -102,7 +105,7 @@ public static void copyNecessaryFilesFromCurrentPackage(String diffManifestFileP
102105
CodePushUtils.log("Unable to copy files from current package during diff update, because currentPackageFolderPath is invalid.");
103106
return;
104107
}
105-
FileUtils.copyDirectoryContents(currentPackageFolderPath, newPackageFolderPath);
108+
FileUtils.copyDirectoryContents(currentPackageFolderPath, newPackageFolderPath);
106109
JSONObject diffManifest = CodePushUtils.getJsonObjectFromFile(diffManifestFilePath);
107110
try {
108111
JSONArray deletedFiles = diffManifest.getJSONArray("deletedFiles");
@@ -188,7 +191,7 @@ public static void verifyFolderHash(String folderPath, String expectedHash) {
188191
public static Map<String, Object> verifyAndDecodeJWT(String jwt, PublicKey publicKey) {
189192
try {
190193
SignedJWT signedJWT = SignedJWT.parse(jwt);
191-
JWSVerifier verifier = new RSASSAVerifier((RSAPublicKey)publicKey);
194+
JWSVerifier verifier = new RSASSAVerifier((RSAPublicKey) publicKey);
192195
if (signedJWT.verify(verifier)) {
193196
Map<String, Object> claims = signedJWT.getJWTClaimsSet().getClaims();
194197
CodePushUtils.log("JWT verification succeeded, payload content: " + claims.toString());
@@ -221,7 +224,7 @@ public static PublicKey parsePublicKey(String stringPublicKey) {
221224
}
222225
}
223226

224-
public static String getSignatureFilePath(String updateFolderPath){
227+
public static String getSignatureFilePath(String updateFolderPath) {
225228
return CodePushUtils.appendPathComponent(
226229
CodePushUtils.appendPathComponent(updateFolderPath, CodePushConstants.CODE_PUSH_FOLDER_PREFIX),
227230
CodePushConstants.BUNDLE_JWT_FILE
@@ -258,7 +261,7 @@ public static void verifyUpdateSignature(String folderPath, String packageHash,
258261
throw new CodePushInvalidUpdateException("The update could not be verified because it was not signed by a trusted party.");
259262
}
260263

261-
final String contentHash = (String)claims.get("contentHash");
264+
final String contentHash = (String) claims.get("contentHash");
262265
if (contentHash == null) {
263266
throw new CodePushInvalidUpdateException("The update could not be verified because the signature did not specify a content hash.");
264267
}
@@ -269,4 +272,4 @@ public static void verifyUpdateSignature(String folderPath, String packageHash,
269272

270273
CodePushUtils.log("The update contents succeeded the code signing check.");
271274
}
272-
}
275+
}

0 commit comments

Comments
 (0)