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

Avoid a possible IndexOutOfBoundsException in MemberName. #4592

Merged
merged 1 commit into from
Sep 26, 2024

Conversation

copybara-service[bot]
Copy link
Contributor

Avoid a possible IndexOutOfBoundsException in MemberName.

Ordinarily we shouldn't see an empty class name but it appears that sometimes we do: []

Sep 26, 2024 10:29:02 AM com.google.devtools.staticanalysis.pipeline.java.errorprone.ErrorProneFindingsJavacAnalyzer$1 handleError
WARNING: crash in Error Prone analyzer MemberName [CONTEXT ratelimit_period="5 SECONDS" analyzer="JavaStyle" ]
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
	at java.base/jdk.internal.util.Preconditions$1.apply(Preconditions.java:55)
	at java.base/jdk.internal.util.Preconditions$1.apply(Preconditions.java:52)
	at java.base/jdk.internal.util.Preconditions$4.apply(Preconditions.java:213)
	at java.base/jdk.internal.util.Preconditions$4.apply(Preconditions.java:210)
	at java.base/jdk.internal.util.Preconditions.outOfBounds(Preconditions.java:98)
	at java.base/jdk.internal.util.Preconditions.outOfBoundsCheckIndex(Preconditions.java:106)
	at java.base/jdk.internal.util.Preconditions.checkIndex(Preconditions.java:302)
	at java.base/java.lang.String.checkIndex(String.java:4881)
	at java.base/java.lang.StringLatin1.charAt(StringLatin1.java:46)
	at java.base/java.lang.String.charAt(String.java:1582)
	at com.google.errorprone.bugpatterns.MemberName.isConformantUpperCamelName(MemberName.java:290)
	at com.google.errorprone.bugpatterns.MemberName.matchClass(MemberName.java:111)
	at com.google.errorprone.scanner.ErrorProneScanner.processMatchers(ErrorProneScanner.java:460)
	at com.google.errorprone.scanner.ErrorProneScanner.visitClass(ErrorProneScanner.java:558)
	at com.google.errorprone.scanner.ErrorProneScanner.visitClass(ErrorProneScanner.java:157)

Ordinarily we shouldn't see an empty class name but it appears that sometimes we do: []

```
Sep 26, 2024 10:29:02 AM com.google.devtools.staticanalysis.pipeline.java.errorprone.ErrorProneFindingsJavacAnalyzer$1 handleError
WARNING: crash in Error Prone analyzer MemberName [CONTEXT ratelimit_period="5 SECONDS" analyzer="JavaStyle" ]
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
	at java.base/jdk.internal.util.Preconditions$1.apply(Preconditions.java:55)
	at java.base/jdk.internal.util.Preconditions$1.apply(Preconditions.java:52)
	at java.base/jdk.internal.util.Preconditions$4.apply(Preconditions.java:213)
	at java.base/jdk.internal.util.Preconditions$4.apply(Preconditions.java:210)
	at java.base/jdk.internal.util.Preconditions.outOfBounds(Preconditions.java:98)
	at java.base/jdk.internal.util.Preconditions.outOfBoundsCheckIndex(Preconditions.java:106)
	at java.base/jdk.internal.util.Preconditions.checkIndex(Preconditions.java:302)
	at java.base/java.lang.String.checkIndex(String.java:4881)
	at java.base/java.lang.StringLatin1.charAt(StringLatin1.java:46)
	at java.base/java.lang.String.charAt(String.java:1582)
	at com.google.errorprone.bugpatterns.MemberName.isConformantUpperCamelName(MemberName.java:290)
	at com.google.errorprone.bugpatterns.MemberName.matchClass(MemberName.java:111)
	at com.google.errorprone.scanner.ErrorProneScanner.processMatchers(ErrorProneScanner.java:460)
	at com.google.errorprone.scanner.ErrorProneScanner.visitClass(ErrorProneScanner.java:558)
	at com.google.errorprone.scanner.ErrorProneScanner.visitClass(ErrorProneScanner.java:157)
```
PiperOrigin-RevId: 679249176
@copybara-service copybara-service bot merged commit 2b78c1f into master Sep 26, 2024
@copybara-service copybara-service bot deleted the test_679219372 branch September 26, 2024 19:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant