What's wrong with the class context from ReflectionUtil.getCurrentStackTrace() that requires a custom implementation of Exception?
On 18 March 2016 at 12:11, Guillaume Nodet <[email protected]> wrote: > The getClassContext() method is used in pax-logging to render the exception > in a nicer way. > I don't have any problem moving the qualifier to protected or whatever, but > we'd need to change the code in pax-logging > > > > https://github.com/ops4j/org.ops4j.pax.logging/blob/master/pax-logging-log4j2/src/main/java/org/apache/logging/log4j/core/impl/ThrowableProxy.java#L136-L144 > > > > https://github.com/ops4j/org.ops4j.pax.logging/blob/master/pax-logging-service/src/main/java/org/apache/log4j/OsgiThrowableRenderer.java#L62-L67 > > It should not be a big deal, but the current code expect the method to be > public unfortunately. > > Guillaume > > > 2016-03-18 17:29 GMT+01:00 Jean-Baptiste Onofré <[email protected]>: > > > Hi Cristiano, > > > > I think you are right, it's probably something existing for a while. I'm > > just surprised that you encountered now. > > > > Let me check your detailed use case that you sent previously. > > > > Regards > > JB > > > > > > On 03/18/2016 05:14 PM, Cristiano Costantini wrote: > > > >> Hello all, > >> > >> it is some days I was having troubles using CXF services on ServiceMix > >> (and > >> it is some days I spam on the mailing list of ServiceMix, Camel and CXF > >> :-D > >> ) and I've finally come to the source of my issues which are due to the > >> "endorsed" java.lang.Exception which is used by Karaf: > >> > >> > >> > https://github.com/apache/karaf/blob/master/exception/src/main/java/java/lang/Exception.java > >> > >> My problem is due to the fact that this class has a public property, > >> public Class[] getClassContext() { > >> return classContext; > >> } > >> which is seen by JaxB at runtime inside Karaf which cause it to marshall > >> the Exception in SOAP services with a wrong XML, an XML which include > >> <classContext> tags. > >> > >> The class in Karaf has not changed since committed by Guillaume Nodet in > >> 2010, so this issue with CXF has probably always been there. > >> > >> In my opinion, this getter should be private or protected as I guess it > is > >> only used on the nested class method's getThrowableContext (it is a > >> replacement for the JRE's class, I don't think there are external > project > >> using this modification of the Exception class). > >> > >> > >> To confirm my thesis, I've hacked the > org.apache.karaf.exception-2.4.0.jar > >> inside the lib/endorsed folder with a class compiled by myself where > I've > >> changed the method to > >> private Class[] getClassContext() { > >> return classContext; > >> } > >> and with this hack, Karaf has continued to work (and my CXF service now > >> works properly). > >> > >> Do you think there are potential side effects in this fix? > >> Do you need me to open an issue on Jira to handle the problem? > >> If it is confirmed that the fix of making this method private, do you > >> think > >> it could be included soon on the next Karaf Release? > >> > >> Thank you very much to all, > >> Cristiano > >> > >> > > -- > > Jean-Baptiste Onofré > > [email protected] > > http://blog.nanthrax.net > > Talend - http://www.talend.com > > > > > > -- > ------------------------ > Guillaume Nodet > ------------------------ > Red Hat, Open Source Integration > > Email: [email protected] > Web: http://fusesource.com > Blog: http://gnodet.blogspot.com/ > -- Matt Sicker <[email protected]>
