Bug#707298: libcglib-java: code changes break libmockito-java

Stefan Denker Stefan+debian at dn-kr.de
Wed May 8 21:20:58 UTC 2013


Package: libcglib-java
Version: 2.2.2+dfsg-5
Severity: important
Tags: patch

Dear Maintainer,

The current version of libcglib in debian breaks the libmockito-java
package. I've put together a test class (With code taken from
http://docs.mockito.googlecode.com/hg/latest/org/mockito/Mockito.html#13
)

|List list = new LinkedList();
|List spy = spy(list);
|
|// using the spy calls real methods
|spy.add("one");
|spy.add("two");

Trying to run this yields : 

|java.lang.RuntimeException: Unable to set MockitoNamingPolicy on cglib generator which creates FastClasses
|at org.mockito.internal.creation.cglib.CGLIBHacker.setMockitoNamingPolicy(CGLIBHacker.java:29)
|at org.mockito.internal.creation.MethodInterceptorFilter.intercept(MethodInterceptorFilter.java:42)
|at $java.util.LinkedList$$EnhancerByMockitoWithCGLIB$$440d9615.add(<generated>)
|at testSpy.spying(testSpy.java:17)
|Caused by: java.lang.NullPointerException
|at org.mockito.internal.creation.cglib.CGLIBHacker.setMockitoNamingPolicy(CGLIBHacker.java:23)

Downgrading libcglib to 2.2+dfsg-2 (squeeze) fixes this. 

Browsing the changes in cglib, I traced this down to the
MethodProxy.java class, particularly this change: 
http://cglib.cvs.sourceforge.net/viewvc/cglib/cglib/src/proxy/net/sf/cglib/proxy/MethodProxy.java?r1=1.14&r2=1.15

I believe the change was accidental, so the attached patch restores the
old behaviour. Applying it to libcglib-java makes my test run. 

This is just a workaround, but it is the minimal change to get Mockito
working again in Debian. 

-- System Information:
Debian Release: 7.0
  APT prefers stable
  APT policy: (500, 'stable')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 3.2.0-4-amd64 (SMP w/2 CPU cores)
Locale: LANG=en_IE.UTF-8, LC_CTYPE=en_IE.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages libcglib-java depends on:
ii  libasm3-java  3.3.2-1

libcglib-java recommends no packages.

libcglib-java suggests no packages.

-- no debconf information

-- 
Wer A sagt, der muss nicht B sagen. Er kann auch erkennen, dass A falsch war.
Bertolt Brecht
-------------- next part --------------
A non-text attachment was scrubbed...
Name: dont_set_createinfo_to_null.patch
Type: text/x-diff
Size: 355 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/pkg-java-maintainers/attachments/20130508/15e9f849/attachment.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: testSpy.java
Type: text/x-java
Size: 308 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/pkg-java-maintainers/attachments/20130508/15e9f849/attachment.java>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.alioth.debian.org/pipermail/pkg-java-maintainers/attachments/20130508/15e9f849/attachment.pgp>


More information about the pkg-java-maintainers mailing list