1 /* |
1 /* |
2 * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. Oracle designates this |
7 * published by the Free Software Foundation. Oracle designates this |
89 import com.sun.xml.internal.bind.v2.runtime.output.Pcdata; |
89 import com.sun.xml.internal.bind.v2.runtime.output.Pcdata; |
90 import com.sun.xml.internal.bind.v2.runtime.unmarshaller.Base64Data; |
90 import com.sun.xml.internal.bind.v2.runtime.unmarshaller.Base64Data; |
91 import com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallingContext; |
91 import com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallingContext; |
92 import com.sun.xml.internal.bind.v2.util.ByteArrayOutputStreamEx; |
92 import com.sun.xml.internal.bind.v2.util.ByteArrayOutputStreamEx; |
93 import com.sun.xml.internal.bind.v2.util.DataSourceSource; |
93 import com.sun.xml.internal.bind.v2.util.DataSourceSource; |
|
94 import java.util.logging.Logger; |
|
95 import com.sun.xml.internal.bind.Util; |
|
96 import java.util.logging.Level; |
94 |
97 |
95 import org.xml.sax.SAXException; |
98 import org.xml.sax.SAXException; |
96 |
99 |
97 /** |
100 /** |
98 * {@link BuiltinLeafInfoImpl} with a support for runtime. |
101 * {@link BuiltinLeafInfoImpl} with a support for runtime. |
103 * @author Kohsuke Kawaguchi |
106 * @author Kohsuke Kawaguchi |
104 */ |
107 */ |
105 public abstract class RuntimeBuiltinLeafInfoImpl<T> extends BuiltinLeafInfoImpl<Type,Class> |
108 public abstract class RuntimeBuiltinLeafInfoImpl<T> extends BuiltinLeafInfoImpl<Type,Class> |
106 implements RuntimeBuiltinLeafInfo, Transducer<T> { |
109 implements RuntimeBuiltinLeafInfo, Transducer<T> { |
107 |
110 |
|
111 private static final Logger logger = Util.getClassLogger(); |
|
112 |
108 private RuntimeBuiltinLeafInfoImpl(Class type, QName... typeNames) { |
113 private RuntimeBuiltinLeafInfoImpl(Class type, QName... typeNames) { |
109 super(type, typeNames); |
114 super(type, typeNames); |
110 LEAVES.put(type,this); |
115 LEAVES.put(type,this); |
111 } |
116 } |
112 |
117 |
194 * handled differently than ordinary classes. See table 8-2 "Mapping of Standard Java classes". |
199 * handled differently than ordinary classes. See table 8-2 "Mapping of Standard Java classes". |
195 */ |
200 */ |
196 public static final List<RuntimeBuiltinLeafInfoImpl<?>> builtinBeanInfos; |
201 public static final List<RuntimeBuiltinLeafInfoImpl<?>> builtinBeanInfos; |
197 |
202 |
198 public static final String MAP_ANYURI_TO_URI = "mapAnyUriToUri"; |
203 public static final String MAP_ANYURI_TO_URI = "mapAnyUriToUri"; |
|
204 public static final String USE_OLD_GMONTH_MAPPING = "jaxb.ri.useOldGmonthMapping"; |
199 |
205 |
200 static { |
206 static { |
201 |
207 |
202 QName[] qnames = (System.getProperty(MAP_ANYURI_TO_URI) == null) ? new QName[] { |
208 QName[] qnames = (System.getProperty(MAP_ANYURI_TO_URI) == null) ? new QName[] { |
203 createXS("string"), |
209 createXS("string"), |
958 Map<QName,String> m = xmlGregorianCalendarFormatString; |
964 Map<QName,String> m = xmlGregorianCalendarFormatString; |
959 // See 4971612: be careful for SCCS substitution |
965 // See 4971612: be careful for SCCS substitution |
960 m.put(DatatypeConstants.DATETIME, "%Y-%M-%DT%h:%m:%s"+ "%z"); |
966 m.put(DatatypeConstants.DATETIME, "%Y-%M-%DT%h:%m:%s"+ "%z"); |
961 m.put(DatatypeConstants.DATE, "%Y-%M-%D" +"%z"); |
967 m.put(DatatypeConstants.DATE, "%Y-%M-%D" +"%z"); |
962 m.put(DatatypeConstants.TIME, "%h:%m:%s"+ "%z"); |
968 m.put(DatatypeConstants.TIME, "%h:%m:%s"+ "%z"); |
963 m.put(DatatypeConstants.GMONTH, "--%M--%z"); |
969 if (System.getProperty(USE_OLD_GMONTH_MAPPING) == null) { |
|
970 m.put(DatatypeConstants.GMONTH, "--%M%z"); // E2-12 Error. http://www.w3.org/2001/05/xmlschema-errata#e2-12 |
|
971 } else { // backw. compatibility |
|
972 if (logger.isLoggable(Level.FINE)) { |
|
973 logger.log(Level.FINE, "Old GMonth mapping used."); |
|
974 } |
|
975 m.put(DatatypeConstants.GMONTH, "--%M--%z"); |
|
976 } |
964 m.put(DatatypeConstants.GDAY, "---%D" + "%z"); |
977 m.put(DatatypeConstants.GDAY, "---%D" + "%z"); |
965 m.put(DatatypeConstants.GYEAR, "%Y" + "%z"); |
978 m.put(DatatypeConstants.GYEAR, "%Y" + "%z"); |
966 m.put(DatatypeConstants.GYEARMONTH, "%Y-%M" + "%z"); |
979 m.put(DatatypeConstants.GYEARMONTH, "%Y-%M" + "%z"); |
967 m.put(DatatypeConstants.GMONTHDAY, "--%M-%D" +"%z"); |
980 m.put(DatatypeConstants.GMONTHDAY, "--%M-%D" +"%z"); |
968 } |
981 } |