You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Guillaume Smet (JIRA)" <ji...@apache.org> on 2015/05/19 23:13:00 UTC
[jira] [Created] (WICKET-5910) CGLib proxy should not intercept
protected methods
Guillaume Smet created WICKET-5910:
--------------------------------------
Summary: CGLib proxy should not intercept protected methods
Key: WICKET-5910
URL: https://issues.apache.org/jira/browse/WICKET-5910
Project: Wicket
Issue Type: Bug
Components: wicket
Affects Versions: 7.0.0-M5
Reporter: Guillaume Smet
Hi,
When trying to inject a Jackson 2 ObjectMapper, we end up with the following exception:
{quote}
java.lang.IllegalArgumentException: Protected method: defaultClassIntrospector()Lcom/fasterxml/jackson/databind/introspect/ClassIntrospector;
at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:209)
at org.apache.wicket.proxy.LazyInitProxyFactory$CGLibInterceptor.intercept(LazyInitProxyFactory.java:329)
at WICKET_com.fasterxml.jackson.databind.ObjectMapper$$EnhancerByCGLIB$$b8a70988.defaultClassIntrospector(<generated>)
at com.fasterxml.jackson.databind.ObjectMapper.<init>(ObjectMapper.java:465)
at com.fasterxml.jackson.databind.ObjectMapper.<init>(ObjectMapper.java:391)
at WICKET_com.fasterxml.jackson.databind.ObjectMapper$$EnhancerByCGLIB$$b8a70988.<init>(<generated>)
at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
at net.sf.cglib.core.ReflectUtils.newInstance(ReflectUtils.java:228)
at net.sf.cglib.core.ReflectUtils.newInstance(ReflectUtils.java:220)
at net.sf.cglib.core.ReflectUtils.newInstance(ReflectUtils.java:216)
at net.sf.cglib.proxy.Enhancer.createUsingReflection(Enhancer.java:643)
at net.sf.cglib.proxy.Enhancer.firstInstance(Enhancer.java:538)
at net.sf.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:231)
at net.sf.cglib.proxy.Enhancer.createHelper(Enhancer.java:377)
at net.sf.cglib.proxy.Enhancer.create(Enhancer.java:285)
at org.apache.wicket.proxy.LazyInitProxyFactory.createProxy(LazyInitProxyFactory.java:170)
at org.apache.wicket.spring.injection.annot.AnnotProxyFieldValueFactory.getFieldValue(AnnotProxyFieldValueFactory.java:164)
at org.apache.wicket.injection.Injector.inject(Injector.java:111)
at org.apache.wicket.spring.injection.annot.SpringComponentInjector.inject(SpringComponentInjector.java:124)
at fr.openwide.core.wicket.more.console.maintenance.task.model.BatchReportBeanModel.<init>(BatchReportBeanModel.java:45)
{quote}
I ended up on this thread which explains the issue and how the people at Spring fixed the issue:
http://comments.gmane.org/gmane.comp.java.cglib.devel/720
There are 2 ways to fix the issue:
- either use invokeSuper() instead of invoke() if the method is protected;
- or do not override at all the calls to protected methods.
Spring did it the second way and that's what I implemented in the PR to come.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)