pitest
pitest copied to clipboard
CLI fails when passed a non-zip file in --classPath parameter
Not sure whom to blame, the IntelliJ plugin, or the core project.
I tried to use the IntelliJ plugin.
The project has a JQuery dependency defined.
Due to this, D:\Dateien\.IntelliJIdea2018.3\config\javascript\extLibs\http_ajax.googleapis.com_ajax_libs_jquery_2.1.3_jquery.js
ends up in the value of the --classPath
parameter.
Java usually has no problem with non-JAR files in the classpath (unlike the new module path).
But PIT complains that it cannot open it as ZIP.
17:18:30 PIT >> INFO : Verbose logging is disabled. If you encounter an problem please enable it before reporting an issue.
Exception in thread "main" java.lang.reflect.InvocationTargetException
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 com.intellij.rt.execution.CommandLineWrapper.main(CommandLineWrapper.java:67)
Caused by: org.pitest.util.PitError: error in opening zip file (D:\Dateien\.IntelliJIdea2018.3\config\javascript\extLibs\http_ajax.googleapis.com_ajax_libs_jquery_2.1.3_jquery.js)
Please copy and paste the information and the complete stacktrace below when reporting an issue
VM : Java HotSpot(TM) 64-Bit Server VM
Vendor : Oracle Corporation
Version : 25.131-b11
Uptime : 1229
Input ->
1 : -javaagent:C:\Program Files\JetBrains\IntelliJ IDEA 2018.3\lib\idea_rt.jar=55063:C:\Program Files\JetBrains\IntelliJ IDEA 2018.3\bin
2 : -Dfile.encoding=UTF-8
BootClassPathSupported : true
at org.pitest.util.Unchecked.translateCheckedException(Unchecked.java:25)
at org.pitest.classpath.ArchiveClassPathRoot.getRoot(ArchiveClassPathRoot.java:117)
at org.pitest.classpath.ArchiveClassPathRoot.classNames(ArchiveClassPathRoot.java:87)
at org.pitest.classpath.NameCachingRoot.classNames(NameCachingRoot.java:51)
at org.pitest.classpath.CompoundClassPathRoot.classNames(CompoundClassPathRoot.java:40)
at org.pitest.classpath.ClassPath.classNames(ClassPath.java:63)
at org.pitest.classpath.ClassPath.findClasses(ClassPath.java:147)
at org.pitest.classpath.ProjectClassPaths.code(ProjectClassPaths.java:39)
at org.pitest.classpath.CodeSource.getCode(CodeSource.java:41)
at org.pitest.mutationtest.verify.DefaultBuildVerifier.verify(DefaultBuildVerifier.java:32)
at org.pitest.mutationtest.tooling.MutationCoverage.verifyBuildSuitableForMutationTesting(MutationCoverage.java:223)
at org.pitest.mutationtest.tooling.MutationCoverage.runReport(MutationCoverage.java:111)
at org.pitest.mutationtest.tooling.EntryPoint.execute(EntryPoint.java:120)
at org.pitest.mutationtest.tooling.EntryPoint.execute(EntryPoint.java:50)
at org.pitest.mutationtest.commandline.MutationCoverageReport.runReport(MutationCoverageReport.java:87)
at org.pitest.mutationtest.commandline.MutationCoverageReport.main(MutationCoverageReport.java:45)
... 5 more
Caused by: java.util.zip.ZipException: error in opening zip file
at java.util.zip.ZipFile.open(Native Method)
at java.util.zip.ZipFile.<init>(ZipFile.java:219)
at java.util.zip.ZipFile.<init>(ZipFile.java:149)
at java.util.zip.ZipFile.<init>(ZipFile.java:163)
at org.pitest.classpath.ArchiveClassPathRoot.getRoot(ArchiveClassPathRoot.java:115)
... 19 more
Process finished with exit code 1
Thanks for reporting this problem. Could you try to provide a minimalist project that would reproduce the issue ?
I'm not sure what you mean.
Call pitest with any non-ZIP file as part of the --classPath
option and it should reproduce.
I mean something more or less like this branch. With the code on this branch, I'm able to generate a report while having a zip in the classpath argument.
Does this sample works for you ?
while having a zip in the classpath argument.
I said non-zip.
:o right! This is quite easy to reproduce indeed (like here).
I agree that we should simply ignore non-zip files provided in the --classpath
parameter.
PIT IntelliJ Plugin fails when used in Android Studio. Android Studio is based on IntelliJ IDEA and is the official IDEA of the Android platform.
"C:\Program Files\Android\Android Studio\jre\bin\java.exe" "-javaagent:C:\Program Files\Android\Android Studio\lib\idea_rt.jar=6169:C:\Program Files\Android\Android Studio\bin" -Dfile.encoding=UTF-8 -classpath C:\Users\Max.Muster\AppData\Local\Temp\classpath346574974.jar org.pitest.mutationtest.commandline.MutationCoverageReport --reportDir C:/Users/Max.Muster/Documents/java-projects/app/build/reports/pit --verbose --sourceDirs C:/Users/Max.Muster/Documents/java-projects/app/app/src/main/java --targetClasses de.* --targetTests de.example.app.util.MyUtilTest --outputFormats XML,HTML
Exception in thread "main" org.pitest.util.PitError: error in opening zip file (C:\Users\Max.Muster\.gradle\caches\transforms-2\files-2.1\23d8655145ac7e4c056e8d7126359310\databinding-adapters-4.1.0\AndroidManifest.xml)
Please copy and paste the information and the complete stacktrace below when reporting an issue
VM : OpenJDK 64-Bit Server VM
Vendor : JetBrains s.r.o
Version : 25.242-b01
Uptime : 2033
Input ->
1 : -javaagent:C:\Program Files\Android\Android Studio\lib\idea_rt.jar=6169:C:\Program Files\Android\Android Studio\bin
2 : -Dfile.encoding=UTF-8
BootClassPathSupported : true
at org.pitest.util.Unchecked.translateCheckedException(Unchecked.java:25)
at org.pitest.classpath.ArchiveClassPathRoot.getRoot(ArchiveClassPathRoot.java:117)
at org.pitest.classpath.ArchiveClassPathRoot.classNames(ArchiveClassPathRoot.java:87)
at org.pitest.classpath.NameCachingRoot.classNames(NameCachingRoot.java:51)
at org.pitest.classpath.CompoundClassPathRoot.classNames(CompoundClassPathRoot.java:40)
at org.pitest.classpath.ClassPath.classNames(ClassPath.java:63)
at org.pitest.classpath.ClassPath.findClasses(ClassPath.java:147)
at org.pitest.classpath.ProjectClassPaths.code(ProjectClassPaths.java:39)
at org.pitest.classpath.CodeSource.getCode(CodeSource.java:41)
at org.pitest.mutationtest.verify.DefaultBuildVerifier.verify(DefaultBuildVerifier.java:32)
at org.pitest.mutationtest.tooling.MutationCoverage.verifyBuildSuitableForMutationTesting(MutationCoverage.java:223)
at org.pitest.mutationtest.tooling.MutationCoverage.runReport(MutationCoverage.java:111)
at org.pitest.mutationtest.tooling.EntryPoint.execute(EntryPoint.java:121)
at org.pitest.mutationtest.tooling.EntryPoint.execute(EntryPoint.java:51)
at org.pitest.mutationtest.commandline.MutationCoverageReport.runReport(MutationCoverageReport.java:87)
at org.pitest.mutationtest.commandline.MutationCoverageReport.main(MutationCoverageReport.java:45)
Caused by: java.util.zip.ZipException: error in opening zip file
at java.util.zip.ZipFile.open(Native Method)
at java.util.zip.ZipFile.<init>(ZipFile.java:225)
at java.util.zip.ZipFile.<init>(ZipFile.java:155)
at java.util.zip.ZipFile.<init>(ZipFile.java:169)
at org.pitest.classpath.ArchiveClassPathRoot.getRoot(ArchiveClassPathRoot.java:115)
... 14 more