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

Damien Raude-Morvan drazzib at drazzib.com
Fri May 17 22:32:00 UTC 2013


Hi Stefan,

2013/5/8 Stefan Denker <Stefan+debian at dn-kr.de>

> 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.
>

Thanks for your analysis of this issue and your provided workaround.
I'm a bit reluctant to apply your patch as-is because, in fact, upstream
added "createInfo = null;" to fix
http://sourceforge.net/p/cglib/bugs/28/

I'll check with them how to fix this properly...

Regards,
-- 
Damien
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.alioth.debian.org/pipermail/pkg-java-maintainers/attachments/20130518/8ce8d9e7/attachment.html>


More information about the pkg-java-maintainers mailing list