[ 
https://issues.apache.org/jira/browse/CAMEL-15893?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Freeman Yue Fang resolved CAMEL-15893.
--------------------------------------
    Fix Version/s: 3.7.0
                   2.25.3
       Resolution: Fixed

> onJobExecute method of 
> org.apache.camel.routepolicy.quartz2.ScheduledRoutePolicy should be public
> -------------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-15893
>                 URL: https://issues.apache.org/jira/browse/CAMEL-15893
>             Project: Camel
>          Issue Type: Improvement
>          Components: camel-quartz2, osgi
>            Reporter: Freeman Yue Fang
>            Assignee: Freeman Yue Fang
>            Priority: Minor
>             Fix For: 2.25.3, 3.7.0
>
>
> Other wise can't access this method from a proxy.
> For example, if we expose the service in blueprint from one bundle like
> {code}
> <bean id="myPolicy" 
> class="org.apache.camel.routepolicy.quartz2.CronScheduledRoutePolicy">
>                 <property name="routeStartTime" value="....."/>
>                 <property name="routeStopTime" value="...."/>
>         </bean>
>         
>         <service ref="myPolicy" auto-export="all-classes"/>
> {code}
> And refer it in another bundle like this
> {code}
>                  <reference id="remote-policy"
>                                 
> interface="org.apache.camel.routepolicy.quartz2.ScheduledRoutePolicy"
>                                 ext:proxy-method='classes'" />
>                  <route id="route-remote" routePolicyRef="remote-policy" 
> autoStartup="false">
>                         ....
>                 </route>
> {code}
> Since here the remote-policy reference from aries blueprint is actually a 
> proxy, so we will run into error like
> {code}
> at 
> org.apache.camel.routepolicy.quartz2.ScheduledJob.execute(ScheduledJob.java:62)
>  ~[!/:2.21.0.fuse-770013-redhat-00001]
>       at org.quartz.core.JobRunShell.run(JobRunShell.java:202) 
> [!/:2.3.2.redhat-00007]
>       at 
> org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:573) 
> [!/:2.3.2.redhat-00007]
> Caused by: java.lang.IllegalAccessException: Class 
> org.apache.aries.proxy.impl.ProxyHandler$1 can not access a member of class 
> org.apache.camel.routepolicy.quartz2.ScheduledRoutePolicy with modifiers 
> "protected"
>       at sun.reflect.Reflection.ensureMemberAccess(Reflection.java:102) 
> ~[?:1.8.0_221]
>       at 
> java.lang.reflect.AccessibleObject.slowCheckMemberAccess(AccessibleObject.java:296)
>  ~[?:1.8.0_221]
>       at 
> java.lang.reflect.AccessibleObject.checkAccess(AccessibleObject.java:288) 
> ~[?:1.8.0_221]
>       at java.lang.reflect.Method.invoke(Method.java:491) ~[?:1.8.0_221]
>       at 
> org.apache.aries.proxy.impl.ProxyHandler$1.invoke(ProxyHandler.java:54) ~[?:?]
>       at 
> org.apache.aries.proxy.impl.ProxyHandler.invoke(ProxyHandler.java:119) ~[?:?]
>       at 
> org.apache.camel.routepolicy.quartz2.$ScheduledRoutePolicy566505575.onJobExecute(Unknown
>  Source) ~[!/:2.21.0.fuse-770013-redhat-00001]
>       at 
> org.apache.camel.routepolicy.quartz2.ScheduledJob.execute(ScheduledJob.java:53)
>  ~[!/:2.21.0.fuse-770013-redhat-00001]
> {code}
> So to make this method available for the proxy, we should change its modifier 
> as "public"
> If there's no objection, I will make this change



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to