Skip to content

Commit e725be1

Browse files
Merge branch 'main' into dependabot/maven/org.apache.httpcomponents.client5-httpclient5-5.5
2 parents 3ee9e47 + 0ec2e04 commit e725be1

File tree

8 files changed

+76
-30
lines changed

8 files changed

+76
-30
lines changed

.github/scripts/publish_preflight_check.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,8 @@ echo_info "Generating changelog"
122122
echo_info "--------------------------------------------"
123123
echo_info ""
124124

125-
echo_info "---< git fetch origin master --prune --unshallow >---"
126-
git fetch origin master --prune --unshallow
125+
echo_info "---< git fetch origin main --prune --unshallow >---"
126+
git fetch origin main --prune --unshallow
127127
echo ""
128128

129129
echo_info "Generating changelog from history..."

.github/workflows/nightly.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ jobs:
5555

5656
- name: Send email on failure
5757
if: failure()
58-
uses: firebase/firebase-admin-node/.github/actions/send-email@master
58+
uses: firebase/firebase-admin-node/.github/actions/send-email@main
5959
with:
6060
api-key: ${{ secrets.OSS_BOT_MAILGUN_KEY }}
6161
domain: ${{ secrets.OSS_BOT_MAILGUN_DOMAIN }}
@@ -70,7 +70,7 @@ jobs:
7070

7171
- name: Send email on cancelled
7272
if: cancelled()
73-
uses: firebase/firebase-admin-node/.github/actions/send-email@master
73+
uses: firebase/firebase-admin-node/.github/actions/send-email@main
7474
with:
7575
api-key: ${{ secrets.OSS_BOT_MAILGUN_KEY }}
7676
domain: ${{ secrets.OSS_BOT_MAILGUN_DOMAIN }}

.github/workflows/release.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,11 @@ jobs:
6969

7070
# Check whether the release should be published. We publish only when the trigger PR is
7171
# 1. merged
72-
# 2. to the master branch
72+
# 2. to the main branch
7373
# 3. with the label 'release:publish', and
7474
# 4. the title prefix '[chore] Release '.
7575
if: github.event.pull_request.merged &&
76-
github.ref == 'refs/heads/master' &&
76+
github.ref == 'refs/heads/main' &&
7777
contains(github.event.pull_request.labels.*.name, 'release:publish') &&
7878
startsWith(github.event.pull_request.title, '[chore] Release ')
7979

@@ -115,7 +115,7 @@ jobs:
115115
- name: Post to Twitter
116116
if: success() &&
117117
contains(github.event.pull_request.labels.*.name, 'release:tweet')
118-
uses: firebase/firebase-admin-node/.github/actions/send-tweet@master
118+
uses: firebase/firebase-admin-node/.github/actions/send-tweet@main
119119
with:
120120
status: >
121121
${{ steps.preflight.outputs.version }} of @Firebase Admin Java SDK is available.

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ Great, we love hearing how we can improve our products! Share you idea through o
4747
## <a name="submit"></a>Want to submit a pull request?
4848

4949
Sweet, we'd love to accept your contribution!
50-
[Open a new pull request](https://github.com/firebase/firebase-admin-java/pull/new/master) and fill
50+
[Open a new pull request](https://github.com/firebase/firebase-admin-java/pull/new) and fill
5151
out the provided template.
5252

5353
**If you want to implement a new feature, please open an issue with a proposal first so that we can

pom.xml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
<groupId>com.google.firebase</groupId>
2121
<artifactId>firebase-admin</artifactId>
22-
<version>9.6.0</version>
22+
<version>9.7.0</version>
2323
<packaging>jar</packaging>
2424

2525
<name>firebase-admin</name>
@@ -59,7 +59,7 @@
5959
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
6060
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
6161
<skipUTs>${skipTests}</skipUTs>
62-
<netty.version>4.2.6.Final</netty.version>
62+
<netty.version>4.2.8.Final</netty.version>
6363
</properties>
6464

6565
<scm>
@@ -82,7 +82,7 @@
8282
<plugin>
8383
<!-- Generate API docs using Doclava for the developer site -->
8484
<artifactId>maven-javadoc-plugin</artifactId>
85-
<version>3.11.3</version>
85+
<version>3.12.0</version>
8686
<executions>
8787
<execution>
8888
<phase>site</phase>
@@ -124,7 +124,7 @@
124124
<plugin>
125125
<!-- Update relative paths in generated API docs -->
126126
<artifactId>maven-antrun-plugin</artifactId>
127-
<version>3.1.0</version>
127+
<version>3.2.0</version>
128128
<executions>
129129
<execution>
130130
<phase>site</phase>
@@ -182,7 +182,7 @@
182182
<plugin>
183183
<groupId>org.jacoco</groupId>
184184
<artifactId>jacoco-maven-plugin</artifactId>
185-
<version>0.8.13</version>
185+
<version>0.8.14</version>
186186
<executions>
187187
<execution>
188188
<id>pre-unit-test</id>
@@ -208,7 +208,7 @@
208208
<plugin>
209209
<groupId>org.codehaus.mojo</groupId>
210210
<artifactId>exec-maven-plugin</artifactId>
211-
<version>3.5.1</version>
211+
<version>3.6.2</version>
212212
<executions>
213213
<execution>
214214
<phase>test</phase>
@@ -263,7 +263,7 @@
263263
<!-- Compile Phase -->
264264
<plugin>
265265
<artifactId>maven-compiler-plugin</artifactId>
266-
<version>3.14.0</version>
266+
<version>3.14.1</version>
267267
<configuration>
268268
<source>1.8</source>
269269
<target>1.8</target>
@@ -282,7 +282,7 @@
282282
<!-- Package Phase -->
283283
<plugin>
284284
<artifactId>maven-source-plugin</artifactId>
285-
<version>3.3.1</version>
285+
<version>3.4.0</version>
286286
<executions>
287287
<execution>
288288
<id>attach-sources</id>
@@ -294,7 +294,7 @@
294294
</plugin>
295295
<plugin>
296296
<artifactId>maven-javadoc-plugin</artifactId>
297-
<version>3.11.3</version>
297+
<version>3.12.0</version>
298298
<executions>
299299
<execution>
300300
<id>attach-javadocs</id>
@@ -330,7 +330,7 @@
330330
<!-- Verify Phase -->
331331
<plugin>
332332
<artifactId>maven-failsafe-plugin</artifactId>
333-
<version>3.5.3</version>
333+
<version>3.5.4</version>
334334
<executions>
335335
<execution>
336336
<goals>
@@ -345,7 +345,7 @@
345345
<plugin>
346346
<groupId>org.sonatype.central</groupId>
347347
<artifactId>central-publishing-maven-plugin</artifactId>
348-
<version>0.8.0</version>
348+
<version>0.9.0</version>
349349
<extensions>true</extensions>
350350
<configuration>
351351
<publishingServerId>central</publishingServerId>
@@ -378,7 +378,7 @@
378378
<dependency>
379379
<groupId>com.google.cloud</groupId>
380380
<artifactId>libraries-bom</artifactId>
381-
<version>26.67.0</version>
381+
<version>26.72.0</version>
382382
<type>pom</type>
383383
<scope>import</scope>
384384
</dependency>

prepare_release.sh

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,14 +66,13 @@ if [[ $(git status --porcelain) ]]; then
6666
#exit 1
6767
fi
6868

69-
echo "[INFO] Updating the master branch"
70-
git checkout master
71-
git pull origin master
69+
echo "[INFO] Updating the main branch"
70+
git fetch origin main
7271

7372
TIMESTAMP=$(date +%s)
7473
RELEASE_BRANCH="release-${TIMESTAMP}"
7574
echo "[INFO] Creating new release branch: ${RELEASE_BRANCH}"
76-
git checkout -b ${RELEASE_BRANCH} master
75+
git checkout -b ${RELEASE_BRANCH} origin/main
7776

7877

7978
#################################

src/main/java/com/google/firebase/messaging/TopicManagementResponse.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,8 @@ public class TopicManagementResponse {
3737
// Server error codes as defined in https://developers.google.com/instance-id/reference/server
3838
// TODO: Should we handle other error codes here (e.g. PERMISSION_DENIED)?
3939
private static final Map<String, String> ERROR_CODES = ImmutableMap.<String, String>builder()
40-
.put("INVALID_ARGUMENT", "invalid-argument")
4140
.put("NOT_FOUND", "registration-token-not-registered")
4241
.put("INTERNAL", "internal-error")
43-
.put("TOO_MANY_TOPICS", "too-many-topics")
4442
.build();
4543

4644
private final int successCount;
@@ -101,8 +99,11 @@ public static class Error {
10199

102100
private Error(int index, String reason) {
103101
this.index = index;
104-
this.reason = ERROR_CODES.containsKey(reason)
105-
? ERROR_CODES.get(reason) : UNKNOWN_ERROR;
102+
if (reason == null || reason.trim().isEmpty()) {
103+
this.reason = UNKNOWN_ERROR;
104+
} else {
105+
this.reason = ERROR_CODES.getOrDefault(reason, reason.toLowerCase().replace('_', '-'));
106+
}
106107
}
107108

108109
/**

src/test/java/com/google/firebase/messaging/InstanceIdClientImplTest.java

Lines changed: 48 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,30 @@ public void testTopicManagementResponseWithEmptyList() {
404404

405405
@Test
406406
public void testTopicManagementResponseErrorToString() {
407-
GenericJson json = new GenericJson().set("error", "test error");
407+
GenericJson json = new GenericJson().set("error", "INVALID_ARGUMENT");
408+
ImmutableList<GenericJson> jsonList = ImmutableList.of(json);
409+
410+
TopicManagementResponse topicManagementResponse = new TopicManagementResponse(jsonList);
411+
412+
String expected = "[Error{index=0, reason=invalid-argument}]";
413+
assertEquals(expected, topicManagementResponse.getErrors().toString());
414+
}
415+
416+
@Test
417+
public void testTopicManagementResponseErrorNotInErrorCodes() {
418+
String myError = "MY_ERROR";
419+
GenericJson json = new GenericJson().set("error", myError);
420+
ImmutableList<GenericJson> jsonList = ImmutableList.of(json);
421+
422+
TopicManagementResponse topicManagementResponse = new TopicManagementResponse(jsonList);
423+
424+
String expected = "[Error{index=0, reason=my-error}]";
425+
assertEquals(expected, topicManagementResponse.getErrors().toString());
426+
}
427+
428+
@Test
429+
public void testTopicManagementResponseErrorUnknown() {
430+
GenericJson json = new GenericJson().set("error", "");
408431
ImmutableList<GenericJson> jsonList = ImmutableList.of(json);
409432

410433
TopicManagementResponse topicManagementResponse = new TopicManagementResponse(jsonList);
@@ -413,6 +436,29 @@ public void testTopicManagementResponseErrorToString() {
413436
assertEquals(expected, topicManagementResponse.getErrors().toString());
414437
}
415438

439+
@Test
440+
public void testTopicManagementResponseErrorResourceExhausted() {
441+
GenericJson json = new GenericJson().set("error", "RESOURCE_EXHAUSTED");
442+
ImmutableList<GenericJson> jsonList = ImmutableList.of(json);
443+
444+
TopicManagementResponse topicManagementResponse = new TopicManagementResponse(jsonList);
445+
446+
String expected = "[Error{index=0, reason=resource-exhausted}]";
447+
assertEquals(expected, topicManagementResponse.getErrors().toString());
448+
}
449+
450+
@Test
451+
public void testTopicManagementResponseErrorTooManyTopics() {
452+
GenericJson json = new GenericJson().set("error", "TOO_MANY_TOPICS");
453+
ImmutableList<GenericJson> jsonList = ImmutableList.of(json);
454+
455+
TopicManagementResponse topicManagementResponse = new TopicManagementResponse(jsonList);
456+
457+
String expected = "[Error{index=0, reason=too-many-topics}]";
458+
assertEquals(expected, topicManagementResponse.getErrors().toString());
459+
}
460+
461+
416462
private static InstanceIdClientImpl initInstanceIdClient(
417463
final MockLowLevelHttpResponse mockResponse,
418464
final HttpResponseInterceptor interceptor) {
@@ -432,7 +478,7 @@ private void checkTopicManagementRequest(
432478
assertEquals(1, result.getFailureCount());
433479
assertEquals(1, result.getErrors().size());
434480
assertEquals(1, result.getErrors().get(0).getIndex());
435-
assertEquals("unknown-error", result.getErrors().get(0).getReason());
481+
assertEquals("error-reason", result.getErrors().get(0).getReason());
436482

437483
ByteArrayOutputStream out = new ByteArrayOutputStream();
438484
request.getContent().writeTo(out);

0 commit comments

Comments
 (0)