Bug#789518: wagon2: FTBFS in sid

Emmanuel Bourg ebourg at apache.org
Fri Aug 7 09:55:31 UTC 2015


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
xbean-reflect).

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

[1] https://github.com/apache/geronimo-xbean/pull/12



More information about the pkg-java-maintainers mailing list