src/share/jaxws_classes/com/sun/xml/internal/bind/v2/model/impl/RuntimeBuiltinLeafInfoImpl.java

Print this page

        

@@ -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

@@ -89,10 +89,13 @@
 import com.sun.xml.internal.bind.v2.runtime.output.Pcdata;
 import com.sun.xml.internal.bind.v2.runtime.unmarshaller.Base64Data;
 import com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallingContext;
 import com.sun.xml.internal.bind.v2.util.ByteArrayOutputStreamEx;
 import com.sun.xml.internal.bind.v2.util.DataSourceSource;
+import java.util.logging.Logger;
+import com.sun.xml.internal.bind.Util;
+import java.util.logging.Level;
 
 import org.xml.sax.SAXException;
 
 /**
  * {@link BuiltinLeafInfoImpl} with a support for runtime.

@@ -103,10 +106,12 @@
  * @author Kohsuke Kawaguchi
  */
 public abstract class RuntimeBuiltinLeafInfoImpl<T> extends BuiltinLeafInfoImpl<Type,Class>
     implements RuntimeBuiltinLeafInfo, Transducer<T> {
 
+    private static final Logger logger = Util.getClassLogger();
+
     private RuntimeBuiltinLeafInfoImpl(Class type, QName... typeNames) {
         super(type, typeNames);
         LEAVES.put(type,this);
     }
 

@@ -194,10 +199,11 @@
      * handled differently than ordinary classes. See table 8-2 "Mapping of Standard Java classes".
      */
     public static final List<RuntimeBuiltinLeafInfoImpl<?>> builtinBeanInfos;
 
     public static final String MAP_ANYURI_TO_URI = "mapAnyUriToUri";
+    public static final String USE_OLD_GMONTH_MAPPING = "jaxb.ri.useOldGmonthMapping";
 
     static {
 
         QName[] qnames = (System.getProperty(MAP_ANYURI_TO_URI) == null) ? new QName[] {
                                 createXS("string"),

@@ -958,11 +964,18 @@
         Map<QName,String> m = xmlGregorianCalendarFormatString;
         // See 4971612: be careful for SCCS substitution
         m.put(DatatypeConstants.DATETIME,   "%Y-%M-%DT%h:%m:%s"+ "%z");
         m.put(DatatypeConstants.DATE,       "%Y-%M-%D" +"%z");
         m.put(DatatypeConstants.TIME,       "%h:%m:%s"+ "%z");
+        if (System.getProperty(USE_OLD_GMONTH_MAPPING) == null) {
+            m.put(DatatypeConstants.GMONTH, "--%M%z");      //  E2-12 Error. http://www.w3.org/2001/05/xmlschema-errata#e2-12
+        } else {                                            //  backw. compatibility
+            if (logger.isLoggable(Level.FINE)) {
+                logger.log(Level.FINE, "Old GMonth mapping used.");
+            }
         m.put(DatatypeConstants.GMONTH,     "--%M--%z");
+        }
         m.put(DatatypeConstants.GDAY,       "---%D" + "%z");
         m.put(DatatypeConstants.GYEAR,      "%Y" + "%z");
         m.put(DatatypeConstants.GYEARMONTH, "%Y-%M" + "%z");
         m.put(DatatypeConstants.GMONTHDAY,  "--%M-%D" +"%z");
     }