[
https://issues.apache.org/jira/browse/WICKET-5910?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14551927#comment-14551927
]
ASF GitHub Bot commented on WICKET-5910:
----------------------------------------
Github user martin-g commented on a diff in the pull request:
https://github.com/apache/wicket/pull/119#discussion_r30675893
--- Diff:
wicket-ioc/src/main/java/org/apache/wicket/proxy/LazyInitProxyFactory.java ---
@@ -349,6 +368,33 @@ public Object writeReplace() throws
ObjectStreamException
}
/**
+ * Serializable implementation of the NoOp callback.
+ */
+ public static class SerializableNoOpCallback implements NoOp,
Serializable
+ {
+ private static final long serialVersionUID = 1L;
+ }
+
+ /**
+ * CGLib callback filter: does not intercept protected methods.
+ *
+ * Otherwise CGLib throws an IllegalArgumentException: protected method.
+ */
+ private static class CGLibCallbackFilter implements CallbackFilter {
--- End diff --
Please add a link to the description of the problem with protected methods
in the Javadoc.
> 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)