InvalidPathException on Windows
See original GitHub issueI get an exception when compiling my project with error prone 2.0.10. I do not get this exception with 2.0.9.
I’m guessing this issue is Windows-specific. It looks like it’s trying to make a java.nio.file.Path
starting with /C:/
and blowing up because of the :
character.
Here’s the error and stack trace I see when running mvn clean package
(which fails because of this error):
C:\Development\projectname\projectname-util\src\main\java\com\companyname\projectname\util\math\package-info.java:8: error: An unhandled exception was thrown by the Error Prone static analysis plugin.
@CheckReturnValue
^
Please report this at https://github.com/google/error-prone/issues/new and include the following:
error-prone version: 2.0.10
Stack Trace:
java.nio.file.InvalidPathException: Illegal char <:> at index 2: /C:/Development/projectname/projectname-util/src/main/java/com/companyname/projectname/util/math/package-info.java
at sun.nio.fs.WindowsPathParser.normalize(WindowsPathParser.java:182)
at sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:153)
at sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:77)
at sun.nio.fs.WindowsPath.parse(WindowsPath.java:94)
at sun.nio.fs.WindowsFileSystem.getPath(WindowsFileSystem.java:255)
at java.nio.file.Paths.get(Paths.java:84)
at com.google.errorprone.bugpatterns.PackageLocation.getFilePath(PackageLocation.java:88)
at com.google.errorprone.bugpatterns.PackageLocation.matchCompilationUnit(PackageLocation.java:69)
at com.google.errorprone.scanner.ErrorProneScanner.visitCompilationUnit(ErrorProneScanner.java:646)
at com.google.errorprone.scanner.ErrorProneScanner.visitCompilationUnit(ErrorProneScanner.java:146)
at com.sun.tools.javac.tree.JCTree$JCCompilationUnit.accept(JCTree.java:561)
at com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:53)
at com.google.errorprone.scanner.Scanner.scan(Scanner.java:70)
at com.google.errorprone.scanner.ErrorProneScannerTransformer.apply(ErrorProneScannerTransformer.java:45)
at com.google.errorprone.ErrorProneAnalyzer.finished(ErrorProneAnalyzer.java:121)
at com.sun.tools.javac.api.MultiTaskListener.finished(MultiTaskListener.java:113)
at com.sun.tools.javac.main.JavaCompiler.flow(JavaCompiler.java:1303)
at com.sun.tools.javac.main.JavaCompiler.flow(JavaCompiler.java:1247)
at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:858)
at com.sun.tools.javac.main.Main.compile(Main.java:253)
at com.google.errorprone.BaseErrorProneCompiler.run(BaseErrorProneCompiler.java:190)
at com.google.errorprone.BaseErrorProneCompiler.run(BaseErrorProneCompiler.java:101)
at com.google.errorprone.ErrorProneCompiler.run(ErrorProneCompiler.java:131)
at com.google.errorprone.ErrorProneCompiler.compile(ErrorProneCompiler.java:73)
at org.codehaus.plexus.compiler.javac.errorprone.JavacCompilerWithErrorProne$CompilerInvoker.compile(JavacCompilerWithErrorProne.java:219)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.codehaus.plexus.compiler.javac.errorprone.JavacCompilerWithErrorProne.performCompile(JavacCompilerWithErrorProne.java:91)
at org.apache.maven.plugin.compiler.AbstractCompilerMojo.execute(AbstractCompilerMojo.java:825)
at org.apache.maven.plugin.compiler.CompilerMojo.execute(CompilerMojo.java:129)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:199)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Issue Analytics
- State:
- Created 7 years ago
- Comments:6 (5 by maintainers)
Top Results From Across the Web
InvalidPathException Class (Java.Nio.FileNio) | Microsoft Learn
Unchecked exception thrown when path string cannot be converted into a Path because the path string contains invalid characters, or the path string...
Read more >Why am I getting this InvalidPathException - Stack Overflow
It appears that you're passing the string "[E:...]", including the surrounding square brackets added by Arrays.toString, to Paths.get.
Read more >[1.3.0-RC1] java.nio.file.InvalidPathException on ... - GitHub
I've read the CONTRIBUTING guidelines steps environment: windows 10, any shell (tested CMD.EXE/sbt.bat, and cygwin/bash/sbt). edit ...
Read more >InvalidPathException: Illegal char <:> at index 2: /C
I checked all .json files generated by bloop and didn't find this path /C:/Users/mucmaucm/Workspaces/WN/api-gateway.scala/ , instead only correct Windows paths ...
Read more >Failing test case DataSourceTest#testFileName (Windows OS)
Test DataSourceTest#testFileName fails on a Windows OS with following error: java.nio.file.InvalidPathException: Illegal char <:> at index 2: /C ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I just pushed Error Prone 2.0.11 to Maven. It includes the fix for this bug.
It would be good to have a release with the bugfix for this issue soon. It makes error prone on windows unusable.