Author: ffang
Date: Mon Jan 21 07:14:54 2013
New Revision: 1436210
URL: http://svn.apache.org/viewvc?rev=1436210&view=rev
Log:
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.7.x-fixes/ (props changed)
cxf/branches/2.7.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/SwAOutInterceptor.java
Propchange: cxf/branches/2.7.x-fixes/
------------------------------------------------------------------------------
Merged /cxf/trunk:r1436208
Propchange: cxf/branches/2.7.x-fixes/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Mon Jan 21 07:14:54 2013
@@ -1 +1 @@
-/cxf/trunk:1-1430398,1430564,1430881-1430882,1430905,1430965,1430976,1431315,1431604-1431607,1432070,1432236,1432798,1433007,1433033,1433135,1433305,1433347,1433895,1434042,1434124,1434564,1435034,1435111,1435223,1435354
+/cxf/trunk:1-1430398,1430564,1430881-1430882,1430905,1430965,1430976,1431315,1431604-1431607,1432070,1432236,1432798,1433007,1433033,1433135,1433305,1433347,1433895,1434042,1434124,1434564,1435034,1435111,1435223,1435354,1436208
Modified:
cxf/branches/2.7.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/SwAOutInterceptor.java
URL:
http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/SwAOutInterceptor.java?rev=1436210&r1=1436209&r2=1436210&view=diff
==============================================================================
---
cxf/branches/2.7.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/SwAOutInterceptor.java
(original)
+++
cxf/branches/2.7.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/SwAOutInterceptor.java
Mon Jan 21 07:14:54 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;
@@ -81,11 +83,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
@@ -222,7 +233,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);
}