Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compatibility with errorprone 2.19+ / StringCaseLocaleUsage #10372

Closed
sergiitk opened this issue Jul 12, 2023 · 0 comments · Fixed by #11049
Closed

Compatibility with errorprone 2.19+ / StringCaseLocaleUsage #10372

sergiitk opened this issue Jul 12, 2023 · 0 comments · Fixed by #11049
Assignees
Milestone

Comments

@sergiitk
Copy link
Member

sergiitk commented Jul 12, 2023

main
> Task :grpc-xds:compileJava
/Users/sergiitk/Development/grpc-java/xds/src/main/java/io/grpc/xds/internal/security/trust/XdsX509TrustManager.java:100: warning: [StringCaseLocaleUsage] Specify a `Locale` when calling `String#to{Lower,Upper}Case`. (Note: there are multiple suggested fixes; the third may be most appropriate if you're dealing with ASCII Strings.)
        ? altNameFromCert.toLowerCase().startsWith(sanToVerifyPrefix.toLowerCase())
                                     ^
    (see https://errorprone.info/bugpattern/StringCaseLocaleUsage)
  Did you mean '? altNameFromCert.toLowerCase(Locale.ROOT).startsWith(sanToVerifyPrefix.toLowerCase())' or '? altNameFromCert.toLowerCase(Locale.getDefault()).startsWith(sanToVerifyPrefix.toLowerCase())' or '? Ascii.toLowerCase(altNameFromCert).startsWith(sanToVerifyPrefix.toLowerCase())'?
/Users/sergiitk/Development/grpc-java/xds/src/main/java/io/grpc/xds/internal/security/trust/XdsX509TrustManager.java:100: warning: [StringCaseLocaleUsage] Specify a `Locale` when calling `String#to{Lower,Upper}Case`. (Note: there are multiple suggested fixes; the third may be most appropriate if you're dealing with ASCII Strings.)
        ? altNameFromCert.toLowerCase().startsWith(sanToVerifyPrefix.toLowerCase())
                                                                                ^
    (see https://errorprone.info/bugpattern/StringCaseLocaleUsage)
  Did you mean '? altNameFromCert.toLowerCase().startsWith(sanToVerifyPrefix.toLowerCase(Locale.ROOT))' or '? altNameFromCert.toLowerCase().startsWith(sanToVerifyPrefix.toLowerCase(Locale.getDefault()))' or '? altNameFromCert.toLowerCase().startsWith(Ascii.toLowerCase(sanToVerifyPrefix))'?
/Users/sergiitk/Development/grpc-java/xds/src/main/java/io/grpc/xds/internal/security/trust/XdsX509TrustManager.java:110: warning: [StringCaseLocaleUsage] Specify a `Locale` when calling `String#to{Lower,Upper}Case`. (Note: there are multiple suggested fixes; the third may be most appropriate if you're dealing with ASCII Strings.)
            ? altNameFromCert.toLowerCase().endsWith(sanToVerifySuffix.toLowerCase())
                                         ^
    (see https://errorprone.info/bugpattern/StringCaseLocaleUsage)
  Did you mean '? altNameFromCert.toLowerCase(Locale.ROOT).endsWith(sanToVerifySuffix.toLowerCase())' or '? altNameFromCert.toLowerCase(Locale.getDefault()).endsWith(sanToVerifySuffix.toLowerCase())' or '? Ascii.toLowerCase(altNameFromCert).endsWith(sanToVerifySuffix.toLowerCase())'?
/Users/sergiitk/Development/grpc-java/xds/src/main/java/io/grpc/xds/internal/security/trust/XdsX509TrustManager.java:110: warning: [StringCaseLocaleUsage] Specify a `Locale` when calling `String#to{Lower,Upper}Case`. (Note: there are multiple suggested fixes; the third may be most appropriate if you're dealing with ASCII Strings.)
            ? altNameFromCert.toLowerCase().endsWith(sanToVerifySuffix.toLowerCase())
                                                                                  ^
    (see https://errorprone.info/bugpattern/StringCaseLocaleUsage)
  Did you mean '? altNameFromCert.toLowerCase().endsWith(sanToVerifySuffix.toLowerCase(Locale.ROOT))' or '? altNameFromCert.toLowerCase().endsWith(sanToVerifySuffix.toLowerCase(Locale.getDefault()))' or '? altNameFromCert.toLowerCase().endsWith(Ascii.toLowerCase(sanToVerifySuffix))'?
/Users/sergiitk/Development/grpc-java/xds/src/main/java/io/grpc/xds/internal/security/trust/XdsX509TrustManager.java:120: warning: [StringCaseLocaleUsage] Specify a `Locale` when calling `String#to{Lower,Upper}Case`. (Note: there are multiple suggested fixes; the third may be most appropriate if you're dealing with ASCII Strings.)
            ? altNameFromCert.toLowerCase().contains(sanToVerifySubstring.toLowerCase())
                                         ^
    (see https://errorprone.info/bugpattern/StringCaseLocaleUsage)
  Did you mean '? altNameFromCert.toLowerCase(Locale.ROOT).contains(sanToVerifySubstring.toLowerCase())' or '? altNameFromCert.toLowerCase(Locale.getDefault()).contains(sanToVerifySubstring.toLowerCase())' or '? Ascii.toLowerCase(altNameFromCert).contains(sanToVerifySubstring.toLowerCase())'?
/Users/sergiitk/Development/grpc-java/xds/src/main/java/io/grpc/xds/internal/security/trust/XdsX509TrustManager.java:120: warning: [StringCaseLocaleUsage] Specify a `Locale` when calling `String#to{Lower,Upper}Case`. (Note: there are multiple suggested fixes; the third may be most appropriate if you're dealing with ASCII Strings.)
            ? altNameFromCert.toLowerCase().contains(sanToVerifySubstring.toLowerCase())
                                                                                     ^
    (see https://errorprone.info/bugpattern/StringCaseLocaleUsage)
  Did you mean '? altNameFromCert.toLowerCase().contains(sanToVerifySubstring.toLowerCase(Locale.ROOT))' or '? altNameFromCert.toLowerCase().contains(sanToVerifySubstring.toLowerCase(Locale.getDefault()))' or '? altNameFromCert.toLowerCase().contains(Ascii.toLowerCase(sanToVerifySubstring))'?
/Users/sergiitk/Development/grpc-java/xds/src/main/java/io/grpc/xds/internal/Matchers.java:276: warning: [StringCaseLocaleUsage] Specify a `Locale` when calling `String#to{Lower,Upper}Case`. (Note: there are multiple suggested fixes; the third may be most appropriate if you're dealing with ASCII Strings.)
            ? args.toLowerCase().startsWith(prefix().toLowerCase())
                              ^
    (see https://errorprone.info/bugpattern/StringCaseLocaleUsage)
  Did you mean '? args.toLowerCase(Locale.ROOT).startsWith(prefix().toLowerCase())' or '? args.toLowerCase(Locale.getDefault()).startsWith(prefix().toLowerCase())' or '? Ascii.toLowerCase(args).startsWith(prefix().toLowerCase())'?
/Users/sergiitk/Development/grpc-java/xds/src/main/java/io/grpc/xds/internal/Matchers.java:276: warning: [StringCaseLocaleUsage] Specify a `Locale` when calling `String#to{Lower,Upper}Case`. (Note: there are multiple suggested fixes; the third may be most appropriate if you're dealing with ASCII Strings.)
            ? args.toLowerCase().startsWith(prefix().toLowerCase())
                                                                ^
    (see https://errorprone.info/bugpattern/StringCaseLocaleUsage)
  Did you mean '? args.toLowerCase().startsWith(prefix().toLowerCase(Locale.ROOT))' or '? args.toLowerCase().startsWith(prefix().toLowerCase(Locale.getDefault()))' or '? args.toLowerCase().startsWith(Ascii.toLowerCase(prefix()))'?
/Users/sergiitk/Development/grpc-java/xds/src/main/java/io/grpc/xds/internal/Matchers.java:280: warning: [StringCaseLocaleUsage] Specify a `Locale` when calling `String#to{Lower,Upper}Case`. (Note: there are multiple suggested fixes; the third may be most appropriate if you're dealing with ASCII Strings.)
            ? args.toLowerCase().endsWith(suffix().toLowerCase())
                              ^
    (see https://errorprone.info/bugpattern/StringCaseLocaleUsage)
  Did you mean '? args.toLowerCase(Locale.ROOT).endsWith(suffix().toLowerCase())' or '? args.toLowerCase(Locale.getDefault()).endsWith(suffix().toLowerCase())' or '? Ascii.toLowerCase(args).endsWith(suffix().toLowerCase())'?
/Users/sergiitk/Development/grpc-java/xds/src/main/java/io/grpc/xds/internal/Matchers.java:280: warning: [StringCaseLocaleUsage] Specify a `Locale` when calling `String#to{Lower,Upper}Case`. (Note: there are multiple suggested fixes; the third may be most appropriate if you're dealing with ASCII Strings.)
            ? args.toLowerCase().endsWith(suffix().toLowerCase())
                                                              ^
    (see https://errorprone.info/bugpattern/StringCaseLocaleUsage)
  Did you mean '? args.toLowerCase().endsWith(suffix().toLowerCase(Locale.ROOT))' or '? args.toLowerCase().endsWith(suffix().toLowerCase(Locale.getDefault()))' or '? args.toLowerCase().endsWith(Ascii.toLowerCase(suffix()))'?
/Users/sergiitk/Development/grpc-java/xds/src/main/java/io/grpc/xds/XdsClusterResource.java:245: warning: [StringCaseLocaleUsage] Specify a `Locale` when calling `String#to{Lower,Upper}Case`. (Note: there are multiple suggested fixes; the third may be most appropriate if you're dealing with ASCII Strings.)
      if ((edsServiceName == null) && clusterName.toLowerCase().startsWith("xdstp:")) {
                                                             ^
    (see https://errorprone.info/bugpattern/StringCaseLocaleUsage)
  Did you mean 'if ((edsServiceName == null) && clusterName.toLowerCase(Locale.ROOT).startsWith("xdstp:")) {' or 'if ((edsServiceName == null) && clusterName.toLowerCase(Locale.getDefault()).startsWith("xdstp:")) {' or 'if ((edsServiceName == null) && Ascii.toLowerCase(clusterName).startsWith("xdstp:")) {'?
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
11 warnings

> Task :grpc-authz:compileJava
/Users/sergiitk/Development/grpc-java/authz/src/main/java/io/grpc/authz/AuthorizationPolicyTranslator.java:80: warning: [StringCaseLocaleUsage] Specify a `Locale` when calling `String#to{Lower,Upper}Case`. (Note: there are multiple suggested fixes; the third may be most appropriate if you're dealing with ASCII Strings.)
        || UNSUPPORTED_HEADERS.contains(key.toLowerCase())) {
                                                       ^
    (see https://errorprone.info/bugpattern/StringCaseLocaleUsage)
  Did you mean '|| UNSUPPORTED_HEADERS.contains(key.toLowerCase(Locale.ROOT))) {' or '|| UNSUPPORTED_HEADERS.contains(key.toLowerCase(Locale.getDefault()))) {' or '|| UNSUPPORTED_HEADERS.contains(Ascii.toLowerCase(key))) {'?
1 warning

> Task :grpc-benchmarks:compileJava
/Users/sergiitk/Development/grpc-java/benchmarks/src/main/java/io/grpc/benchmarks/qps/ServerConfiguration.java:72: warning: [StringCaseLocaleUsage] Specify a `Locale` when calling `String#to{Lower,Upper}Case`. (Note: there are multiple suggested fixes; the third may be most appropriate if you're dealing with ASCII Strings.)
            "TLS unsupported with the " + config.transport.name().toLowerCase() + " transport");
                                                                             ^
    (see https://errorprone.info/bugpattern/StringCaseLocaleUsage)
  Did you mean '"TLS unsupported with the " + config.transport.name().toLowerCase(Locale.ROOT) + " transport");' or '"TLS unsupported with the " + config.transport.name().toLowerCase(Locale.getDefault()) + " transport");' or '"TLS unsupported with the " + Ascii.toLowerCase(config.transport.name()) + " transport");'?
/Users/sergiitk/Development/grpc-java/benchmarks/src/main/java/io/grpc/benchmarks/qps/ServerConfiguration.java:131: warning: [StringCaseLocaleUsage] Specify a `Locale` when calling `String#to{Lower,Upper}Case`. (Note: there are multiple suggested fixes; the third may be most appropriate if you're dealing with ASCII Strings.)
        builder.append(transport.name().toLowerCase());
                                                   ^
    (see https://errorprone.info/bugpattern/StringCaseLocaleUsage)
  Did you mean 'builder.append(transport.name().toLowerCase(Locale.ROOT));' or 'builder.append(transport.name().toLowerCase(Locale.getDefault()));' or 'builder.append(Ascii.toLowerCase(transport.name()));'?
/Users/sergiitk/Development/grpc-java/benchmarks/src/main/java/io/grpc/benchmarks/qps/ServerConfiguration.java:161: warning: [StringCaseLocaleUsage] Specify a `Locale` when calling `String#to{Lower,Upper}Case`. (Note: there are multiple suggested fixes; the third may be most appropriate if you're dealing with ASCII Strings.)
    TRANSPORT("STR", Transport.getDescriptionString(), DEFAULT.transport.name().toLowerCase()) {
                                                                                           ^
    (see https://errorprone.info/bugpattern/StringCaseLocaleUsage)
  Did you mean 'TRANSPORT("STR", Transport.getDescriptionString(), DEFAULT.transport.name().toLowerCase(Locale.ROOT)) {' or 'TRANSPORT("STR", Transport.getDescriptionString(), DEFAULT.transport.name().toLowerCase(Locale.getDefault())) {' or 'TRANSPORT("STR", Transport.getDescriptionString(), Ascii.toLowerCase(DEFAULT.transport.name())) {'?
/Users/sergiitk/Development/grpc-java/benchmarks/src/main/java/io/grpc/benchmarks/qps/ServerConfiguration.java:164: warning: [StringCaseLocaleUsage] Specify a `Locale` when calling `String#to{Lower,Upper}Case`. (Note: there are multiple suggested fixes; the third may be most appropriate if you're dealing with ASCII Strings.)
        config.transport = Transport.valueOf(value.toUpperCase());
                                                              ^
    (see https://errorprone.info/bugpattern/StringCaseLocaleUsage)
  Did you mean 'config.transport = Transport.valueOf(value.toUpperCase(Locale.ROOT));' or 'config.transport = Transport.valueOf(value.toUpperCase(Locale.getDefault()));' or 'config.transport = Transport.valueOf(Ascii.toUpperCase(value));'?
/Users/sergiitk/Development/grpc-java/benchmarks/src/main/java/io/grpc/benchmarks/qps/ServerConfiguration.java:200: warning: [StringCaseLocaleUsage] Specify a `Locale` when calling `String#to{Lower,Upper}Case`. (Note: there are multiple suggested fixes; the third may be most appropriate if you're dealing with ASCII Strings.)
      return name().toLowerCase();
                               ^
    (see https://errorprone.info/bugpattern/StringCaseLocaleUsage)
  Did you mean 'return name().toLowerCase(Locale.ROOT);' or 'return name().toLowerCase(Locale.getDefault());' or 'return Ascii.toLowerCase(name());'?
/Users/sergiitk/Development/grpc-java/benchmarks/src/main/java/io/grpc/benchmarks/Transport.java:67: warning: [StringCaseLocaleUsage] Specify a `Locale` when calling `String#to{Lower,Upper}Case`. (Note: there are multiple suggested fixes; the third may be most appropriate if you're dealing with ASCII Strings.)
      builder.append(transport.name().toLowerCase());
                                                 ^
    (see https://errorprone.info/bugpattern/StringCaseLocaleUsage)
  Did you mean 'builder.append(transport.name().toLowerCase(Locale.ROOT));' or 'builder.append(transport.name().toLowerCase(Locale.getDefault()));' or 'builder.append(Ascii.toLowerCase(transport.name()));'?
/Users/sergiitk/Development/grpc-java/benchmarks/src/main/java/io/grpc/benchmarks/qps/ClientConfiguration.java:105: warning: [StringCaseLocaleUsage] Specify a `Locale` when calling `String#to{Lower,Upper}Case`. (Note: there are multiple suggested fixes; the third may be most appropriate if you're dealing with ASCII Strings.)
              "Transport " + config.transport.name().toLowerCase() + " does not support TLS.");
                                                                ^
    (see https://errorprone.info/bugpattern/StringCaseLocaleUsage)
  Did you mean '"Transport " + config.transport.name().toLowerCase(Locale.ROOT) + " does not support TLS.");' or '"Transport " + config.transport.name().toLowerCase(Locale.getDefault()) + " does not support TLS.");' or '"Transport " + Ascii.toLowerCase(config.transport.name()) + " does not support TLS.");'?
/Users/sergiitk/Development/grpc-java/benchmarks/src/main/java/io/grpc/benchmarks/qps/ClientConfiguration.java:169: warning: [StringCaseLocaleUsage] Specify a `Locale` when calling `String#to{Lower,Upper}Case`. (Note: there are multiple suggested fixes; the third may be most appropriate if you're dealing with ASCII Strings.)
    TRANSPORT("STR", Transport.getDescriptionString(), DEFAULT.transport.name().toLowerCase()) {
                                                                                           ^
    (see https://errorprone.info/bugpattern/StringCaseLocaleUsage)
  Did you mean 'TRANSPORT("STR", Transport.getDescriptionString(), DEFAULT.transport.name().toLowerCase(Locale.ROOT)) {' or 'TRANSPORT("STR", Transport.getDescriptionString(), DEFAULT.transport.name().toLowerCase(Locale.getDefault())) {' or 'TRANSPORT("STR", Transport.getDescriptionString(), Ascii.toLowerCase(DEFAULT.transport.name())) {'?
/Users/sergiitk/Development/grpc-java/benchmarks/src/main/java/io/grpc/benchmarks/qps/ClientConfiguration.java:172: warning: [StringCaseLocaleUsage] Specify a `Locale` when calling `String#to{Lower,Upper}Case`. (Note: there are multiple suggested fixes; the third may be most appropriate if you're dealing with ASCII Strings.)
        config.transport = Transport.valueOf(value.toUpperCase());
                                                              ^
    (see https://errorprone.info/bugpattern/StringCaseLocaleUsage)
  Did you mean 'config.transport = Transport.valueOf(value.toUpperCase(Locale.ROOT));' or 'config.transport = Transport.valueOf(value.toUpperCase(Locale.getDefault()));' or 'config.transport = Transport.valueOf(Ascii.toUpperCase(value));'?
/Users/sergiitk/Development/grpc-java/benchmarks/src/main/java/io/grpc/benchmarks/qps/ClientConfiguration.java:239: warning: [StringCaseLocaleUsage] Specify a `Locale` when calling `String#to{Lower,Upper}Case`. (Note: there are multiple suggested fixes; the third may be most appropriate if you're dealing with ASCII Strings.)
      return name().toLowerCase();
                               ^
    (see https://errorprone.info/bugpattern/StringCaseLocaleUsage)
  Did you mean 'return name().toLowerCase(Locale.ROOT);' or 'return name().toLowerCase(Locale.getDefault());' or 'return Ascii.toLowerCase(name());'?
10 warnings

> Task :grpc-interop-testing:compileJava
/Users/sergiitk/Development/grpc-java/interop-testing/src/main/java/io/grpc/testing/integration/TestCases.java:82: warning: [StringCaseLocaleUsage] Specify a `Locale` when calling `String#to{Lower,Upper}Case`. (Note: there are multiple suggested fixes; the third may be most appropriate if you're dealing with ASCII Strings.)
    return TestCases.valueOf(s.toUpperCase());
                                          ^
    (see https://errorprone.info/bugpattern/StringCaseLocaleUsage)
  Did you mean 'return TestCases.valueOf(s.toUpperCase(Locale.ROOT));' or 'return TestCases.valueOf(s.toUpperCase(Locale.getDefault()));' or 'return TestCases.valueOf(Ascii.toUpperCase(s));'?
/Users/sergiitk/Development/grpc-java/interop-testing/src/main/java/io/grpc/testing/integration/StressTestClient.java:376: warning: [StringCaseLocaleUsage] Specify a `Locale` when calling `String#to{Lower,Upper}Case`. (Note: there are multiple suggested fixes; the third may be most appropriate if you're dealing with ASCII Strings.)
      String strTestcase = testCase.name().toLowerCase();
                                                      ^
    (see https://errorprone.info/bugpattern/StringCaseLocaleUsage)
  Did you mean 'String strTestcase = testCase.name().toLowerCase(Locale.ROOT);' or 'String strTestcase = testCase.name().toLowerCase(Locale.getDefault());' or 'String strTestcase = Ascii.toLowerCase(testCase.name());'?
/Users/sergiitk/Development/grpc-java/interop-testing/src/main/java/io/grpc/testing/integration/TestServiceClient.java:695: warning: [StringCaseLocaleUsage] Specify a `Locale` when calling `String#to{Lower,Upper}Case`. (Note: there are multiple suggested fixes; the third may be most appropriate if you're dealing with ASCII Strings.)
      String strTestcase = testCase.name().toLowerCase();
                                                      ^
    (see https://errorprone.info/bugpattern/StringCaseLocaleUsage)
  Did you mean 'String strTestcase = testCase.name().toLowerCase(Locale.ROOT);' or 'String strTestcase = testCase.name().toLowerCase(Locale.getDefault());' or 'String strTestcase = Ascii.toLowerCase(testCase.name());'?
/Users/sergiitk/Development/grpc-java/interop-testing/src/main/java/io/grpc/testing/integration/Http2TestCases.java:52: warning: [StringCaseLocaleUsage] Specify a `Locale` when calling `String#to{Lower,Upper}Case`. (Note: there are multiple suggested fixes; the third may be most appropriate if you're dealing with ASCII Strings.)
      return Http2TestCases.valueOf(s.toUpperCase());
                                                 ^
    (see https://errorprone.info/bugpattern/StringCaseLocaleUsage)
  Did you mean 'return Http2TestCases.valueOf(s.toUpperCase(Locale.ROOT));' or 'return Http2TestCases.valueOf(s.toUpperCase(Locale.getDefault()));' or 'return Http2TestCases.valueOf(Ascii.toUpperCase(s));'?
4 warnings
@ejona86 ejona86 added this to the Next milestone Jul 18, 2023
@ejona86 ejona86 self-assigned this Mar 27, 2024
ejona86 added a commit to ejona86/grpc-java that referenced this issue Mar 27, 2024
None of these conversions should use the arbitrary system locale. Error
Prone will help prevent these getting introduced in the future.

Fixes grpc#10372
@ejona86 ejona86 modified the milestones: Next, 1.64 Mar 27, 2024
ejona86 added a commit to ejona86/grpc-java that referenced this issue Mar 27, 2024
None of these conversions should use the arbitrary system locale. Error
Prone will help prevent these getting introduced in the future.

Fixes grpc#10372
sergiitk pushed a commit that referenced this issue Mar 28, 2024
None of these conversions should use the arbitrary system locale. Error
Prone will help prevent these getting introduced in the future.

Fixes #10372
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 26, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants