src/share/jaxws_classes/com/sun/xml/internal/ws/spi/db/MethodSetter.java

Print this page
rev 447 : 8029237: Update copyright year to match last edit in jdk8 jaxws repository (2013)
Summary: Fixing Copyrights for year 2013
Reviewed-by: chegar
rev 472 : 8036030: Update JAX-WS RI integration to latest version

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License version 2 only, as
  * published by the Free Software Foundation.  Oracle designates this

@@ -23,14 +23,13 @@
  * questions.
  */
 
 package com.sun.xml.internal.ws.spi.db;
 
+import static com.sun.xml.internal.ws.spi.db.PropertyGetterBase.verifyWrapperType;
 import java.lang.reflect.Method;
-import java.security.AccessController;
-import java.security.PrivilegedActionException;
-import java.security.PrivilegedExceptionAction;
+import javax.xml.ws.WebServiceException;
 
 
 /**
  * MethodInjection
  * @author shih-chang.chen@oracle.com

@@ -39,10 +38,11 @@
 public class MethodSetter extends PropertySetterBase {
 
     private Method method;
 
     public MethodSetter(Method m) {
+        verifyWrapperType(m.getDeclaringClass());
         method = m;
         type = m.getParameterTypes()[0];
     }
 
     public Method getMethod() {

@@ -52,36 +52,15 @@
     public <A> A getAnnotation(Class<A> annotationType) {
         Class c = annotationType;
         return (A) method.getAnnotation(c);
     }
 
-    public void set(final Object instance, Object resource) {
+    public void set(final Object instance, Object val) {
+        final Object resource = (type.isPrimitive() && val == null)? uninitializedValue(type): val;
         final Object[] args = {resource};
-        if (method.isAccessible()) {
             try {
                 method.invoke(instance, args);
             } catch (Exception e) {
-                e.printStackTrace();
-            }
-        } else {
-            try {
-                AccessController.doPrivileged(new PrivilegedExceptionAction<Object>() {
-                    public Object run() throws IllegalAccessException {
-                        if (!method.isAccessible()) {
-                            method.setAccessible(true);
-                        }
-                        try {
-                            method.invoke(instance, args);
-                        } catch (Exception e) {
-                            // TODO Auto-generated catch block
-                            e.printStackTrace();
-                        }
-                        return null;
-                    }
-                });
-            } catch (PrivilegedActionException e) {
-                // TODO Auto-generated catch block
-                e.printStackTrace();
-            }
+            throw new WebServiceException(e);
         }
     }
 }