-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Checkstyle fails with "Path contains invalid character" if path to config file contains non-ascii characters #13012
Comments
I can confirm that changing from |
Like I told you :-D ALL occurences of |
Yes, please search and replace all Abandoned PR - #13016 that is almost done. |
… Linux and macOS The overarching goal here is to shake out more encoding problems throughout Gradle by running all our integration tests in a way that the tested code has to deal with non-ASCII characters in file paths. This PR takes a step towards that goal by forcing all our non-Windows integration tests to use such a path. To keep the scope manageable, this PR does not force non-ASCII paths for Windows. That needs to be enabled in a followup PR where we can deal with Windows-specific encoding problems. The idea is similar to how we add a space to the `build/tmp/test files` directory's name where all the test output is typically located; this time we replace the `s` in `test files` with an `ŝ` (see [U+015D](https://www.compart.com/en/unicode/U+015D)). Importantly this character is not part of ASCII nor any ISO-8859-X codepage, and cannot be represented by a single byte. (See [Wikipedia](https://en.wikipedia.org/wiki/ŝ)). There is also an escape hatch for tests that for some reason can't support Unicode paths; these need to be tagged with `@DoesNotSupportNonAsciiPaths`. We have such offenders today: - Checkstyle fails because of this bug: checkstyle/checkstyle#13012 - Java 6 wrapper tests fail because Java 6 barfs on non-ASCII characters in the path Most of the problems that had to be fixed for Unixes come from the fact that `URI.toString()` does not encode non-ASCII characters, and some tools can't parse string representations of URIs with non-ASCII characters in them. So some of the `URI`s are now converted to strings using `toASCIIString()` instead. This is the canonical form of a URI, and is the intended way to go when the string form is passed to places where we can't ensure that it will be read with the right encoding (see https://www.w3.org/Addressing/URL/3_URI_Choices.html) There are followups: - #25316 - #25322 This PR is a followup to the daemon encoding fix in: - #25319 Co-authored-by: Lóránt Pintér <lorant@gradle.com>
I am on it |
Closed via #14883 |
If the config file is in a location that contains non-ascii characters, then checkstyle fails:
I would have expected checkstyle to work the same, regardless of what characters were used in the path.
See also https://issues.apache.org/jira/browse/MCHECKSTYLE-425 , where Michael Osipov suggests it´s due to use of URI#toString where URI#toASCIIString should have been used.
From plugin issue:
While I can reproduce it, it is not a bug in maven plugin. The issue is with Checkstyle itself. Unfortunately, Sun – back then – decided to print gargabe output with URI#toString() instead of doing the right thing. #toString() produces invalid URIs. One must ALWAYS use #toASCIIString(). Never rely on #toString(). I checked the code of Checkstyle and it unfortunately does on many occasions. File an issue there and have it fixed.
Affected files:
Name Line Text Path
AbstractAutomaticBean.java 24 import java.net.URI; D:\Entwicklung\Projekte\checkstyle\src\main\java\com\puppycrawl\tools\checkstyle
AbstractHeaderCheck.java 28 import java.net.URI; D:\Entwicklung\Projekte\checkstyle\src\main\java\com\puppycrawl\tools\checkstyle\checks\header
ImportControlCheck.java 22 import java.net.URI; D:\Entwicklung\Projekte\checkstyle\src\main\java\com\puppycrawl\tools\checkstyle\checks\imports
ImportControlLoader.java 25 import java.net.URI; D:\Entwicklung\Projekte\checkstyle\src\main\java\com\puppycrawl\tools\checkstyle\checks\imports
ConfigurationLoader.java 23 import java.net.URI; D:\Entwicklung\Projekte\checkstyle\src\main\java\com\puppycrawl\tools\checkstyle
SuppressionsLoader.java 24 import java.net.URI; D:\Entwicklung\Projekte\checkstyle\src\main\java\com\puppycrawl\tools\checkstyle\filters
PropertyCacheFile.java 29 import java.net.URI; D:\Entwicklung\Projekte\checkstyle\src\main\java\com\puppycrawl\tools\checkstyle
CommonUtil.java 28 import java.net.URI; D:\Entwicklung\Projekte\checkstyle\src\main\java\com\puppycrawl\tools\checkstyle\utils
See: apache/maven@8e0efaa
The text was updated successfully, but these errors were encountered: