diff -r 8c0b6bccfe47 -r 0989ad8c0860 src/share/jaxws_classes/com/sun/xml/internal/bind/v2/ContextFactory.java --- a/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/ContextFactory.java Thu Apr 04 19:05:24 2013 -0700 +++ b/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/ContextFactory.java Tue Apr 09 14:51:13 2013 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2012, 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 @@ -60,10 +60,11 @@ * @author Kohsuke Kawaguchi */ public class ContextFactory { + /** * The API will invoke this method via reflection */ - public static JAXBContext createContext( Class[] classes, Map properties ) throws JAXBException { + public static JAXBContext createContext(Class[] classes, Map properties ) throws JAXBException { // fool-proof check, and copy the map to make it easier to find unrecognized properties. if(properties==null) properties = Collections.emptyMap(); @@ -76,6 +77,10 @@ if(c14nSupport==null) c14nSupport = false; + Boolean disablesecurityProcessing = getPropertyValue(properties, JAXBRIContext.DISABLE_XML_SECURITY, Boolean.class); + if (disablesecurityProcessing==null) + disablesecurityProcessing = false; + Boolean allNillable = getPropertyValue(properties,JAXBRIContext.TREAT_EVERYTHING_NILLABLE,Boolean.class); if(allNillable==null) allNillable = false; @@ -89,8 +94,14 @@ supressAccessorWarnings = false; Boolean improvedXsiTypeHandling = getPropertyValue(properties, JAXBRIContext.IMPROVED_XSI_TYPE_HANDLING, Boolean.class); - if(improvedXsiTypeHandling == null) - improvedXsiTypeHandling = true; + if (improvedXsiTypeHandling == null) { + String improvedXsiSystemProperty = Util.getSystemProperty(JAXBRIContext.IMPROVED_XSI_TYPE_HANDLING); + if (improvedXsiSystemProperty == null) { + improvedXsiTypeHandling = true; + } else { + improvedXsiTypeHandling = Boolean.valueOf(improvedXsiSystemProperty); + } + } Boolean xmlAccessorFactorySupport = getPropertyValue(properties, JAXBRIContext.XMLACCESSORFACTORY_SUPPORT,Boolean.class); @@ -103,6 +114,11 @@ RuntimeAnnotationReader ar = getPropertyValue(properties,JAXBRIContext.ANNOTATION_READER,RuntimeAnnotationReader.class); + Collection tr = getPropertyValue(properties, JAXBRIContext.TYPE_REFERENCES, Collection.class); + if (tr == null) { + tr = Collections.emptyList(); + } + Map subclassReplacements; try { subclassReplacements = TypeCast.checkedCast( @@ -117,7 +133,7 @@ JAXBContextImpl.JAXBContextBuilder builder = new JAXBContextImpl.JAXBContextBuilder(); builder.setClasses(classes); - builder.setTypeRefs(Collections.emptyList()); + builder.setTypeRefs(tr); builder.setSubclassReplacements(subclassReplacements); builder.setDefaultNsUri(defaultNsUri); builder.setC14NSupport(c14nSupport); @@ -127,6 +143,7 @@ builder.setRetainPropertyInfo(retainPropertyInfo); builder.setSupressAccessorWarnings(supressAccessorWarnings); builder.setImprovedXsiTypeHandling(improvedXsiTypeHandling); + builder.setDisableSecurityProcessing(disablesecurityProcessing); return builder.build(); } @@ -144,6 +161,22 @@ return type.cast(o); } + /** + * + * @param classes + * @param typeRefs + * @param subclassReplacements + * @param defaultNsUri + * @param c14nSupport + * @param ar + * @param xmlAccessorFactorySupport + * @param allNillable + * @param retainPropertyInfo + * @return + * @throws JAXBException + * @deprecated use createContext(Class[] classes, Map properties) method instead + */ + @Deprecated public static JAXBRIContext createContext( Class[] classes, Collection typeRefs, Map subclassReplacements, String defaultNsUri, boolean c14nSupport, RuntimeAnnotationReader ar, @@ -154,6 +187,23 @@ allNillable, retainPropertyInfo, false); } + /** + * + * @param classes + * @param typeRefs + * @param subclassReplacements + * @param defaultNsUri + * @param c14nSupport + * @param ar + * @param xmlAccessorFactorySupport + * @param allNillable + * @param retainPropertyInfo + * @param improvedXsiTypeHandling + * @return + * @throws JAXBException + * @deprecated use createContext( Class[] classes, Map properties) method instead + */ + @Deprecated public static JAXBRIContext createContext( Class[] classes, Collection typeRefs, Map subclassReplacements, String defaultNsUri, boolean c14nSupport, RuntimeAnnotationReader ar,