diff options
author | Denis S. Fokin <Denis.Fokin@gmail.com> | 2015-10-29 13:37:00 +0300 |
---|---|---|
committer | Denis S. Fokin <Denis.Fokin@gmail.com> | 2015-10-29 13:37:00 +0300 |
commit | 9389123be60012b8e9716416906a3fa1493ccee9 (patch) | |
tree | 142754c23c6463201f7cdc87f0a66399d191cefa | |
parent | 949e8d3d0130ce1690e6a465cb32edcc9e2e7906 (diff) | |
parent | 5f1c2b6af630c8807f51a2b69d032769cb846a75 (diff) | |
download | jdk8u_jaxws-9389123be60012b8e9716416906a3fa1493ccee9.tar.gz |
Merge with default before merge with jdk8u60
--HG--
branch : 8u40-verified-fixes
37 files changed, 430 insertions, 320 deletions
@@ -309,6 +309,70 @@ a3b85d6097c52cbff3e514ad6dc4f705fbaaa8bb jdk8u20-b18 31d43d250c836c13fcc87025837783788c5cd0de jdk8u20-b21 2d360fb1b2b89c90133231f9ed5f823997b70c19 jdk8u20-b22 f3bf1b270fea8b17aa2846f962f7514b6f772ab4 jdk8u20-b23 +1277c0d492fd9253f1ea2730eb160953397bd939 jdk8u20-b24 +1277c0d492fd9253f1ea2730eb160953397bd939 jdk8u20-b25 +7025a2c10ea4116ce8f31bb1e305f732aa1025f0 jdk8u20-b26 +7053deda0ffd69046ef480b3595cf13451b477ec jdk8u20-b31 +2f39063fee48f96fe9cacf704ce30c6fc333ae73 jdk8u20-b32 +efc85d318f4697f40bdd1f3757677be97f1758d9 jdk8u25-b00 +a76779e1b0376650dfc29a1f3b14760f05e0fc6d jdk8u25-b01 +3d31955043b9f1807c9d695c7b5d604d11c132cf jdk8u25-b02 +c67cb85b249c69a96d7ac72734c35bc18644befe jdk8u25-b03 +81129354f0e821f3d41dbcf8a68ce82f9d776127 jdk8u25-b04 +5f78130b0a64df9568a827f9ea589fdc3a7c080c jdk8u25-b05 +433da54f73257545d95edbc356fdb0e37a9d95eb jdk8u25-b06 +cccfc3f8dec888c8fe86c212a51af2fba1e11aef jdk8u25-b07 +c758be4c3cac65a2744bf4e7ed9bdabb85234de2 jdk8u25-b08 +73423d29fe362e843cdccad510e2e44e2899bc9e jdk8u25-b09 +391b45e0081afcf3db709878916063a63dca7b05 jdk8u25-b10 +57cd66833abf44f499faaaed2c16bdf94b258ca9 jdk8u25-b11 +56b97127afa66fa01eec0fcf467a77cd2e445b4f jdk8u25-b12 +0ebb9d8c3dd49559b716f02825924801be55b3e7 jdk8u25-b13 +392a9579cc95d27806c1dde16eee776524a49761 jdk8u25-b14 +d3a96bbb88521188a3af1a34dd9523f13afa521d jdk8u25-b15 +4570a7d00aa9bd3df028f52d6f9d8c434163b689 jdk8u25-b16 +d47a47f961ee423ce03623098f62d79254c6f328 jdk8u25-b17 +cb0ad90bfe3c497c7236c5480447c4bde110934f jdk8u25-b18 +a345282d661be80f2cdee3c43e12fbe01e7ff6d5 jdk8u25-b31 +3a676fe898c93ad3afcaa55a71da96455e5f230e jdk8u31-b00 +1c73ca9179f22d4a73d1a248a3254f891c71ee30 jdk8u31-b01 +c1f1ed28e0bb68d7536fb30bb6f1a3623816b12a jdk8u31-b02 +31893650acaf8935ad395d04cbc1575bada97622 jdk8u31-b03 +60ee8e1e63aee861ea7606c5825c15209bb10aa2 jdk8u31-b04 +e4e3070ba39416ea1f20a6583276117c5498466f jdk8u31-b05 +90cd67a6b6e5e4db93155cc0260a94b55b35bc74 jdk8u31-b06 +06807f9a68358f9684ab59b249760ba2b47cc07b jdk8u31-b07 +45193c5ae26d67cd3dc6961506d8c06803ff646c jdk8u31-b08 +9a310a2276f9a01822b3cfc91268a67cbaaafd0a jdk8u31-b09 +dd0467f3fe130884849ad8fb226d76f02b4cbde4 jdk8u31-b10 +497c783d228ed188d61964edd409794af3ad3e5c jdk8u31-b11 +959e8fca46155528c8147da69a7c49edfb002cb1 jdk8u31-b12 +9d0c737694ece23547c0a27dcd0ba6cbcdf577f2 jdk8u31-b13 31d43d250c836c13fcc87025837783788c5cd0de jdk8u40-b00 262fb5353ffa661f88b4a9cf2581fcad8c2a43f7 jdk8u40-b01 8043f77ef8a4ded9505269a356c4e2f4f9604cd9 jdk8u40-b02 +27bcab54f36afc2340adf525fa2a8de1b1c356ca jdk8u40-b03 +127fb2a65ca6d09bb59ff8030aac11c67f3da4d8 jdk8u40-b04 +b904fcd66860c2b069493f989b3347241266407d jdk8u40-b05 +52ae3094de1ec6974ff0250b8cabc13f110290d1 jdk8u40-b06 +3857b4b27e22cfd3f970cd77ed1a41d44444202f jdk8u40-b07 +304ea93428f83d55a558a76ebbcc318d07c03fbe jdk8u40-b08 +26529be4ae77192acf99c867f0c2a75a7ad71f28 jdk8u40-b09 +337fb10bc4da77f31b3ba3049d45180a8c215f97 jdk8u40-b10 +475f12001625b16230f29a96b6371b3cd2e955dd jdk8u40-b11 +d78fb9203a2782842810ff0197f2ce92d364a8ea jdk8u40-b12 +42a61f4bdca3f7f919b7f8aeb5cad961dc2d1660 jdk8u40-b13 +d22a374ce8569a89301b6c07301e0a803af024e7 jdk8u40-b14 +a278e39ba58d104d0731db5ab5ea6cedf3084a1d jdk8u40-b15 +8893690584dac2df7cc2e9b0a5ffe107266a160b jdk8u40-b16 +83c4d5aca2ff8fd0c6b2a7091018b71313371176 jdk8u40-b17 +fa07311627d085f1307f55298f59463bcf55db02 jdk8u40-b18 +c8b402c28fe51e25f3298e1266f2ae48bda8d3e0 jdk8u40-b19 +a21c4edfdf4402f027183ac8c8aac2db49df3b7d jdk8u40-b20 +16485a38b6bc762b363f4e439047486742fbcfcb jdk8u40-b21 +6e928fd9152541eddf25694be89eb881434a5c5f jdk8u40-b22 +b6755a463ccf6a79b1e1a43ed7bdb1c5cb1ac17d jdk8u40-b23 +5fbbfd66643edb81cfa0688825d698dcc5f2eb11 jdk8u40-b24 +b6120aaf2aeef7c5608d578e15e82db7eb24fb2e jdk8u40-b25 +1bcb30bdd9883cc7fc1bf70800ea03a4429eaa80 jdk8u40-b26 +a5f2cdedb940511674e153dce8d3cbc3a0598c9e jdk8u40-b27 diff --git a/THIRD_PARTY_README b/THIRD_PARTY_README index 6d1c60f2..c34ce6b3 100644 --- a/THIRD_PARTY_README +++ b/THIRD_PARTY_README @@ -3385,7 +3385,7 @@ with JRE 8, JDK 8, and OpenJDK 8. included with JRE 8, JDK 8, and OpenJDK 8. Apache Commons Math 3.2 - Apache Derby 10.10.1.3 + Apache Derby 10.11.1.2 Apache Jakarta BCEL 5.1 Apache Jakarta Regexp 1.4 Apache Santuario XML Security for Java 1.5.4 diff --git a/src/share/jaxws_classes/com/sun/tools/internal/xjc/model/nav/Utils.java b/src/share/jaxws_classes/com/sun/tools/internal/xjc/model/nav/Utils.java index 556bf4f1..3c1f5bdf 100644 --- a/src/share/jaxws_classes/com/sun/tools/internal/xjc/model/nav/Utils.java +++ b/src/share/jaxws_classes/com/sun/tools/internal/xjc/model/nav/Utils.java @@ -38,6 +38,9 @@ import java.util.logging.Logger; /** * Utils class. + * + * WARNING: If you are doing any changes don't forget to change other Utils classes in different packages. + * * Has *package private* access to avoid inappropriate usage. */ final class Utils { @@ -51,17 +54,20 @@ final class Utils { static { // we statically initializing REFLECTION_NAVIGATOR property try { - Class refNav = Class.forName("com.sun.xml.internal.bind.v2.model.nav.ReflectionNavigator"); - //noinspection unchecked - final Method getInstance = refNav.getDeclaredMethod("getInstance"); + final Class refNav = Class.forName("com.sun.xml.internal.bind.v2.model.nav.ReflectionNavigator"); // requires accessClassInPackage privilege - AccessController.doPrivileged( - new PrivilegedAction<Object>() { + final Method getInstance = AccessController.doPrivileged( + new PrivilegedAction<Method>() { @Override - public Object run() { - getInstance.setAccessible(true); - return null; + public Method run() { + try { + Method getInstance = refNav.getDeclaredMethod("getInstance"); + getInstance.setAccessible(true); + return getInstance; + } catch (NoSuchMethodException e) { + throw new IllegalStateException("ReflectionNavigator.getInstance can't be found"); + } } } ); @@ -69,16 +75,10 @@ final class Utils { //noinspection unchecked REFLECTION_NAVIGATOR = (Navigator<Type, Class, Field, Method>) getInstance.invoke(null); } catch (ClassNotFoundException e) { - e.printStackTrace(); throw new IllegalStateException("Can't find ReflectionNavigator class"); } catch (InvocationTargetException e) { - e.printStackTrace(); throw new IllegalStateException("ReflectionNavigator.getInstance throws the exception"); - } catch (NoSuchMethodException e) { - e.printStackTrace(); - throw new IllegalStateException("ReflectionNavigator.getInstance can't be found"); } catch (IllegalAccessException e) { - e.printStackTrace(); throw new IllegalStateException("ReflectionNavigator.getInstance method is inaccessible"); } catch (SecurityException e) { LOGGER.log(Level.FINE, "Unable to access ReflectionNavigator.getInstance", e); diff --git a/src/share/jaxws_classes/com/sun/xml/internal/bind/api/Utils.java b/src/share/jaxws_classes/com/sun/xml/internal/bind/api/Utils.java index db753600..cbb7a0a7 100644 --- a/src/share/jaxws_classes/com/sun/xml/internal/bind/api/Utils.java +++ b/src/share/jaxws_classes/com/sun/xml/internal/bind/api/Utils.java @@ -38,6 +38,9 @@ import java.util.logging.Logger; /** * Utils class. + * + * WARNING: If you are doing any changes don't forget to change other Utils classes in different packages. + * * Has *package private* access to avoid inappropriate usage. */ final class Utils { @@ -51,17 +54,20 @@ final class Utils { static { // we statically initializing REFLECTION_NAVIGATOR property try { - Class refNav = Class.forName("com.sun.xml.internal.bind.v2.model.nav.ReflectionNavigator"); - //noinspection unchecked - final Method getInstance = refNav.getDeclaredMethod("getInstance"); + final Class refNav = Class.forName("com.sun.xml.internal.bind.v2.model.nav.ReflectionNavigator"); // requires accessClassInPackage privilege - AccessController.doPrivileged( - new PrivilegedAction<Object>() { + final Method getInstance = AccessController.doPrivileged( + new PrivilegedAction<Method>() { @Override - public Object run() { - getInstance.setAccessible(true); - return null; + public Method run() { + try { + Method getInstance = refNav.getDeclaredMethod("getInstance"); + getInstance.setAccessible(true); + return getInstance; + } catch (NoSuchMethodException e) { + throw new IllegalStateException("ReflectionNavigator.getInstance can't be found"); + } } } ); @@ -69,16 +75,10 @@ final class Utils { //noinspection unchecked REFLECTION_NAVIGATOR = (Navigator<Type, Class, Field, Method>) getInstance.invoke(null); } catch (ClassNotFoundException e) { - e.printStackTrace(); throw new IllegalStateException("Can't find ReflectionNavigator class"); } catch (InvocationTargetException e) { - e.printStackTrace(); throw new IllegalStateException("ReflectionNavigator.getInstance throws the exception"); - } catch (NoSuchMethodException e) { - e.printStackTrace(); - throw new IllegalStateException("ReflectionNavigator.getInstance can't be found"); } catch (IllegalAccessException e) { - e.printStackTrace(); throw new IllegalStateException("ReflectionNavigator.getInstance method is inaccessible"); } catch (SecurityException e) { LOGGER.log(Level.FINE, "Unable to access ReflectionNavigator.getInstance", e); diff --git a/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/model/impl/RuntimeBuiltinLeafInfoImpl.java b/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/model/impl/RuntimeBuiltinLeafInfoImpl.java index 9db4aa80..434d3d94 100644 --- a/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/model/impl/RuntimeBuiltinLeafInfoImpl.java +++ b/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/model/impl/RuntimeBuiltinLeafInfoImpl.java @@ -43,6 +43,8 @@ import java.net.MalformedURLException; import java.net.URI; import java.net.URISyntaxException; import java.net.URL; +import java.security.AccessController; +import java.security.PrivilegedAction; import java.util.ArrayList; import java.util.Calendar; import java.util.Collections; @@ -197,7 +199,15 @@ public abstract class RuntimeBuiltinLeafInfoImpl<T> extends BuiltinLeafInfoImpl< static { - QName[] qnames = (System.getProperty(MAP_ANYURI_TO_URI) == null) ? new QName[] { + String MAP_ANYURI_TO_URI_VALUE = AccessController.doPrivileged( + new PrivilegedAction<String>() { + @Override + public String run() { + return System.getProperty(MAP_ANYURI_TO_URI); + } + } + ); + QName[] qnames = (MAP_ANYURI_TO_URI_VALUE == null) ? new QName[] { createXS("string"), createXS("anySimpleType"), createXS("normalizedString"), @@ -310,7 +320,7 @@ public abstract class RuntimeBuiltinLeafInfoImpl<T> extends BuiltinLeafInfoImpl< return v.toExternalForm(); } }); - if (System.getProperty(MAP_ANYURI_TO_URI) == null) { + if (MAP_ANYURI_TO_URI_VALUE == null) { secondaryList.add( new StringImpl<URI>(URI.class, createXS("string")) { public URI parse(CharSequence text) throws SAXException { @@ -774,17 +784,18 @@ public abstract class RuntimeBuiltinLeafInfoImpl<T> extends BuiltinLeafInfoImpl< } }); primaryList.add( - new StringImpl<BigDecimal>(BigDecimal.class, - createXS("decimal") + new StringImpl<BigDecimal>(BigDecimal.class, + createXS("decimal") ) { - public BigDecimal parse(CharSequence text) { - return DatatypeConverterImpl._parseDecimal(text.toString()); - } + public BigDecimal parse(CharSequence text) { + return DatatypeConverterImpl._parseDecimal(text.toString()); + } - public String print(BigDecimal v) { - return DatatypeConverterImpl._printDecimal(v); + public String print(BigDecimal v) { + return DatatypeConverterImpl._printDecimal(v); + } } - }); + ); primaryList.add( new StringImpl<QName>(QName.class, createXS("QName") @@ -812,7 +823,7 @@ public abstract class RuntimeBuiltinLeafInfoImpl<T> extends BuiltinLeafInfoImpl< w.getNamespaceContext().declareNamespace(v.getNamespaceURI(),v.getPrefix(),false); } }); - if (System.getProperty(MAP_ANYURI_TO_URI) != null) { + if (MAP_ANYURI_TO_URI_VALUE != null) { primaryList.add( new StringImpl<URI>(URI.class, createXS("anyURI")) { public URI parse(CharSequence text) throws SAXException { @@ -830,16 +841,17 @@ public abstract class RuntimeBuiltinLeafInfoImpl<T> extends BuiltinLeafInfoImpl< }); } primaryList.add( - new StringImpl<Duration>(Duration.class, createXS("duration")) { - public String print(Duration duration) { - return duration.toString(); - } + new StringImpl<Duration>(Duration.class, createXS("duration")) { + public String print(Duration duration) { + return duration.toString(); + } - public Duration parse(CharSequence lexical) { - TODO.checkSpec("JSR222 Issue #42"); - return DatatypeConverterImpl.getDatatypeFactory().newDuration(lexical.toString()); + public Duration parse(CharSequence lexical) { + TODO.checkSpec("JSR222 Issue #42"); + return DatatypeConverterImpl.getDatatypeFactory().newDuration(lexical.toString()); + } } - }); + ); primaryList.add( new StringImpl<Void>(Void.class) { // 'void' binding isn't defined by the spec, but when the JAX-RPC processes user-defined diff --git a/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/model/impl/Utils.java b/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/model/impl/Utils.java index 10cbc94c..4255bfcd 100644 --- a/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/model/impl/Utils.java +++ b/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/model/impl/Utils.java @@ -38,6 +38,9 @@ import java.util.logging.Logger; /** * Utils class. + * + * WARNING: If you are doing any changes don't forget to change other Utils classes in different packages. + * * Has *package private* access to avoid inappropriate usage. */ final class Utils { @@ -51,17 +54,20 @@ final class Utils { static { // we statically initializing REFLECTION_NAVIGATOR property try { - Class refNav = Class.forName("com.sun.xml.internal.bind.v2.model.nav.ReflectionNavigator"); - //noinspection unchecked - final Method getInstance = refNav.getDeclaredMethod("getInstance"); + final Class refNav = Class.forName("com.sun.xml.internal.bind.v2.model.nav.ReflectionNavigator"); // requires accessClassInPackage privilege - AccessController.doPrivileged( - new PrivilegedAction<Object>() { + final Method getInstance = AccessController.doPrivileged( + new PrivilegedAction<Method>() { @Override - public Object run() { - getInstance.setAccessible(true); - return null; + public Method run() { + try { + Method getInstance = refNav.getDeclaredMethod("getInstance"); + getInstance.setAccessible(true); + return getInstance; + } catch (NoSuchMethodException e) { + throw new IllegalStateException("ReflectionNavigator.getInstance can't be found"); + } } } ); @@ -69,16 +75,10 @@ final class Utils { //noinspection unchecked REFLECTION_NAVIGATOR = (Navigator<Type, Class, Field, Method>) getInstance.invoke(null); } catch (ClassNotFoundException e) { - e.printStackTrace(); throw new IllegalStateException("Can't find ReflectionNavigator class"); } catch (InvocationTargetException e) { - e.printStackTrace(); throw new IllegalStateException("ReflectionNavigator.getInstance throws the exception"); - } catch (NoSuchMethodException e) { - e.printStackTrace(); - throw new IllegalStateException("ReflectionNavigator.getInstance can't be found"); } catch (IllegalAccessException e) { - e.printStackTrace(); throw new IllegalStateException("ReflectionNavigator.getInstance method is inaccessible"); } catch (SecurityException e) { LOGGER.log(Level.FINE, "Unable to access ReflectionNavigator.getInstance", e); diff --git a/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/ArrayBeanInfoImpl.java b/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/ArrayBeanInfoImpl.java index 431e9222..4cef4dde 100644 --- a/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/ArrayBeanInfoImpl.java +++ b/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/ArrayBeanInfoImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2011, 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 @@ -79,19 +79,19 @@ final class ArrayBeanInfoImpl extends JaxBeanInfo { @Override public void startElement(UnmarshallingContext.State state, TagName ea) { - state.target = new ArrayList(); + state.setTarget(new ArrayList()); } @Override public void leaveElement(UnmarshallingContext.State state, TagName ea) { - state.target = toArray((List)state.target); + state.setTarget(toArray((List)state.getTarget())); } @Override public void childElement(UnmarshallingContext.State state, TagName ea) throws SAXException { if(ea.matches("","item")) { - state.loader = itemLoader; - state.receiver = this; + state.setLoader(itemLoader); + state.setReceiver(this); } else { super.childElement(state,ea); } @@ -103,9 +103,9 @@ final class ArrayBeanInfoImpl extends JaxBeanInfo { } public void receive(UnmarshallingContext.State state, Object o) { - ((List)state.target).add(o); + ((List)state.getTarget()).add(o); } - }; + } protected Object toArray( List list ) { int len = list.size(); diff --git a/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/ContentHandlerAdaptor.java b/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/ContentHandlerAdaptor.java index f399c811..7b7081d3 100644 --- a/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/ContentHandlerAdaptor.java +++ b/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/ContentHandlerAdaptor.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2011, 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 @@ -25,10 +25,6 @@ package com.sun.xml.internal.bind.v2.runtime; -import java.io.IOException; - -import javax.xml.stream.XMLStreamException; - import com.sun.istack.internal.FinalArrayList; import com.sun.istack.internal.SAXException2; @@ -36,6 +32,9 @@ import org.xml.sax.Attributes; import org.xml.sax.SAXException; import org.xml.sax.helpers.DefaultHandler; +import javax.xml.stream.XMLStreamException; +import java.io.IOException; + /** * Receives SAX2 events and send the equivalent events to * {@link XMLSerializer} @@ -70,14 +69,14 @@ final class ContentHandlerAdaptor extends DefaultHandler { private boolean containsPrefixMapping(String prefix, String uri) { for( int i=0; i<prefixMap.size(); i+=2 ) { if(prefixMap.get(i).equals(prefix) - && prefixMap.get(i+1).equals(uri)) + && prefixMap.get(i+1).equals(uri)) return true; } return false; } public void startElement(String namespaceURI, String localName, String qName, Attributes atts) - throws SAXException { + throws SAXException { try { flushText(); @@ -92,13 +91,13 @@ final class ContentHandlerAdaptor extends DefaultHandler { serializer.startElement(namespaceURI,localName, p,null); // declare namespace events - for( int i=0; i<prefixMap.size(); i+=2 ) { + for (int i = 0; i < prefixMap.size(); i += 2) { // forcibly set this binding, instead of using declareNsUri. // this guarantees that namespaces used in DOM will show up // as-is in the marshalled output (instead of reassigned to something else, // which may happen if you'd use declareNsUri.) serializer.getNamespaceContext().force( - prefixMap.get(i+1), prefixMap.get(i) ); + prefixMap.get(i + 1), prefixMap.get(i)); } // make sure namespaces needed by attributes are bound for( int i=0; i<len; i++ ) { @@ -108,7 +107,7 @@ final class ContentHandlerAdaptor extends DefaultHandler { String prefix = getPrefix(qname); serializer.getNamespaceContext().declareNamespace( - atts.getURI(i), prefix, true ); + atts.getURI(i), prefix, true ); } serializer.endNamespaceDecls(null); @@ -128,9 +127,10 @@ final class ContentHandlerAdaptor extends DefaultHandler { } } + // make sure namespaces needed by attributes are bound private String getPrefix(String qname) { int idx = qname.indexOf(':'); - String prefix = (idx==-1)?qname:qname.substring(0,idx); + String prefix = (idx == -1) ? "" : qname.substring(0, idx); return prefix; } diff --git a/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/ElementBeanInfoImpl.java b/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/ElementBeanInfoImpl.java index a2b96889..58bcbdf5 100644 --- a/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/ElementBeanInfoImpl.java +++ b/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/ElementBeanInfoImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2011, 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 @@ -208,8 +208,8 @@ public final class ElementBeanInfoImpl extends JaxBeanInfo<JAXBElement> { @Override public final void startElement(UnmarshallingContext.State state, TagName ea) throws SAXException { - state.loader = core; - state.intercepter = this; + state.setLoader(core); + state.setIntercepter(this); // TODO: make sure there aren't too many duplicate of this code // create the object to unmarshal @@ -231,21 +231,21 @@ public final class ElementBeanInfoImpl extends JaxBeanInfo<JAXBElement> { fireBeforeUnmarshal(ElementBeanInfoImpl.this, child, state); context.recordOuterPeer(child); - UnmarshallingContext.State p = state.prev; - p.backup = p.target; - p.target = child; + UnmarshallingContext.State p = state.getPrev(); + p.setBackup(p.getTarget()); + p.setTarget(child); core.startElement(state,ea); } public Object intercept(UnmarshallingContext.State state, Object o) throws SAXException { - JAXBElement e = (JAXBElement)state.target; - state.target = state.backup; - state.backup = null; + JAXBElement e = (JAXBElement)state.getTarget(); + state.setTarget(state.getBackup()); + state.setBackup(null); - if (state.nil) { + if (state.isNil()) { e.setNil(true); - state.nil = false; + state.setNil(false); } if(o!=null) diff --git a/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/Utils.java b/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/Utils.java index 0b9601fd..ad94478f 100644 --- a/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/Utils.java +++ b/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/Utils.java @@ -38,6 +38,9 @@ import java.util.logging.Logger; /** * Utils class. + * + * WARNING: If you are doing any changes don't forget to change other Utils classes in different packages. + * * Has *package private* access to avoid inappropriate usage. */ final class Utils { @@ -51,17 +54,20 @@ final class Utils { static { // we statically initializing REFLECTION_NAVIGATOR property try { - Class refNav = Class.forName("com.sun.xml.internal.bind.v2.model.nav.ReflectionNavigator"); - //noinspection unchecked - final Method getInstance = refNav.getDeclaredMethod("getInstance"); + final Class refNav = Class.forName("com.sun.xml.internal.bind.v2.model.nav.ReflectionNavigator"); // requires accessClassInPackage privilege - AccessController.doPrivileged( - new PrivilegedAction<Object>() { + final Method getInstance = AccessController.doPrivileged( + new PrivilegedAction<Method>() { @Override - public Object run() { - getInstance.setAccessible(true); - return null; + public Method run() { + try { + Method getInstance = refNav.getDeclaredMethod("getInstance"); + getInstance.setAccessible(true); + return getInstance; + } catch (NoSuchMethodException e) { + throw new IllegalStateException("ReflectionNavigator.getInstance can't be found"); + } } } ); @@ -69,16 +75,10 @@ final class Utils { //noinspection unchecked REFLECTION_NAVIGATOR = (Navigator<Type, Class, Field, Method>) getInstance.invoke(null); } catch (ClassNotFoundException e) { - e.printStackTrace(); throw new IllegalStateException("Can't find ReflectionNavigator class"); } catch (InvocationTargetException e) { - e.printStackTrace(); throw new IllegalStateException("ReflectionNavigator.getInstance throws the exception"); - } catch (NoSuchMethodException e) { - e.printStackTrace(); - throw new IllegalStateException("ReflectionNavigator.getInstance can't be found"); } catch (IllegalAccessException e) { - e.printStackTrace(); throw new IllegalStateException("ReflectionNavigator.getInstance method is inaccessible"); } catch (SecurityException e) { LOGGER.log(Level.FINE, "Unable to access ReflectionNavigator.getInstance", e); diff --git a/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/ValueListBeanInfoImpl.java b/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/ValueListBeanInfoImpl.java index c4dd4780..4ce08973 100644 --- a/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/ValueListBeanInfoImpl.java +++ b/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/ValueListBeanInfoImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2011, 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 @@ -90,7 +90,7 @@ final class ValueListBeanInfoImpl extends JaxBeanInfo { idx = p; } - state.target = toArray(r); + state.setTarget(toArray(r)); } }; diff --git a/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/property/ArrayERProperty.java b/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/property/ArrayERProperty.java index 8e2b0c33..aaa286ee 100644 --- a/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/property/ArrayERProperty.java +++ b/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/property/ArrayERProperty.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2011, 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 @@ -98,7 +98,7 @@ abstract class ArrayERProperty<BeanT,ListT,ItemT> extends ArrayProperty<BeanT,Li UnmarshallingContext context = state.getContext(); context.startScope(1); // inherit the target so that our children can access its target - state.target = state.prev.target; + state.setTarget(state.getPrev().getTarget()); // start it now, so that even if there's no children we can still return empty collection context.getScope(0).start(acc,lister); @@ -116,8 +116,8 @@ abstract class ArrayERProperty<BeanT,ListT,ItemT> extends ArrayProperty<BeanT,Li super.childElement(state,ea); return; } - state.loader = child.loader; - state.receiver = child.receiver; + state.setLoader(child.loader); + state.setReceiver(child.receiver); } @Override diff --git a/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/property/SingleMapNodeProperty.java b/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/property/SingleMapNodeProperty.java index 82420725..5ae4bba5 100644 --- a/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/property/SingleMapNodeProperty.java +++ b/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/property/SingleMapNodeProperty.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2011, 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 @@ -148,18 +148,18 @@ final class SingleMapNodeProperty<BeanT,ValueT extends Map> extends PropertyImpl public void startElement(UnmarshallingContext.State state, TagName ea) throws SAXException { // create or obtain the Map object try { - target.set((BeanT)state.prev.target); + target.set((BeanT)state.getPrev().getTarget()); map.set(acc.get(target.get())); depthCounter++; if(map.get() == null) { map.set(ClassFactory.create(mapImplClass)); } map.get().clear(); - state.target = map.get(); + state.setTarget(map.get()); } catch (AccessorException e) { // recover from error by setting a dummy Map that receives and discards the values handleGenericException(e,true); - state.target = new HashMap(); + state.setTarget(new HashMap()); } } @@ -180,7 +180,7 @@ final class SingleMapNodeProperty<BeanT,ValueT extends Map> extends PropertyImpl @Override public void childElement(UnmarshallingContext.State state, TagName ea) throws SAXException { if(ea.matches(entryTag)) { - state.loader = entryLoader; + state.setLoader(entryLoader); } else { super.childElement(state,ea); } @@ -200,26 +200,26 @@ final class SingleMapNodeProperty<BeanT,ValueT extends Map> extends PropertyImpl private final Loader entryLoader = new Loader(false) { @Override public void startElement(UnmarshallingContext.State state, TagName ea) { - state.target = new Object[2]; // this is inefficient + state.setTarget(new Object[2]); // this is inefficient } @Override public void leaveElement(UnmarshallingContext.State state, TagName ea) { - Object[] keyValue = (Object[])state.target; - Map map = (Map) state.prev.target; + Object[] keyValue = (Object[])state.getTarget(); + Map map = (Map) state.getPrev().getTarget(); map.put(keyValue[0],keyValue[1]); } @Override public void childElement(UnmarshallingContext.State state, TagName ea) throws SAXException { if(ea.matches(keyTag)) { - state.loader = keyLoader; - state.receiver = keyReceiver; + state.setLoader(keyLoader); + state.setReceiver(keyReceiver); return; } if(ea.matches(valueTag)) { - state.loader = valueLoader; - state.receiver = valueReceiver; + state.setLoader(valueLoader); + state.setReceiver(valueReceiver); return; } super.childElement(state,ea); @@ -237,7 +237,7 @@ final class SingleMapNodeProperty<BeanT,ValueT extends Map> extends PropertyImpl this.index = index; } public void receive(UnmarshallingContext.State state, Object o) { - ((Object[])state.target)[index] = o; + ((Object[])state.getTarget())[index] = o; } } diff --git a/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/property/Utils.java b/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/property/Utils.java index 69eaa2a9..c6f9b842 100644 --- a/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/property/Utils.java +++ b/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/property/Utils.java @@ -38,6 +38,9 @@ import java.util.logging.Logger; /** * Utils class. + * + * WARNING: If you are doing any changes don't forget to change other Utils classes in different packages. + * * Has *package private* access to avoid inappropriate usage. */ final class Utils { @@ -51,17 +54,20 @@ final class Utils { static { // we statically initializing REFLECTION_NAVIGATOR property try { - Class refNav = Class.forName("com.sun.xml.internal.bind.v2.model.nav.ReflectionNavigator"); - //noinspection unchecked - final Method getInstance = refNav.getDeclaredMethod("getInstance"); + final Class refNav = Class.forName("com.sun.xml.internal.bind.v2.model.nav.ReflectionNavigator"); // requires accessClassInPackage privilege - AccessController.doPrivileged( - new PrivilegedAction<Object>() { + final Method getInstance = AccessController.doPrivileged( + new PrivilegedAction<Method>() { @Override - public Object run() { - getInstance.setAccessible(true); - return null; + public Method run() { + try { + Method getInstance = refNav.getDeclaredMethod("getInstance"); + getInstance.setAccessible(true); + return getInstance; + } catch (NoSuchMethodException e) { + throw new IllegalStateException("ReflectionNavigator.getInstance can't be found"); + } } } ); @@ -69,16 +75,10 @@ final class Utils { //noinspection unchecked REFLECTION_NAVIGATOR = (Navigator<Type, Class, Field, Method>) getInstance.invoke(null); } catch (ClassNotFoundException e) { - e.printStackTrace(); throw new IllegalStateException("Can't find ReflectionNavigator class"); } catch (InvocationTargetException e) { - e.printStackTrace(); throw new IllegalStateException("ReflectionNavigator.getInstance throws the exception"); - } catch (NoSuchMethodException e) { - e.printStackTrace(); - throw new IllegalStateException("ReflectionNavigator.getInstance can't be found"); } catch (IllegalAccessException e) { - e.printStackTrace(); throw new IllegalStateException("ReflectionNavigator.getInstance method is inaccessible"); } catch (SecurityException e) { LOGGER.log(Level.FINE, "Unable to access ReflectionNavigator.getInstance", e); diff --git a/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/reflect/Accessor.java b/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/reflect/Accessor.java index 4493d994..7923cab2 100644 --- a/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/reflect/Accessor.java +++ b/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/reflect/Accessor.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2011, 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 @@ -148,7 +148,7 @@ public abstract class Accessor<BeanT, ValueT> implements Receiver { public void receive(UnmarshallingContext.State state, Object o) throws SAXException { try { - set((BeanT) state.target, (ValueT) o); + set((BeanT) state.getTarget(), (ValueT) o); } catch (AccessorException e) { Loader.handleGenericException(e, true); } catch (IllegalAccessError iae) { diff --git a/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/reflect/Utils.java b/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/reflect/Utils.java index 384d3675..66598a14 100644 --- a/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/reflect/Utils.java +++ b/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/reflect/Utils.java @@ -38,6 +38,9 @@ import java.util.logging.Logger; /** * Utils class. + * + * WARNING: If you are doing any changes don't forget to change other Utils classes in different packages. + * * Has *package private* access to avoid inappropriate usage. */ final class Utils { @@ -51,17 +54,20 @@ final class Utils { static { // we statically initializing REFLECTION_NAVIGATOR property try { - Class refNav = Class.forName("com.sun.xml.internal.bind.v2.model.nav.ReflectionNavigator"); - //noinspection unchecked - final Method getInstance = refNav.getDeclaredMethod("getInstance"); + final Class refNav = Class.forName("com.sun.xml.internal.bind.v2.model.nav.ReflectionNavigator"); // requires accessClassInPackage privilege - AccessController.doPrivileged( - new PrivilegedAction<Object>() { + final Method getInstance = AccessController.doPrivileged( + new PrivilegedAction<Method>() { @Override - public Object run() { - getInstance.setAccessible(true); - return null; + public Method run() { + try { + Method getInstance = refNav.getDeclaredMethod("getInstance"); + getInstance.setAccessible(true); + return getInstance; + } catch (NoSuchMethodException e) { + throw new IllegalStateException("ReflectionNavigator.getInstance can't be found"); + } } } ); @@ -69,16 +75,10 @@ final class Utils { //noinspection unchecked REFLECTION_NAVIGATOR = (Navigator<Type, Class, Field, Method>) getInstance.invoke(null); } catch (ClassNotFoundException e) { - e.printStackTrace(); throw new IllegalStateException("Can't find ReflectionNavigator class"); } catch (InvocationTargetException e) { - e.printStackTrace(); throw new IllegalStateException("ReflectionNavigator.getInstance throws the exception"); - } catch (NoSuchMethodException e) { - e.printStackTrace(); - throw new IllegalStateException("ReflectionNavigator.getInstance can't be found"); } catch (IllegalAccessException e) { - e.printStackTrace(); throw new IllegalStateException("ReflectionNavigator.getInstance method is inaccessible"); } catch (SecurityException e) { LOGGER.log(Level.FINE, "Unable to access ReflectionNavigator.getInstance", e); diff --git a/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/DefaultValueLoaderDecorator.java b/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/DefaultValueLoaderDecorator.java index 8ec39ca0..bfa62502 100644 --- a/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/DefaultValueLoaderDecorator.java +++ b/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/DefaultValueLoaderDecorator.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2011, 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 @@ -44,10 +44,10 @@ public final class DefaultValueLoaderDecorator extends Loader { @Override public void startElement(UnmarshallingContext.State state, TagName ea) throws SAXException { // install the default value, but don't override the one given by the parent loader - if(state.elementDefaultValue==null) - state.elementDefaultValue = defaultValue; + if(state.getElementDefaultValue() == null) + state.setElementDefaultValue(defaultValue); - state.loader = l; + state.setLoader(l); l.startElement(state,ea); } } diff --git a/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/Discarder.java b/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/Discarder.java index aebb713e..931bec71 100644 --- a/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/Discarder.java +++ b/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/Discarder.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2011, 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 @@ -44,8 +44,8 @@ public final class Discarder extends Loader { @Override public void childElement(UnmarshallingContext.State state, TagName ea) { - state.target = null; + state.setTarget(null); // registering this allows the discarder to process the whole subtree. - state.loader = this; + state.setLoader(this); } } diff --git a/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/DomLoader.java b/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/DomLoader.java index 29cfa4ad..30c8d755 100644 --- a/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/DomLoader.java +++ b/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/DomLoader.java @@ -1,5 +1,5 @@ /* - * 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 @@ -99,10 +99,10 @@ public class DomLoader<ResultT extends Result> extends Loader { @Override public void startElement(UnmarshallingContext.State state, TagName ea) throws SAXException { UnmarshallingContext context = state.getContext(); - if (state.target == null) - state.target = new State(context); + if (state.getTarget() == null) + state.setTarget(new State(context)); - State s = (State) state.target; + State s = (State) state.getTarget(); try { s.declarePrefixes(context, context.getNewlyDeclaredPrefixes()); s.handler.startElement(ea.uri, ea.local, ea.getQname(), ea.atts); @@ -114,10 +114,10 @@ public class DomLoader<ResultT extends Result> extends Loader { @Override public void childElement(UnmarshallingContext.State state, TagName ea) throws SAXException { - state.loader = this; - State s = (State) state.prev.target; + state.setLoader(this); + State s = (State) state.getPrev().getTarget(); s.depth++; - state.target = s; + state.setTarget(s); } @Override @@ -125,7 +125,7 @@ public class DomLoader<ResultT extends Result> extends Loader { if(text.length()==0) return; // there's no point in creating an empty Text node in DOM. try { - State s = (State) state.target; + State s = (State) state.getTarget(); s.handler.characters(text.toString().toCharArray(),0,text.length()); } catch( SAXException e ) { state.getContext().handleError(e); @@ -135,7 +135,7 @@ public class DomLoader<ResultT extends Result> extends Loader { @Override public void leaveElement(UnmarshallingContext.State state, TagName ea) throws SAXException { - State s = (State) state.target; + State s = (State) state.getTarget(); UnmarshallingContext context = state.getContext(); try { @@ -157,7 +157,7 @@ public class DomLoader<ResultT extends Result> extends Loader { } // we are done - state.target = s.getElement(); + state.setTarget(s.getElement()); } } diff --git a/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/LeafPropertyLoader.java b/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/LeafPropertyLoader.java index f7ff0f01..300f5f33 100644 --- a/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/LeafPropertyLoader.java +++ b/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/LeafPropertyLoader.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2011, 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 @@ -47,7 +47,7 @@ public class LeafPropertyLoader extends Loader { public void text(UnmarshallingContext.State state, CharSequence text) throws SAXException { try { - xacc.parse(state.prev.target,text); + xacc.parse(state.getPrev().getTarget(), text); } catch (AccessorException e) { handleGenericException(e,true); } catch (RuntimeException e) { diff --git a/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/LeafPropertyXsiLoader.java b/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/LeafPropertyXsiLoader.java index 8354632d..5c13bf34 100644 --- a/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/LeafPropertyXsiLoader.java +++ b/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/LeafPropertyXsiLoader.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2011, 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 @@ -55,9 +55,9 @@ public final class LeafPropertyXsiLoader extends Loader { @Override public void startElement(UnmarshallingContext.State state, TagName ea) throws SAXException { - state.loader = selectLoader(state, ea); - - state.loader.startElement(state, ea); + final Loader loader = selectLoader(state, ea); + state.setLoader(loader); + loader.startElement(state, ea); } protected Loader selectLoader(UnmarshallingContext.State state, TagName ea) throws SAXException { diff --git a/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/Loader.java b/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/Loader.java index 9c9ccea3..f3d6c859 100644 --- a/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/Loader.java +++ b/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/Loader.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2011, 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 @@ -88,8 +88,8 @@ public abstract class Loader { public void childElement(UnmarshallingContext.State state, TagName ea) throws SAXException { // notify the error, then recover by ignoring the whole element. reportUnexpectedChildElement(ea, true); - state.loader = Discarder.INSTANCE; - state.receiver = null; + state.setLoader(Discarder.INSTANCE); + state.setReceiver(null); } @SuppressWarnings({"StringEquality"}) @@ -195,10 +195,10 @@ public abstract class Loader { UnmarshallingContext context = state.getContext(); Unmarshaller.Listener listener = context.parent.getListener(); if(beanInfo.hasBeforeUnmarshalMethod()) { - beanInfo.invokeBeforeUnmarshalMethod(context.parent, child, state.prev.target); + beanInfo.invokeBeforeUnmarshalMethod(context.parent, child, state.getPrev().getTarget()); } if(listener!=null) { - listener.beforeUnmarshal(child, state.prev.target); + listener.beforeUnmarshal(child, state.getPrev().getTarget()); } } } @@ -215,10 +215,10 @@ public abstract class Loader { UnmarshallingContext context = state.getContext(); Unmarshaller.Listener listener = context.parent.getListener(); if(beanInfo.hasAfterUnmarshalMethod()) { - beanInfo.invokeAfterUnmarshalMethod(context.parent, child, state.target); + beanInfo.invokeAfterUnmarshalMethod(context.parent, child, state.getTarget()); } if(listener!=null) - listener.afterUnmarshal(child, state.target); + listener.afterUnmarshal(child, state.getTarget()); } } diff --git a/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/ProxyLoader.java b/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/ProxyLoader.java index 466a8863..67adf61e 100644 --- a/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/ProxyLoader.java +++ b/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/ProxyLoader.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2011, 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 @@ -41,7 +41,7 @@ public abstract class ProxyLoader extends Loader { @Override public final void startElement(UnmarshallingContext.State state, TagName ea) throws SAXException { Loader loader = selectLoader(state,ea); - state.loader = loader; + state.setLoader(loader); loader.startElement(state,ea); } diff --git a/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/SAXConnector.java b/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/SAXConnector.java index 44998166..a7e9abc6 100644 --- a/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/SAXConnector.java +++ b/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/SAXConnector.java @@ -1,5 +1,5 @@ /* - * 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 @@ -144,17 +144,7 @@ public final class SAXConnector implements UnmarshallerHandler { if( qname==null || qname.length()==0 ) qname=local; - - boolean ignorable = true; - StructureLoader sl; - - // not null only if element content is processed (StructureLoader is used) - // ugly - if((sl = this.context.getStructureLoader()) != null) { - ignorable = ((ClassBeanInfoImpl)sl.getBeanInfo()).hasElementOnlyContentModel(); - } - - processText(ignorable); + processText(!context.getCurrentState().isMixed()); tagName.uri = uri; tagName.local = local; @@ -204,7 +194,7 @@ public final class SAXConnector implements UnmarshallerHandler { } private void processText( boolean ignorable ) throws SAXException { - if( predictor.expectText() && (!ignorable || !WhiteSpaceProcessor.isWhiteSpace(buffer))) + if (predictor.expectText() && (!ignorable || !WhiteSpaceProcessor.isWhiteSpace(buffer))) next.text(buffer); buffer.setLength(0); } diff --git a/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/Scope.java b/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/Scope.java index 4b8392ba..bfd98e9b 100644 --- a/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/Scope.java +++ b/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/Scope.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2011, 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 @@ -97,7 +97,7 @@ public final class Scope<BeanT,PropT,ItemT,PackT> { public void add( Accessor<BeanT,PropT> acc, Lister<BeanT,PropT,ItemT,PackT> lister, ItemT value) throws SAXException{ try { if(!hasStarted()) { - this.bean = (BeanT)context.getCurrentState().target; + this.bean = (BeanT)context.getCurrentState().getTarget(); this.acc = acc; this.lister = lister; this.pack = lister.startPacking(bean,acc); @@ -121,7 +121,7 @@ public final class Scope<BeanT,PropT,ItemT,PackT> { public void start( Accessor<BeanT,PropT> acc, Lister<BeanT,PropT,ItemT,PackT> lister) throws SAXException{ try { if(!hasStarted()) { - this.bean = (BeanT)context.getCurrentState().target; + this.bean = (BeanT)context.getCurrentState().getTarget(); this.acc = acc; this.lister = lister; this.pack = lister.startPacking(bean,acc); diff --git a/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/StAXStreamConnector.java b/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/StAXStreamConnector.java index 3b6af482..a3b51b05 100644 --- a/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/StAXStreamConnector.java +++ b/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/StAXStreamConnector.java @@ -70,7 +70,7 @@ class StAXStreamConnector extends StAXConnector { // Quick hack until SJSXP fixes 6270116 boolean isZephyr = readerClass.getName().equals("com.sun.xml.internal.stream.XMLReaderImpl"); if (getBoolProp(reader,"org.codehaus.stax2.internNames") && - getBoolProp(reader,"org.codehaus.stax2.internNsUris")) + getBoolProp(reader,"org.codehaus.stax2.internNsUris")) ; // no need for interning else if (isZephyr) @@ -219,8 +219,8 @@ class StAXStreamConnector extends StAXConnector { int nsCount = staxStreamReader.getNamespaceCount(); for (int i = 0; i < nsCount; i++) { visitor.startPrefixMapping( - fixNull(staxStreamReader.getNamespacePrefix(i)), - fixNull(staxStreamReader.getNamespaceURI(i))); + fixNull(staxStreamReader.getNamespacePrefix(i)), + fixNull(staxStreamReader.getNamespaceURI(i))); } // fire startElement @@ -310,13 +310,13 @@ class StAXStreamConnector extends StAXConnector { protected void handleCharacters() throws XMLStreamException, SAXException { if( predictor.expectText() ) buffer.append( - staxStreamReader.getTextCharacters(), - staxStreamReader.getTextStart(), - staxStreamReader.getTextLength() ); + staxStreamReader.getTextCharacters(), + staxStreamReader.getTextStart(), + staxStreamReader.getTextLength() ); } private void processText( boolean ignorable ) throws SAXException { - if( predictor.expectText() && (!ignorable || !WhiteSpaceProcessor.isWhiteSpace(buffer))) { + if( predictor.expectText() && (!ignorable || !WhiteSpaceProcessor.isWhiteSpace(buffer) || context.getCurrentState().isMixed())) { if(textReported) { textReported = false; } else { diff --git a/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/StructureLoader.java b/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/StructureLoader.java index 203e8549..0d4fa264 100644 --- a/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/StructureLoader.java +++ b/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/StructureLoader.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2011, 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 @@ -172,7 +172,7 @@ public final class StructureLoader extends Loader { context.recordInnerPeer(child); - state.target = child; + state.setTarget(child); fireBeforeUnmarshal(beanInfo, child, state); @@ -197,7 +197,7 @@ public final class StructureLoader extends Loader { String qname = atts.getQName(i); if(atts.getURI(i).equals(WellKnownNamespace.XML_SCHEMA_INSTANCE)) continue; // xsi:* attributes are meant to be processed by us, not by user apps. - Object o = state.target; + Object o = state.getTarget(); Map<QName,String> map = attCatchAll.get(o); if(map==null) { // TODO: use ClassFactory.inferImplClass(sig,knownImplClasses) @@ -250,8 +250,8 @@ public final class StructureLoader extends Loader { } } - state.loader = child.loader; - state.receiver = child.receiver; + state.setLoader(child.loader); + state.setReceiver(child.receiver); } @Override @@ -273,7 +273,7 @@ public final class StructureLoader extends Loader { @Override public void leaveElement(UnmarshallingContext.State state, TagName ea) throws SAXException { state.getContext().endScope(frameSize); - fireAfterUnmarshal(beanInfo, state.target, state.prev); + fireAfterUnmarshal(beanInfo, state.getTarget(), state.getPrev()); } private static final QNameMap<TransducedAccessor> EMPTY = new QNameMap<TransducedAccessor>(); diff --git a/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/TextLoader.java b/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/TextLoader.java index c6fb5543..a482ae6a 100644 --- a/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/TextLoader.java +++ b/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/TextLoader.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2011, 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 @@ -51,7 +51,7 @@ public class TextLoader extends Loader { public void text(UnmarshallingContext.State state, CharSequence text) throws SAXException { try { - state.target = xducer.parse(text); + state.setTarget(xducer.parse(text)); } catch (AccessorException e) { handleGenericException(e,true); } catch (RuntimeException e) { diff --git a/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/UnmarshallingContext.java b/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/UnmarshallingContext.java index 35519196..c51d4fe3 100644 --- a/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/UnmarshallingContext.java +++ b/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/UnmarshallingContext.java @@ -1,5 +1,5 @@ /* - * 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 @@ -35,8 +35,6 @@ import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.concurrent.Callable; -import java.util.logging.Level; -import java.util.logging.Logger; import javax.xml.XMLConstants; import javax.xml.bind.JAXBElement; @@ -198,20 +196,19 @@ public final class UnmarshallingContext extends Coordinator /** * Loader that owns this element. */ - public Loader loader; + private Loader loader; /** * Once {@link #loader} is completed, this receiver * receives the result. */ - public Receiver receiver; - - public Intercepter intercepter; + private Receiver receiver; + private Intercepter intercepter; /** * Object being unmarshalled by this {@link #loader}. */ - public Object target; + private Object target; /** * Hack for making JAXBElement unmarshalling work. @@ -240,7 +237,7 @@ public final class UnmarshallingContext extends Coordinator * @see ElementBeanInfoImpl.IntercepterLoader#startElement(State, TagName) * @see ElementBeanInfoImpl.IntercepterLoader#intercept(State, Object) */ - public Object backup; + private Object backup; /** * Number of {@link UnmarshallingContext#nsBind}s declared thus far. @@ -256,17 +253,22 @@ public final class UnmarshallingContext extends Coordinator * or by a child {@link Loader} when * {@link Loader#startElement(State, TagName)} is called. */ - public String elementDefaultValue; + private String elementDefaultValue; /** * {@link State} for the parent element * * {@link State} objects form a doubly linked list. */ - public State prev; + private State prev; private State next; - public boolean nil = false; + private boolean nil = false; + + /** + * specifies that we are working with mixed content + */ + private boolean mixed = false; /** * Gets the context. @@ -280,6 +282,8 @@ public final class UnmarshallingContext extends Coordinator this.prev = prev; if (prev!=null) { prev.next = this; + if (prev.mixed) // parent is in mixed mode + this.mixed = true; } } @@ -289,7 +293,7 @@ public final class UnmarshallingContext extends Coordinator } if (next==null) { assert current == this; - allocateMoreStates(); + next = new State(this); } nil = false; State n = next; @@ -304,11 +308,71 @@ public final class UnmarshallingContext extends Coordinator assert prev!=null; loader = null; nil = false; + mixed = false; receiver = null; intercepter = null; elementDefaultValue = null; target = null; current = prev; + next = null; + } + + public boolean isMixed() { + return mixed; + } + + public Object getTarget() { + return target; + } + + public void setLoader(Loader loader) { + if (loader instanceof StructureLoader) // set mixed mode + mixed = !((StructureLoader)loader).getBeanInfo().hasElementOnlyContentModel(); + this.loader = loader; + } + + public void setReceiver(Receiver receiver) { + this.receiver = receiver; + } + + public State getPrev() { + return prev; + } + + public void setIntercepter(Intercepter intercepter) { + this.intercepter = intercepter; + } + + public void setBackup(Object backup) { + this.backup = backup; + } + + public void setTarget(Object target) { + this.target = target; + } + + public Object getBackup() { + return backup; + } + + public boolean isNil() { + return nil; + } + + public void setNil(boolean nil) { + this.nil = nil; + } + + public Loader getLoader() { + return loader; + } + + public String getElementDefaultValue() { + return elementDefaultValue; + } + + public void setElementDefaultValue(String elementDefaultValue) { + this.elementDefaultValue = elementDefaultValue; } } @@ -348,7 +412,6 @@ public final class UnmarshallingContext extends Coordinator this.parent = _parent; this.assoc = assoc; this.root = this.current = new State(null); - allocateMoreStates(); } public void reset(InfosetScanner scanner,boolean isInplaceMode, JaxBeanInfo expectedType, IDResolver idResolver) { @@ -395,23 +458,6 @@ public final class UnmarshallingContext extends Coordinator return null; } - /** - * Allocates a few more {@link State}s. - * - * Allocating multiple {@link State}s at once allows those objects - * to be allocated near each other, which reduces the working set - * of CPU. It improves the chance the relevant data is in the cache. - */ - private void allocateMoreStates() { - // this method should be used only when we run out of a state. - assert current.next==null; - - State s = current; - for (int i=0; i<8; i++) { - s = new State(s); - } - } - public void clearStates() { State last = current; while (last.next != null) last = last.next; @@ -515,16 +561,15 @@ public final class UnmarshallingContext extends Coordinator @Override public void text(CharSequence pcdata) throws SAXException { - State cur = current; pushCoordinator(); try { - if(cur.elementDefaultValue!=null) { - if(pcdata.length()==0) { + if (current.elementDefaultValue != null) { + if (pcdata.length() == 0) { // send the default value into the unmarshaller instead - pcdata = cur.elementDefaultValue; + pcdata = current.elementDefaultValue; } } - cur.loader.text(cur,pcdata); + current.loader.text(current, pcdata); } finally { popCoordinator(); } diff --git a/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/ValuePropertyLoader.java b/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/ValuePropertyLoader.java index f8e591b6..1bc81f0d 100644 --- a/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/ValuePropertyLoader.java +++ b/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/ValuePropertyLoader.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2011, 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 @@ -49,18 +49,17 @@ public class ValuePropertyLoader extends Loader { public void text(UnmarshallingContext.State state, CharSequence text) throws SAXException { try { - xacc.parse(state.target,text); + xacc.parse(state.getTarget(),text); } catch (AccessorException e) { handleGenericException(e,true); } catch (RuntimeException e) { - if(state.prev != null) { - if(state.prev.target instanceof JAXBElement) { - ; // do nothing - issue 601 - don't report exceptions like - // NumberFormatException when unmarshalling "nillable" element - // (I suppose JAXBElement indicates this - } else { + if(state.getPrev() != null) { + if (!(state.getPrev().getTarget() instanceof JAXBElement)) handleParseConversionException(state,e); - } + // else + // do nothing - issue 601 - don't report exceptions like + // NumberFormatException when unmarshalling "nillable" element + // (I suppose JAXBElement indicates this } else { handleParseConversionException(state,e); } diff --git a/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/XsiNilLoader.java b/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/XsiNilLoader.java index 6247f020..c01acf34 100644 --- a/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/XsiNilLoader.java +++ b/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/XsiNilLoader.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2011, 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 @@ -62,7 +62,7 @@ public class XsiNilLoader extends ProxyLoader { onNil(state); boolean hasOtherAttributes = (ea.atts.getLength() - 1) > 0; // see issues 6759703 and 565 - need to preserve attributes even if the element is nil; only when the type is stored in JAXBElement - if (!(hasOtherAttributes && (state.prev.target instanceof JAXBElement))) { + if (!(hasOtherAttributes && (state.getPrev().getTarget() instanceof JAXBElement))) { return Discarder.INSTANCE; } } @@ -96,8 +96,8 @@ public class XsiNilLoader extends ProxyLoader { @Override protected void onNil(UnmarshallingContext.State state) throws SAXException { try { - acc.set(state.prev.target,null); - state.prev.nil = true; + acc.set(state.getPrev().getTarget(),null); + state.getPrev().setNil(true); } catch (AccessorException e) { handleGenericException(e,true); } @@ -113,7 +113,7 @@ public class XsiNilLoader extends ProxyLoader { @Override protected void onNil(UnmarshallingContext.State state) { // let the receiver add this to the lister - state.target = null; + state.setTarget(null); } } } diff --git a/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/XsiTypeLoader.java b/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/XsiTypeLoader.java index f35a3f52..654f1940 100644 --- a/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/XsiTypeLoader.java +++ b/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/XsiTypeLoader.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2010, 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 @@ -61,7 +61,7 @@ public class XsiTypeLoader extends Loader { beanInfo = defaultBeanInfo; Loader loader = beanInfo.getLoader(null,false); - state.loader = loader; + state.setLoader(loader); loader.startElement(state,ea); } diff --git a/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/util/XmlFactory.java b/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/util/XmlFactory.java index 1bcae09e..c2cbe154 100644 --- a/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/util/XmlFactory.java +++ b/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/util/XmlFactory.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 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 @@ -25,8 +25,10 @@ package com.sun.xml.internal.bind.v2.util; -import com.sun.xml.internal.bind.Util; import com.sun.xml.internal.bind.v2.Messages; + +import java.security.AccessController; +import java.security.PrivilegedAction; import java.util.logging.Level; import java.util.logging.Logger; import javax.xml.XMLConstants; @@ -43,8 +45,6 @@ import org.xml.sax.SAXException; import org.xml.sax.SAXNotRecognizedException; import org.xml.sax.SAXNotSupportedException; -import static com.sun.xml.internal.bind.Util.getSystemProperty; - /** * Provides helper methods for creating properly configured XML parser * factory instances with namespace support turned on and configured for @@ -68,7 +68,14 @@ public class XmlFactory { */ private static final String DISABLE_XML_SECURITY = "com.sun.xml.internal.bind.disableXmlSecurity"; - public static final boolean XML_SECURITY_DISABLED = Boolean.parseBoolean(getSystemProperty(DISABLE_XML_SECURITY)); + private static final boolean XML_SECURITY_DISABLED = AccessController.doPrivileged( + new PrivilegedAction<Boolean>() { + @Override + public Boolean run() { + return Boolean.getBoolean(DISABLE_XML_SECURITY); + } + } + ); private static boolean isXMLSecurityDisabled(boolean runtimeSetting) { return XML_SECURITY_DISABLED || runtimeSetting; diff --git a/src/share/jaxws_classes/com/sun/xml/internal/ws/model/Utils.java b/src/share/jaxws_classes/com/sun/xml/internal/ws/model/Utils.java index 9310bf83..02d9c959 100644 --- a/src/share/jaxws_classes/com/sun/xml/internal/ws/model/Utils.java +++ b/src/share/jaxws_classes/com/sun/xml/internal/ws/model/Utils.java @@ -54,17 +54,20 @@ final class Utils { static { // we statically initializing REFLECTION_NAVIGATOR property try { - Class refNav = Class.forName("com.sun.xml.internal.bind.v2.model.nav.ReflectionNavigator"); - //noinspection unchecked - final Method getInstance = refNav.getDeclaredMethod("getInstance"); + final Class refNav = Class.forName("com.sun.xml.internal.bind.v2.model.nav.ReflectionNavigator"); // requires accessClassInPackage privilege - AccessController.doPrivileged( - new PrivilegedAction<Object>() { + final Method getInstance = AccessController.doPrivileged( + new PrivilegedAction<Method>() { @Override - public Object run() { - getInstance.setAccessible(true); - return null; + public Method run() { + try { + Method getInstance = refNav.getDeclaredMethod("getInstance"); + getInstance.setAccessible(true); + return getInstance; + } catch (NoSuchMethodException e) { + throw new IllegalStateException("ReflectionNavigator.getInstance can't be found"); + } } } ); @@ -72,16 +75,10 @@ final class Utils { //noinspection unchecked REFLECTION_NAVIGATOR = (Navigator<Type, Class, Field, Method>) getInstance.invoke(null); } catch (ClassNotFoundException e) { - e.printStackTrace(); throw new IllegalStateException("Can't find ReflectionNavigator class"); } catch (InvocationTargetException e) { - e.printStackTrace(); throw new IllegalStateException("ReflectionNavigator.getInstance throws the exception"); - } catch (NoSuchMethodException e) { - e.printStackTrace(); - throw new IllegalStateException("ReflectionNavigator.getInstance can't be found"); } catch (IllegalAccessException e) { - e.printStackTrace(); throw new IllegalStateException("ReflectionNavigator.getInstance method is inaccessible"); } catch (SecurityException e) { LOGGER.log(Level.FINE, "Unable to access ReflectionNavigator.getInstance", e); diff --git a/src/share/jaxws_classes/com/sun/xml/internal/ws/spi/ProviderImpl.java b/src/share/jaxws_classes/com/sun/xml/internal/ws/spi/ProviderImpl.java index 30f5a7d8..1c897967 100644 --- a/src/share/jaxws_classes/com/sun/xml/internal/ws/spi/ProviderImpl.java +++ b/src/share/jaxws_classes/com/sun/xml/internal/ws/spi/ProviderImpl.java @@ -147,19 +147,12 @@ public class ProviderImpl extends Provider { } public EndpointReference readEndpointReference(final Source eprInfoset) { - // EPR constructors are private, so we need privilege escalation. - // this unmarshalling can only access instances of a fixed, known set of classes, - // so doing that shouldn't introduce security vulnerability. - return AccessController.doPrivileged(new PrivilegedAction<EndpointReference>() { - public EndpointReference run() { - try { - Unmarshaller unmarshaller = eprjc.get().createUnmarshaller(); - return (EndpointReference) unmarshaller.unmarshal(eprInfoset); - } catch (JAXBException e) { - throw new WebServiceException("Error creating Marshaller or marshalling.", e); - } - } - }); + try { + Unmarshaller unmarshaller = eprjc.get().createUnmarshaller(); + return (EndpointReference) unmarshaller.unmarshal(eprInfoset); + } catch (JAXBException e) { + throw new WebServiceException("Error creating Marshaller or marshalling.", e); + } } public <T> T getPort(EndpointReference endpointReference, Class<T> clazz, WebServiceFeature... webServiceFeatures) { diff --git a/src/share/jaxws_classes/com/sun/xml/internal/ws/spi/db/Utils.java b/src/share/jaxws_classes/com/sun/xml/internal/ws/spi/db/Utils.java index ef40263b..4cdfc9b1 100644 --- a/src/share/jaxws_classes/com/sun/xml/internal/ws/spi/db/Utils.java +++ b/src/share/jaxws_classes/com/sun/xml/internal/ws/spi/db/Utils.java @@ -54,17 +54,20 @@ final class Utils { static { // we statically initializing REFLECTION_NAVIGATOR property try { - Class refNav = Class.forName("com.sun.xml.internal.bind.v2.model.nav.ReflectionNavigator"); - //noinspection unchecked - final Method getInstance = refNav.getDeclaredMethod("getInstance"); + final Class refNav = Class.forName("com.sun.xml.internal.bind.v2.model.nav.ReflectionNavigator"); // requires accessClassInPackage privilege - AccessController.doPrivileged( - new PrivilegedAction<Object>() { + final Method getInstance = AccessController.doPrivileged( + new PrivilegedAction<Method>() { @Override - public Object run() { - getInstance.setAccessible(true); - return null; + public Method run() { + try { + Method getInstance = refNav.getDeclaredMethod("getInstance"); + getInstance.setAccessible(true); + return getInstance; + } catch (NoSuchMethodException e) { + throw new IllegalStateException("ReflectionNavigator.getInstance can't be found"); + } } } ); @@ -72,16 +75,10 @@ final class Utils { //noinspection unchecked REFLECTION_NAVIGATOR = (Navigator<Type, Class, Field, Method>) getInstance.invoke(null); } catch (ClassNotFoundException e) { - e.printStackTrace(); throw new IllegalStateException("Can't find ReflectionNavigator class"); } catch (InvocationTargetException e) { - e.printStackTrace(); throw new IllegalStateException("ReflectionNavigator.getInstance throws the exception"); - } catch (NoSuchMethodException e) { - e.printStackTrace(); - throw new IllegalStateException("ReflectionNavigator.getInstance can't be found"); } catch (IllegalAccessException e) { - e.printStackTrace(); throw new IllegalStateException("ReflectionNavigator.getInstance method is inaccessible"); } catch (SecurityException e) { LOGGER.log(Level.FINE, "Unable to access ReflectionNavigator.getInstance", e); diff --git a/src/share/jaxws_classes/com/sun/xml/internal/ws/util/xml/XmlUtil.java b/src/share/jaxws_classes/com/sun/xml/internal/ws/util/xml/XmlUtil.java index cd87c3b0..10ad6086 100644 --- a/src/share/jaxws_classes/com/sun/xml/internal/ws/util/xml/XmlUtil.java +++ b/src/share/jaxws_classes/com/sun/xml/internal/ws/util/xml/XmlUtil.java @@ -63,6 +63,8 @@ import java.io.InputStream; import java.io.OutputStreamWriter; import java.io.Writer; import java.net.URL; +import java.security.AccessController; +import java.security.PrivilegedAction; import java.util.ArrayList; import java.util.Enumeration; import java.util.Iterator; @@ -84,12 +86,16 @@ public class XmlUtil { private static final Logger LOGGER = Logger.getLogger(XmlUtil.class.getName()); - private static boolean XML_SECURITY_DISABLED; + private static final String DISABLE_XML_SECURITY = "com.sun.xml.internal.ws.disableXmlSecurity"; - static { - String disableXmlSecurity = System.getProperty("com.sun.xml.internal.ws.disableXmlSecurity"); - XML_SECURITY_DISABLED = disableXmlSecurity == null || !Boolean.valueOf(disableXmlSecurity); - } + private static boolean XML_SECURITY_DISABLED = AccessController.doPrivileged( + new PrivilegedAction<Boolean>() { + @Override + public Boolean run() { + return Boolean.getBoolean(DISABLE_XML_SECURITY); + } + } + ); public static String getPrefix(String s) { int i = s.indexOf(':'); |