Skip to content
This repository has been archived by the owner on Sep 26, 2023. It is now read-only.

fix: Preconditions only supports %s format #1153

merged 1 commit into from
Jul 21, 2020


Copy link

Preconditions only support use of the %s format specifier (docs) and gax-java had a %d format specifier. This switches it to %s.

The following error showed up in bazel builds of java_gapic_library targets on HEAD of googleapis:

external/com_google_api_gax_java/gax-grpc/src/main/java/com/google/api/gax/grpc/ error: [PreconditionsInvalidPlaceholder] Preconditions only accepts the %s placeholder in error message strings
          poolSize <= MAX_POOL_SIZE, "Pool size must be less than %d", MAX_POOL_SIZE);
  Did you mean 'poolSize <= MAX_POOL_SIZE, "Pool size must be less than %s", MAX_POOL_SIZE);'?

I'm not sure what changed, maybe the dependency version brought was updated transiently to the later versions that throw an exception on format specifier support in Preconditions. Regardless, this is an easy fix.

@google-cla google-cla bot added the cla: yes This human has signed the Contributor License Agreement. label Jul 21, 2020
Copy link

codecov bot commented Jul 21, 2020

Codecov Report

Merging #1153 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff            @@
##             master    #1153   +/-   ##
  Coverage     78.65%   78.65%           
  Complexity     1170     1170           
  Files           204      204           
  Lines          5195     5195           
  Branches        417      417           
  Hits           4086     4086           
  Misses          935      935           
  Partials        174      174           
Impacted Files Coverage Δ Complexity Δ
...api/gax/grpc/ 77.83% <ø> (ø) 33.00 <0.00> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9645752...892414e. Read the comment docs.

Copy link

@miraleung miraleung left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alternatively, String.format("Pool size ... %d", MAX_POOL_SIZE)

@noahdietz noahdietz merged commit 8145311 into googleapis:master Jul 21, 2020
@noahdietz noahdietz deleted the fix-preconidition branch July 21, 2020 18:53
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
cla: yes This human has signed the Contributor License Agreement.
None yet

Successfully merging this pull request may close these issues.

None yet

2 participants