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

Don't assume file is 50 characters long #699

Merged
merged 5 commits into from
Sep 18, 2020
Merged

Conversation

skevy
Copy link
Contributor

@skevy skevy commented Sep 18, 2020

When upgrading to Spotless 5.5.1, I was receiving this error when trying to format a small GraphQL file in my codebase:

String index out of range: 50
java.lang.StringIndexOutOfBoundsException: String index out of range: 50
        at java.lang.String.substring(String.java:1963)
        at com.diffplug.spotless.npm.PrettierFormatterStep$PrettierFilePathPassingFormatterFunc.applyWithFile(PrettierFormatterStep.java:116)String index out of range: 50
java.lang.StringIndexOutOfBoundsException: String index out of range: 50

It seems to be due to this log line that assumes that any content being passed to Prettier is at least 50 characters long.

I changed this logic to instead print up to 50 characters of the string.

@nedtwigg
Copy link
Member

Good call, thanks very much.

@nedtwigg nedtwigg merged commit 52c79e7 into diffplug:main Sep 18, 2020
@nedtwigg
Copy link
Member

Published in plugin-gradle 5.5.2 and plugin-maven 2.4.1.

@skevy skevy deleted the patch-1 branch September 19, 2020 02:16
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.

2 participants