Author: ffang Date: Mon Jan 21 07:26:32 2013 New Revision: 1436213 URL: http://svn.apache.org/viewvc?rev=1436213&view=rev Log: Merged revisions 1436211 via svnmerge from https://svn.apache.org/repos/asf/cxf/branches/2.6.x-fixes
................ r1436211 | ffang | 2013-01-21 15:20:12 +0800 (一, 21 1 2013) | 16 lines Merged revisions 1436210 via svnmerge from https://svn.apache.org/repos/asf/cxf/branches/2.7.x-fixes ................ r1436210 | ffang | 2013-01-21 15:14:54 +0800 (一, 21 1 2013) | 9 lines Merged revisions 1436208 via svnmerge from https://svn.apache.org/repos/asf/cxf/trunk ........ r1436208 | ffang | 2013-01-21 15:06:30 +0800 (一, 21 1 2013) | 1 line [CXF-4768]Refact SwaOutInterceptor to honor other JAXB impl(besides JAXB RI) ........ ................ ................ Modified: cxf/branches/2.5.x-fixes/ (props changed) cxf/branches/2.5.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/SwAOutInterceptor.java Propchange: cxf/branches/2.5.x-fixes/ ------------------------------------------------------------------------------ Merged /cxf/branches/2.7.x-fixes:r1436210 Merged /cxf/trunk:r1436208 Merged /cxf/branches/2.6.x-fixes:r1436211 Propchange: cxf/branches/2.5.x-fixes/ ------------------------------------------------------------------------------ Binary property 'svnmerge-integrated' - no diff available. Modified: cxf/branches/2.5.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/SwAOutInterceptor.java URL: http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/SwAOutInterceptor.java?rev=1436213&r1=1436212&r2=1436213&view=diff ============================================================================== --- cxf/branches/2.5.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/SwAOutInterceptor.java (original) +++ cxf/branches/2.5.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/SwAOutInterceptor.java Mon Jan 21 07:26:32 2013 @@ -25,6 +25,8 @@ import java.awt.image.BufferedImage; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.lang.reflect.Method; +import java.security.AccessController; +import java.security.PrivilegedExceptionAction; import java.util.ArrayList; import java.util.Collection; import java.util.Iterator; @@ -80,11 +82,20 @@ public class SwAOutInterceptor extends A addBefore(WrapperClassOutInterceptor.class.getName()); } - private boolean callSWARefMethod(JAXBContext ctx) { + private boolean callSWARefMethod(final JAXBContext ctx) { Method m = SWA_REF_METHOD.get(ctx.getClass().getName()); if (m == null && !SWA_REF_METHOD.containsKey(ctx.getClass().getName())) { try { - m = ctx.getClass().getMethod("hasSwaRef", new Class[0]); + m = AccessController.doPrivileged(new PrivilegedExceptionAction<Method>() { + + public Method run() throws Exception { + Method hasSwaRefMethod = ctx.getClass().getMethod("hasSwaRef", new Class[0]); + if (!hasSwaRefMethod.isAccessible()) { + hasSwaRefMethod.setAccessible(true); + } + return hasSwaRefMethod; + } + }); SWA_REF_METHOD.put(ctx.getClass().getName(), m); } catch (Exception e) { //ignore @@ -218,7 +229,8 @@ public class SwAOutInterceptor extends A atts.add(att); } } - private boolean hasSwaRef(JAXBDataBinding db) { + + protected boolean hasSwaRef(JAXBDataBinding db) { JAXBContext context = db.getContext(); return callSWARefMethod(context); }
