src/share/jaxws_classes/com/sun/xml/internal/ws/spi/db/FieldSetter.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

@@ -24,14 +24,12 @@
  */
 
 package com.sun.xml.internal.ws.spi.db;
 
 import java.lang.reflect.Field;
-import java.security.AccessController;
-import java.security.PrivilegedActionException;
-import java.security.PrivilegedExceptionAction;
-
+import javax.xml.ws.WebServiceException;
+import static com.sun.xml.internal.ws.spi.db.PropertyGetterBase.verifyWrapperType;
 
 /**
  * FieldSetter
  * @author shih-chang.chen@oracle.com
  * @exclude

@@ -39,41 +37,25 @@
 public class FieldSetter extends PropertySetterBase {
 
     protected Field field;
 
     public FieldSetter(Field f) {
+        verifyWrapperType(f.getDeclaringClass());
         field = f;
         type = f.getType();
     }
 
     public Field getField() {
         return field;
     }
 
-    public void set(final Object instance, final Object resource) {
-        if (field.isAccessible()) {
+    public void set(final Object instance, final Object val) {
+        final Object resource = (type.isPrimitive() && val == null)? uninitializedValue(type): val;
             try {
                 field.set(instance, resource);
             } catch (Exception e) {
-                // TODO Auto-generated catch block
-                e.printStackTrace();
-            }
-        } else {
-            try {
-                AccessController.doPrivileged(new PrivilegedExceptionAction<Object>() {
-                    public Object run() throws IllegalAccessException {
-                        if (!field.isAccessible()) {
-                            field.setAccessible(true);
-                        }
-                        field.set(instance, resource);
-                        return null;
-                    }
-                });
-            } catch (PrivilegedActionException e) {
-                // TODO Auto-generated catch block
-                e.printStackTrace();
-            }
+            throw new WebServiceException(e);
         }
     }
 
     public <A> A getAnnotation(Class<A> annotationType) {
         Class c = annotationType;