1.1 --- a/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/ContextFactory.java Thu Apr 04 19:05:24 2013 -0700 1.2 +++ b/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/ContextFactory.java Tue Apr 09 14:51:13 2013 +0100 1.3 @@ -1,5 +1,5 @@ 1.4 /* 1.5 - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. 1.6 + * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. 1.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 1.8 * 1.9 * This code is free software; you can redistribute it and/or modify it 1.10 @@ -60,10 +60,11 @@ 1.11 * @author Kohsuke Kawaguchi 1.12 */ 1.13 public class ContextFactory { 1.14 + 1.15 /** 1.16 * The API will invoke this method via reflection 1.17 */ 1.18 - public static JAXBContext createContext( Class[] classes, Map<String,Object> properties ) throws JAXBException { 1.19 + public static JAXBContext createContext(Class[] classes, Map<String,Object> properties ) throws JAXBException { 1.20 // fool-proof check, and copy the map to make it easier to find unrecognized properties. 1.21 if(properties==null) 1.22 properties = Collections.emptyMap(); 1.23 @@ -76,6 +77,10 @@ 1.24 if(c14nSupport==null) 1.25 c14nSupport = false; 1.26 1.27 + Boolean disablesecurityProcessing = getPropertyValue(properties, JAXBRIContext.DISABLE_XML_SECURITY, Boolean.class); 1.28 + if (disablesecurityProcessing==null) 1.29 + disablesecurityProcessing = false; 1.30 + 1.31 Boolean allNillable = getPropertyValue(properties,JAXBRIContext.TREAT_EVERYTHING_NILLABLE,Boolean.class); 1.32 if(allNillable==null) 1.33 allNillable = false; 1.34 @@ -89,8 +94,14 @@ 1.35 supressAccessorWarnings = false; 1.36 1.37 Boolean improvedXsiTypeHandling = getPropertyValue(properties, JAXBRIContext.IMPROVED_XSI_TYPE_HANDLING, Boolean.class); 1.38 - if(improvedXsiTypeHandling == null) 1.39 - improvedXsiTypeHandling = true; 1.40 + if (improvedXsiTypeHandling == null) { 1.41 + String improvedXsiSystemProperty = Util.getSystemProperty(JAXBRIContext.IMPROVED_XSI_TYPE_HANDLING); 1.42 + if (improvedXsiSystemProperty == null) { 1.43 + improvedXsiTypeHandling = true; 1.44 + } else { 1.45 + improvedXsiTypeHandling = Boolean.valueOf(improvedXsiSystemProperty); 1.46 + } 1.47 + } 1.48 1.49 Boolean xmlAccessorFactorySupport = getPropertyValue(properties, 1.50 JAXBRIContext.XMLACCESSORFACTORY_SUPPORT,Boolean.class); 1.51 @@ -103,6 +114,11 @@ 1.52 1.53 RuntimeAnnotationReader ar = getPropertyValue(properties,JAXBRIContext.ANNOTATION_READER,RuntimeAnnotationReader.class); 1.54 1.55 + Collection<TypeReference> tr = getPropertyValue(properties, JAXBRIContext.TYPE_REFERENCES, Collection.class); 1.56 + if (tr == null) { 1.57 + tr = Collections.<TypeReference>emptyList(); 1.58 + } 1.59 + 1.60 Map<Class,Class> subclassReplacements; 1.61 try { 1.62 subclassReplacements = TypeCast.checkedCast( 1.63 @@ -117,7 +133,7 @@ 1.64 1.65 JAXBContextImpl.JAXBContextBuilder builder = new JAXBContextImpl.JAXBContextBuilder(); 1.66 builder.setClasses(classes); 1.67 - builder.setTypeRefs(Collections.<TypeReference>emptyList()); 1.68 + builder.setTypeRefs(tr); 1.69 builder.setSubclassReplacements(subclassReplacements); 1.70 builder.setDefaultNsUri(defaultNsUri); 1.71 builder.setC14NSupport(c14nSupport); 1.72 @@ -127,6 +143,7 @@ 1.73 builder.setRetainPropertyInfo(retainPropertyInfo); 1.74 builder.setSupressAccessorWarnings(supressAccessorWarnings); 1.75 builder.setImprovedXsiTypeHandling(improvedXsiTypeHandling); 1.76 + builder.setDisableSecurityProcessing(disablesecurityProcessing); 1.77 return builder.build(); 1.78 } 1.79 1.80 @@ -144,6 +161,22 @@ 1.81 return type.cast(o); 1.82 } 1.83 1.84 + /** 1.85 + * 1.86 + * @param classes 1.87 + * @param typeRefs 1.88 + * @param subclassReplacements 1.89 + * @param defaultNsUri 1.90 + * @param c14nSupport 1.91 + * @param ar 1.92 + * @param xmlAccessorFactorySupport 1.93 + * @param allNillable 1.94 + * @param retainPropertyInfo 1.95 + * @return 1.96 + * @throws JAXBException 1.97 + * @deprecated use createContext(Class[] classes, Map<String,Object> properties) method instead 1.98 + */ 1.99 + @Deprecated 1.100 public static JAXBRIContext createContext( Class[] classes, 1.101 Collection<TypeReference> typeRefs, Map<Class,Class> subclassReplacements, 1.102 String defaultNsUri, boolean c14nSupport, RuntimeAnnotationReader ar, 1.103 @@ -154,6 +187,23 @@ 1.104 allNillable, retainPropertyInfo, false); 1.105 } 1.106 1.107 + /** 1.108 + * 1.109 + * @param classes 1.110 + * @param typeRefs 1.111 + * @param subclassReplacements 1.112 + * @param defaultNsUri 1.113 + * @param c14nSupport 1.114 + * @param ar 1.115 + * @param xmlAccessorFactorySupport 1.116 + * @param allNillable 1.117 + * @param retainPropertyInfo 1.118 + * @param improvedXsiTypeHandling 1.119 + * @return 1.120 + * @throws JAXBException 1.121 + * @deprecated use createContext( Class[] classes, Map<String,Object> properties) method instead 1.122 + */ 1.123 + @Deprecated 1.124 public static JAXBRIContext createContext( Class[] classes, 1.125 Collection<TypeReference> typeRefs, Map<Class,Class> subclassReplacements, 1.126 String defaultNsUri, boolean c14nSupport, RuntimeAnnotationReader ar,