dipooyekanmi / testability-explorer

Automatically exported from code.google.com/p/testability-explorer
Apache License 2.0
0 stars 0 forks source link

AntTask tries to use ZIP loader for classes from build directory #4

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
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

Original issue reported on code.google.com by mgaer...@gmail.com on 18 Jan 2009 at 6:45

GoogleCodeExporter commented 8 years ago
I am also getting this problem. I am running it on Ant 1.7 with JDK 
1.6.0_10-b33.

Original comment by faisal.a...@gmail.com on 20 Jan 2009 at 10:18

GoogleCodeExporter commented 8 years ago
I am too!  Any help will be appreciated.

Original comment by morrbrad...@gmail.com on 27 Jan 2009 at 11:35

GoogleCodeExporter commented 8 years ago
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.

Original comment by leonfranzen@gmail.com on 30 Jan 2009 at 10:30

GoogleCodeExporter commented 8 years ago
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.

Original comment by Octavius@gmail.com on 27 Feb 2009 at 5:55

GoogleCodeExporter commented 8 years ago
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>

Original comment by gslowiko...@gmail.com on 2 Mar 2009 at 1:15

GoogleCodeExporter commented 8 years ago
That pathelement location syntax fixed the problem. Thanks.

Original comment by mgaer...@gmail.com on 15 Jul 2009 at 6:22