Export to GitHub

testability-explorer - issue #4

AntTask tries to use ZIP loader for classes from build directory


Posted on Jan 18, 2009 by Massive Lion

What steps will reproduce the problem? 1. create a build.xml with the testability-explorer ant task def 2. add your build directory with the proper class files to it's classpath 3. invoke the testability target you just created

What is the expected output? What do you see instead? Expected: Proper testability report generated. Actual: ZipException: java.lang.RuntimeException: java.util.zip.ZipException: error in opening zip file at com.google.classpath.ClassPathFactory.createFromPaths (ClassPathFactory.java:50) at com.google.classpath.ClassPathFactory.createFromPath (ClassPathFactory.java:39) at com.google.test.metric.Testability.getClassPath (Testability.java:248)
at com.google.test.metric.Testability.postParse (Testability.java:190)

What version of the product are you using? On what operating system? Testability v1.3.0 r275, same for the ant taskdef, operating system Linux 2.6.28, java version 1.6.0_11

Please provide any additional information below. Full stacktrace as shown on my screen: java.lang.RuntimeException: java.util.zip.ZipException: error in opening zip file at com.google.classpath.ClassPathFactory.createFromPaths (ClassPathFactory.java:50) at com.google.classpath.ClassPathFactory.createFromPath (ClassPathFactory.java:39) at com.google.test.metric.Testability.getClassPath (Testability.java:248)
at com.google.test.metric.Testability.postParse (Testability.java:190)
at com.google.test.metric.Testability.execute (Testability.java:252)
at com.google.test.metric.Testability.main (Testability.java:142)
at com.google.ant.TestabilityTask.runTestabilityExplorer (TestabilityTask.java:113) at com.google.ant.TestabilityTask.execute (TestabilityTask.java:100)
at org.apache.tools.ant.UnknownElement.execute (UnknownElement.java:288)
at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke (Method.java:597)
at org.apache.tools.ant.dispatch.DispatchUtils.execute (DispatchUtils.java:106) at org.apache.tools.ant.Task.perform(Task.java:348) at org.apache.tools.ant.Target.execute(Target.java:357) at org.apache.tools.ant.Target.performTasks(Target.java:385) at org.apache.tools.ant.Project.executeSortedTargets (Project.java:1337) at org.apache.tools.ant.Project.executeTarget(Project.java:1306) at org.apache.tools.ant.helper.DefaultExecutor.executeTargets (DefaultExecutor.java:41) at org.apache.tools.ant.Project.executeTargets(Project.java:1189) at org.apache.tools.ant.Main.runBuild(Main.java:758) at org.apache.tools.ant.Main.startAnt(Main.java:217) at org.apache.tools.ant.launch.Launcher.run(Launcher.java:257) at org.apache.tools.ant.launch.Launcher.main(Launcher.java:104) 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:114) at java.util.jar.JarFile.<init>(JarFile.java:133) at java.util.jar.JarFile.<init>(JarFile.java:97) at com.google.classpath.JARClassPath.loadEntries (JARClassPath.java:47) at com.google.classpath.ClassPathFactory.createFromPaths (ClassPathFactory.java:48) ... 23 more

Comment #1

Posted on Jan 20, 2009 by Swift Rhino

I am also getting this problem. I am running it on Ant 1.7 with JDK 1.6.0_10-b33.

Comment #2

Posted on Jan 27, 2009 by Quick Kangaroo

I am too! Any help will be appreciated.

Comment #3

Posted on Jan 30, 2009 by Massive Bird

I could work around this by including the packaged jar to be checked rather than .class files in the classpath. It seems to expect jars only. This wasn't the best solution for me as I had to place the execution of the check in an unexpected phase of the build.

Comment #4

Posted on Feb 27, 2009 by Happy Giraffe

Also having this same issue. I think that expecting the classes that are going to be analyzed to be in a JAR package is unnecessary.

Comment #5

Posted on Mar 2, 2009 by Happy Bear

IMHO the example http://code.google.com/p/testability-explorer/wiki/AntTask is misleading:

<classpath>
  <fileset dir="lib">
     <include name="*.jar"/>
  </fileset>
  <fileset dir="build/classes">
     <include name="com/ownstuff/**"/>
  </fileset>
</classpath>

It should be:

<classpath>
  <fileset dir="lib">
     <include name="*.jar"/>
  </fileset>
  <pathelement location="build/classes"/>
</classpath>

Comment #6

Posted on Jul 15, 2009 by Massive Lion

That pathelement location syntax fixed the problem. Thanks.

Status: New

Labels:
Type-Defect Priority-Medium