After further investigation I've figured out the cause of the error. The
upload of Easymock 3.3 in April triggered a bug in XBean.

With Easymock 3.3, the dependencies were changed from cglib-nodep to
cglib+asm, this added the org.objectweb.asm.* classes to the test
classpath of the projects using Easymock (cglib-nodep contained a
relocated copy of ASM under the net.sf.cglib.asm package).

wagon-file uses Easymock, and its tests extend PlexusTestCase which hits
ReflectionUtil from xbean-reflect. ReflectionUtil has a static
initializer with:

  private static ParameterNameLoader parameterNamesLoader;

  static {
      if (isClassAvailable("org.apache.xbean.asm5.ClassReader")) {
          parameterNamesLoader = new XbeanAsmParameterNameLoader();
      } else if (isClassAvailable("org.objectweb.asm.ClassReader")) {
          parameterNamesLoader = new AsmParameterNameLoader();

      } else if (isClassAvailable("org.apache.xbean.asm.ClassReader") ||
isClassAvailable("org.apache.xbean.asm4.ClassReader")) {
          throw new RuntimeException("Your xbean-asm-shade is too old,
please upgrade to xbean-asm5-shade");

The code looks for an implementation of ASM (either the one repackaged
for xbean, or the original one). If no implementation is found, nothing
happens, the parameterNamesLoader can be null and the class is still
partially usable.

After the update of Easymock org.objectweb.asm.ClassReader became
available on the classpath, and the static block attempted to create an
instance of AsmParameterNameLoader. But AsmParameterNameLoader uses the
EmptyVisitor class which is unlikely to be available, because
org.apache.xbean.asm5 is not there (otherwise
XbeanAsmParameterNameLoader would have be instianted instead), and
xbean-asm-util which also contains the EmptyVisitor has no guarantee of
being on the classpath (xbean-asm-util is an optional dependency of

This issue could be fixed by changing Easymock to depend on cglib-nodep,
but I think Xbean is wrong here. ReflectionUtil shouldn't break, the
code is too fragile. I've modified AsmParameterNameLoader to avoid using
the EmptyVisitor class [1] and it works perfectly.

Emmanuel Bourg


This is the maintainer address of Debian's Java team
Please use for discussions and questions.

Reply via email to