Describe The Bug
The jar file for version 0.45.0 that is deployed Maven central seems to by mistake be compiled for code coverage using the tool Cobertura. The byte-code of the classes in the jar file reference Cobertura classes.
The result is that Fax4J 0.45.0 from Maven central is not usable. Any application using it crashes with a NoClassDefFoundError (if Cobertura is not on the class path).
This seems to be the same issue that was reported here: #37
But the reporter of that issue failed to provide any details, so the problem could not be identified.
To Reproduce
Method 1
Run any application that creates a FaxClientFactory, without having Cobertura on the class-path. Observe the stack trace printout.
Method 2
- Download the jar from Maven central: https://repo1.maven.org/maven2/net/sf/fax4j/fax4j/0.45.0/fax4j-0.45.0.jar
- Unzip the jar.
- Run command
javap -p -c fax4j-0.45.0/org/fax4j/FaxClientFactory.class
- Observe that the byte code printout contain references to Cobertura:
$ javap -p -c fax4j-0.45.0/org/fax4j/FaxClientFactory.class
Compiled from "FaxClientFactory.java"
public final class org.fax4j.FaxClientFactory {
public static final transient int[] __cobertura_counters;
...
static {};
Code:
0: invokestatic #27 // Method __cobertura_init:()V
3: return
public static void __cobertura_init();
Code:
0: getstatic #16 // Field __cobertura_counters:[I
3: ifnonnull 18
6: ldc #132 // int 21
8: newarray int
10: putstatic #16 // Field __cobertura_counters:[I
13: ldc #133 // String org/fax4j/FaxClientFactory
15: invokestatic #139 // Method net/sourceforge/cobertura/coveragedata/TouchCollector.registerClass:(Ljava/lang/String;)V
18: return
...
}
Error Stack
--- exec:3.0.0:exec (default-cli) @ FaxSender ---
Exception in thread "main" java.lang.NoClassDefFoundError: net/sourceforge/cobertura/coveragedata/TouchCollector
at org.fax4j.FaxClientFactory.__cobertura_init(FaxClientFactory.java)
at org.fax4j.FaxClientFactory.<clinit>(FaxClientFactory.java)
at se.myproject.send.Fax.<init>(Fax.java:73)
at se.myproject.Main.main(Main.java:73)
Caused by: java.lang.ClassNotFoundException: net.sourceforge.cobertura.coveragedata.TouchCollector
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:525)
... 4 more
Code Sample
Any code that creates a FaxClientFactory will trigger the error.
Other
Thanks for a nice and useful project! :)
Describe The Bug
The jar file for version 0.45.0 that is deployed Maven central seems to by mistake be compiled for code coverage using the tool Cobertura. The byte-code of the classes in the jar file reference Cobertura classes.
The result is that Fax4J 0.45.0 from Maven central is not usable. Any application using it crashes with a
NoClassDefFoundError(if Cobertura is not on the class path).This seems to be the same issue that was reported here: #37
But the reporter of that issue failed to provide any details, so the problem could not be identified.
To Reproduce
Method 1
Run any application that creates a
FaxClientFactory, without having Cobertura on the class-path. Observe the stack trace printout.Method 2
javap -p -c fax4j-0.45.0/org/fax4j/FaxClientFactory.classError Stack
Code Sample
Any code that creates a
FaxClientFactorywill trigger the error.Other
Thanks for a nice and useful project! :)