src/share/jaxws_classes/com/sun/tools/internal/xjc/reader/xmlschema/bindinfo/BIProperty.java

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

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 1997, 2012, 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

@@ -466,29 +466,26 @@
         if(prop.isCollection()) {
             CollectionTypeAttribute ct = getCollectionType();
             r = ct.get(getBuilder().model);
         } else {
             FieldRendererFactory frf = getBuilder().fieldRendererFactory;
-
-            if(prop.isOptionalPrimitive()) {
-                // the property type can be primitive type if we are to ignore absence
+            // according to the spec we should bahave as in jaxb1. So we ignore possiblity that property could be nullable
                 switch(opm) {
+                // the property type can be primitive type if we are to ignore absence
                 case PRIMITIVE:
                     r = frf.getRequiredUnboxed();
                     break;
                 case WRAPPER:
                     // force the wrapper type
-                    r = frf.getSingle();
+                    r = prop.isOptionalPrimitive() ? frf.getSingle() : frf.getDefault();
                     break;
                 case ISSET:
-                    r = frf.getSinglePrimitiveAccess();
+                    r = prop.isOptionalPrimitive() ? frf.getSinglePrimitiveAccess() : frf.getDefault();
                     break;
                 default:
                     throw new Error();
-                }
-            } else {
-                r = frf.getDefault();
+
             }
         }
         if(opm==OptionalPropertyMode.ISSET) {
             // only isSet is allowed on a collection. these 3 modes aren't really symmetric.