Skip to content

Commit 643fc74

Browse files
committed
Pre compute error matching pattern
1 parent 426fe78 commit 643fc74

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/main/java/com/google/firebase/remoteconfig/internal/RemoteConfigServiceErrorResponse.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ public final class RemoteConfigServiceErrorResponse extends GenericJson {
4040
.put("INVALID_ARGUMENT", RemoteConfigErrorCode.INVALID_ARGUMENT)
4141
.build();
4242

43+
private static final Pattern RC_ERROR_CODE_PATTERN = Pattern.compile("^\\[(\\w+)\\]:.*$");
44+
4345
@Key("error")
4446
private Map<String, Object> error;
4547

@@ -54,7 +56,7 @@ public RemoteConfigErrorCode getRemoteConfigErrorCode() {
5456
return null;
5557
}
5658

57-
Matcher errorMatcher = Pattern.compile("^\\[(\\w+)\\]:.*$").matcher(message);
59+
Matcher errorMatcher = RC_ERROR_CODE_PATTERN.matcher(message);
5860
if (errorMatcher.find()) {
5961
String errorCode = errorMatcher.group(1);
6062
return RC_ERROR_CODES.get(errorCode);

0 commit comments

Comments
 (0)