Mercurial > hg > icedtea8-forest > jaxp
changeset 696:e16be40cfc32 icedtea-3.0.0pre01
Merge jdk8u20-b10
author | andrew |
---|---|
date | Tue, 22 Apr 2014 19:50:41 +0100 |
parents | f1f495f7330b (current diff) c356de7051ea (diff) |
children | d87c12f1e2f3 |
files | .hgtags test/javax/xml/jaxp/parsers/8032909/XSLT.java test/javax/xml/jaxp/parsers/8032909/a_utf16.xml test/javax/xml/jaxp/parsers/8032909/a_utf16.xsl test/javax/xml/jaxp/parsers/8032909/a_utf8.xml test/javax/xml/jaxp/parsers/8032909/a_utf8.xsl test/javax/xml/jaxp/parsers/8032909/a_windows1252.xml test/javax/xml/jaxp/parsers/8032909/a_windows1252.xsl |
diffstat | 15 files changed, 98 insertions(+), 186 deletions(-) [+] |
line wrap: on
line diff
--- a/.hgtags Tue Apr 22 17:15:41 2014 +0100 +++ b/.hgtags Tue Apr 22 19:50:41 2014 +0100 @@ -256,6 +256,22 @@ b68cdb63a70bca7aad284946107d5d8dd1dbc663 jdk8-b127 b1839922f10c0c88dea683590fa093d1d382046c jdk8-b128 b7752cea7c813fb8b1d3bf2e05e8f93331cc7f1d jdk8-b129 +0cb0cd01521845c2d6f5172a9ef1783d4c8bd668 jdk8-b130 +79d8b7fac21d263db5e5ebd3b830a3cf98509541 jdk8-b131 +5993346020d14a1c2c7003588c584366db7921f5 jdk8-b132 +22b63601be6f04fcb2c3b563261f14869954b44a jdk8u5-b01 +bd97ff5f82588c627869218df02a9c2dbb9402d0 jdk8u5-b02 +195b74b3e57905b6d6c9ed9b32139c6781ba7d28 jdk8u5-b03 +106fdcde4b8a6981be13dac34a3de99d6fece97c jdk8u5-b04 +8f859b1b0f0b18ee7e231d6887b18b5721c2404e jdk8u5-b05 +e22bc548b58a695eede0304399777314ae473562 jdk8u5-b06 +0f96584b02b399df706bec2052a7fe48bdc6058b jdk8u5-b07 +bbe60534528d2e8118957aaa74a75bedc1c3819a jdk8u5-b08 +d9b3ef4511434cf55870d42b6caa6a5618bc47ce jdk8u5-b09 +4b32ee8d711251e90ade1d958a51e134c3d387c9 jdk8u5-b10 +c17a827bec287f4c7565c72c195667e52154772b jdk8u5-b11 +0e5317cbe451d57f9ffcbb835de07fe553a8aa34 jdk8u5-b12 +a303ebb338518a716c267b17986634e3574e7cfe jdk8u5-b13 de9ec1246a0c5c0b32ce3818386019fd4a6fceaa jdk8u20-b02 47cdfe271b1e97e5906eb1b96cd7d15f0717a118 jdk8u20-b03 f6742d0cf71201f1ffd0584c1f2990df343bc5eb jdk8u20-b04 @@ -265,3 +281,5 @@ 5993346020d14a1c2c7003588c584366db7921f5 jdk8-b132 7b1a6da8ad82b8f576f21ae0692e825395f8b31b jdk8u20-b06 30b8baceb72bcec111c6aad37eef96d18c09e4ef jdk8u20-b07 +68e2ea32f92731b8ad8157252116db89903b51a3 jdk8u20-b08 +b706e9775bf7512845120740870f717341e2b497 jdk8u20-b09
--- a/THIRD_PARTY_README Tue Apr 22 17:15:41 2014 +0100 +++ b/THIRD_PARTY_README Tue Apr 22 19:50:41 2014 +0100 @@ -1399,13 +1399,13 @@ ------------------------------------------------------------------------------- -%% This notice is provided with respect to Little CMS 2.4, which may be +%% This notice is provided with respect to Little CMS 2.5, which may be included with JRE 8, JDK 8, and OpenJDK 8. --- begin of LICENSE --- Little CMS -Copyright (c) 1998-2010 Marti Maria Saguer +Copyright (c) 1998-2011 Marti Maria Saguer Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal
--- a/src/com/sun/org/apache/xalan/internal/utils/ObjectFactory.java Tue Apr 22 17:15:41 2014 +0100 +++ b/src/com/sun/org/apache/xalan/internal/utils/ObjectFactory.java Tue Apr 22 19:50:41 2014 +0100 @@ -39,8 +39,8 @@ // // Constants // - private static final String XALAN_INTERNAL = "com.sun.org.apache.xalan.internal"; - private static final String XERCES_INTERNAL = "com.sun.org.apache.xerces.internal"; + private static final String JAXP_INTERNAL = "com.sun.org.apache"; + private static final String STAX_INTERNAL = "com.sun.xml.internal"; /** Set to true for debugging */ private static final boolean DEBUG = false; @@ -161,12 +161,8 @@ public static Class<?> findProviderClass(String className, boolean doFallback) throws ClassNotFoundException, ConfigurationError { - if (System.getSecurityManager()!=null) { - return Class.forName(className); - } else { - return findProviderClass (className, + return findProviderClass (className, findClassLoader (), doFallback); - } } /** @@ -181,8 +177,8 @@ SecurityManager security = System.getSecurityManager(); try{ if (security != null){ - if (className.startsWith(XALAN_INTERNAL) || - className.startsWith(XERCES_INTERNAL)) { + if (className.startsWith(JAXP_INTERNAL) || + className.startsWith(STAX_INTERNAL)) { cl = null; } else { final int lastDot = className.lastIndexOf("."); @@ -197,16 +193,7 @@ Class<?> providerClass; if (cl == null) { - // XXX Use the bootstrap ClassLoader. There is no way to - // load a class using the bootstrap ClassLoader that works - // in both JDK 1.1 and Java 2. However, this should still - // work b/c the following should be true: - // - // (cl == null) iff current ClassLoader == null - // - // Thus Class.forName(String) will use the current - // ClassLoader which will be the bootstrap ClassLoader. - providerClass = Class.forName(className); + providerClass = Class.forName(className, false, ObjectFactory.class.getClassLoader()); } else { try { providerClass = cl.loadClass(className);
--- a/src/com/sun/org/apache/xalan/internal/utils/SecuritySupport.java Tue Apr 22 17:15:41 2014 +0100 +++ b/src/com/sun/org/apache/xalan/internal/utils/SecuritySupport.java Tue Apr 22 19:50:41 2014 +0100 @@ -57,7 +57,7 @@ return securitySupport; } - static ClassLoader getContextClassLoader() { + public static ClassLoader getContextClassLoader() { return (ClassLoader) AccessController.doPrivileged(new PrivilegedAction() { public Object run() { ClassLoader cl = null;
--- a/src/com/sun/org/apache/xerces/internal/utils/ObjectFactory.java Tue Apr 22 17:15:41 2014 +0100 +++ b/src/com/sun/org/apache/xerces/internal/utils/ObjectFactory.java Tue Apr 22 19:50:41 2014 +0100 @@ -39,7 +39,8 @@ // // Constants // - private static final String DEFAULT_INTERNAL_CLASSES = "com.sun.org.apache."; + private static final String JAXP_INTERNAL = "com.sun.org.apache"; + private static final String STAX_INTERNAL = "com.sun.xml.internal"; /** Set to true for debugging */ private static final boolean DEBUG = isDebugEnabled(); @@ -175,12 +176,8 @@ public static Class findProviderClass(String className, boolean doFallback) throws ClassNotFoundException, ConfigurationError { - if (System.getSecurityManager()!=null) { - return Class.forName(className); - } else { - return findProviderClass (className, + return findProviderClass (className, findClassLoader (), doFallback); - } } /** * Find a Class using the specified ClassLoader @@ -193,7 +190,8 @@ //restrict the access to package as speicified in java.security policy SecurityManager security = System.getSecurityManager(); if (security != null) { - if (className.startsWith(DEFAULT_INTERNAL_CLASSES)) { + if (className.startsWith(JAXP_INTERNAL) || + className.startsWith(STAX_INTERNAL)) { cl = null; } else { final int lastDot = className.lastIndexOf("."); @@ -205,7 +203,7 @@ Class providerClass; if (cl == null) { //use the bootstrap ClassLoader. - providerClass = Class.forName(className); + providerClass = Class.forName(className, false, ObjectFactory.class.getClassLoader()); } else { try { providerClass = cl.loadClass(className);
--- a/src/com/sun/org/apache/xml/internal/serializer/CharInfo.java Tue Apr 22 17:15:41 2014 +0100 +++ b/src/com/sun/org/apache/xml/internal/serializer/CharInfo.java Tue Apr 22 19:50:41 2014 +0100 @@ -22,6 +22,11 @@ */ package com.sun.org.apache.xml.internal.serializer; +import com.sun.org.apache.xalan.internal.utils.SecuritySupport; +import com.sun.org.apache.xml.internal.serializer.utils.MsgKey; +import com.sun.org.apache.xml.internal.serializer.utils.SystemIDResolver; +import com.sun.org.apache.xml.internal.serializer.utils.Utils; +import com.sun.org.apache.xml.internal.serializer.utils.WrappedRuntimeException; import java.io.BufferedReader; import java.io.InputStream; import java.io.InputStreamReader; @@ -29,19 +34,11 @@ import java.net.URL; import java.util.Enumeration; import java.util.HashMap; +import java.util.Locale; import java.util.PropertyResourceBundle; import java.util.ResourceBundle; -import java.security.AccessController; -import java.security.PrivilegedAction; - import javax.xml.transform.TransformerException; -import com.sun.org.apache.xml.internal.serializer.utils.MsgKey; -import com.sun.org.apache.xml.internal.serializer.utils.SystemIDResolver; -import com.sun.org.apache.xml.internal.serializer.utils.Utils; -import com.sun.org.apache.xml.internal.serializer.utils.WrappedRuntimeException; -import com.sun.org.apache.xalan.internal.utils.ObjectFactory; - /** * This class provides services that tell if a character should have * special treatement, such as entity reference substitution or normalization @@ -176,13 +173,19 @@ // file // 3) try treating the resource a URI - if (internal) { - try { + try { + if (internal) { // Load entity property files by using PropertyResourceBundle, // cause of security issure for applets entities = PropertyResourceBundle.getBundle(entitiesResource); - } catch (Exception e) {} - } + } else { + ClassLoader cl = SecuritySupport.getContextClassLoader(); + if (cl != null) { + entities = PropertyResourceBundle.getBundle(entitiesResource, + Locale.getDefault(), cl); + } + } + } catch (Exception e) {} if (entities != null) { Enumeration keys = entities.getKeys(); @@ -198,6 +201,7 @@ set(S_CARRIAGERETURN); } else { InputStream is = null; + String err = null; // Load user specified resource file by using URL loading, it // requires a valid URI as parameter @@ -205,18 +209,22 @@ if (internal) { is = CharInfo.class.getResourceAsStream(entitiesResource); } else { - ClassLoader cl = ObjectFactory.findClassLoader(); - if (cl == null) { - is = ClassLoader.getSystemResourceAsStream(entitiesResource); - } else { - is = cl.getResourceAsStream(entitiesResource); + ClassLoader cl = SecuritySupport.getContextClassLoader(); + if (cl != null) { + try { + is = cl.getResourceAsStream(entitiesResource); + } catch (Exception e) { + err = e.getMessage(); + } } if (is == null) { try { URL url = new URL(entitiesResource); is = url.openStream(); - } catch (Exception e) {} + } catch (Exception e) { + err = e.getMessage(); + } } } @@ -224,7 +232,7 @@ throw new RuntimeException( Utils.messages.createMessage( MsgKey.ER_RESOURCE_COULD_NOT_FIND, - new Object[] {entitiesResource, entitiesResource})); + new Object[] {entitiesResource, err})); } // Fix Bugzilla#4000: force reading in UTF-8 @@ -456,64 +464,56 @@ return isCleanTextASCII[value]; } -// In the future one might want to use the array directly and avoid -// the method call, but I think the JIT alreay inlines this well enough -// so don't do it (for now) - bjm -// public final boolean[] getASCIIClean() -// { -// return isCleanTextASCII; -// } - - private static CharInfo getCharInfoBasedOnPrivilege( - final String entitiesFileName, final String method, - final boolean internal){ - return (CharInfo) AccessController.doPrivileged( - new PrivilegedAction() { - public Object run() { - return new CharInfo(entitiesFileName, - method, internal);} - }); + /** + * Read an internal resource file that describes the mapping of + * characters to entity references; Construct a CharInfo object. + * + * @param entitiesFileName Name of entities resource file that should + * be loaded, which describes the mapping of characters to entity references. + * @param method the output method type, which should be one of "xml", "html", and "text". + * @return an instance of CharInfo + * + * @xsl.usage internal + */ + static CharInfo getCharInfoInternal(String entitiesFileName, String method) + { + CharInfo charInfo = (CharInfo) m_getCharInfoCache.get(entitiesFileName); + if (charInfo != null) { + return charInfo; + } + + charInfo = new CharInfo(entitiesFileName, method, true); + m_getCharInfoCache.put(entitiesFileName, charInfo); + return charInfo; } /** - * Factory that reads in a resource file that describes the mapping of - * characters to entity references. + * Constructs a CharInfo object using the following process to try reading + * the entitiesFileName parameter: * - * Resource files must be encoded in UTF-8 and have a format like: + * 1) attempt to load it as a ResourceBundle + * 2) try using the class loader to find the specified file + * 3) try opening it as an URI + * + * In case of 2 and 3, the resource file must be encoded in UTF-8 and have the + * following format: * <pre> * # First char # is a comment * Entity numericValue * quot 34 * amp 38 * </pre> - * (Note: Why don't we just switch to .properties files? Oct-01 -sc) * - * @param entitiesResource Name of entities resource file that should - * be loaded, which describes that mapping of characters to entity references. - * @param method the output method type, which should be one of "xml", "html", "text"... - * - * @xsl.usage internal + * @param entitiesFileName Name of entities resource file that should + * be loaded, which describes the mapping of characters to entity references. + * @param method the output method type, which should be one of "xml", "html", and "text". + * @return an instance of CharInfo */ static CharInfo getCharInfo(String entitiesFileName, String method) { - CharInfo charInfo = (CharInfo) m_getCharInfoCache.get(entitiesFileName); - if (charInfo != null) { - return charInfo; - } - - // try to load it internally - cache try { - charInfo = getCharInfoBasedOnPrivilege(entitiesFileName, - method, true); - m_getCharInfoCache.put(entitiesFileName, charInfo); - return charInfo; - } catch (Exception e) {} - - // try to load it externally - do not cache - try { - return getCharInfoBasedOnPrivilege(entitiesFileName, - method, false); + return new CharInfo(entitiesFileName, method, false); } catch (Exception e) {} String absoluteEntitiesFileName; @@ -530,8 +530,7 @@ } } - return getCharInfoBasedOnPrivilege(entitiesFileName, - method, false); + return new CharInfo(absoluteEntitiesFileName, method, false); } /** Table of user-specified char infos. */
--- a/src/com/sun/org/apache/xml/internal/serializer/ToHTMLStream.java Tue Apr 22 17:15:41 2014 +0100 +++ b/src/com/sun/org/apache/xml/internal/serializer/ToHTMLStream.java Tue Apr 22 19:50:41 2014 +0100 @@ -60,7 +60,7 @@ */ private static final CharInfo m_htmlcharInfo = // new CharInfo(CharInfo.HTML_ENTITIES_RESOURCE); - CharInfo.getCharInfo(CharInfo.HTML_ENTITIES_RESOURCE, Method.HTML); + CharInfo.getCharInfoInternal(CharInfo.HTML_ENTITIES_RESOURCE, Method.HTML); /** A digital search trie for fast, case insensitive lookup of ElemDesc objects. */ static final Trie m_elementFlags = new Trie();
--- a/src/com/sun/org/apache/xml/internal/serializer/ToXMLStream.java Tue Apr 22 17:15:41 2014 +0100 +++ b/src/com/sun/org/apache/xml/internal/serializer/ToXMLStream.java Tue Apr 22 19:50:41 2014 +0100 @@ -58,7 +58,7 @@ */ private static CharInfo m_xmlcharInfo = // new CharInfo(CharInfo.XML_ENTITIES_RESOURCE); - CharInfo.getCharInfo(CharInfo.XML_ENTITIES_RESOURCE, Method.XML); + CharInfo.getCharInfoInternal(CharInfo.XML_ENTITIES_RESOURCE, Method.XML); /** * Default constructor.
--- a/test/javax/xml/jaxp/parsers/8032909/XSLT.java Tue Apr 22 17:15:41 2014 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,54 +0,0 @@ -/* - * Copyright (c) 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. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/** - * @test - * @bug 8032909 - * @summary Test for XSLT string-length function with complementary chars - * @compile XSLT.java - * @run main/othervm XSLT a_utf16.xml a_utf16.xsl 1270 - * @run main/othervm XSLT a_utf8.xml a_utf8.xsl 130 - * @run main/othervm XSLT a_windows1252.xml a_windows1252.xsl 200 - */ - -import java.io.ByteArrayOutputStream; -import javax.xml.transform.stream.StreamResult; -import javax.xml.transform.stream.StreamSource; -import javax.xml.transform.Transformer; -import javax.xml.transform.TransformerFactory; - -public class XSLT { - public static void main(String[] args) throws Exception { - - ByteArrayOutputStream resStream = new ByteArrayOutputStream(); - TransformerFactory trf = TransformerFactory.newInstance(); - Transformer tr = trf.newTransformer(new StreamSource(System.getProperty("test.src", ".")+"/"+args[1])); - String res, expectedRes; - tr.transform( new StreamSource(System.getProperty("test.src", ".")+"/"+args[0]), new StreamResult(resStream)); - res = resStream.toString(); - System.out.println("Transformation completed. Result:"+res); - - if (!res.replaceAll("\\s","").equals(args[2])) - throw new RuntimeException("Incorrect transformation result. Expected:"+args[2]+" Observed:"+res); - } -}
--- a/test/javax/xml/jaxp/parsers/8032909/a_utf8.xml Tue Apr 22 17:15:41 2014 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,5 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<testxml> -<Element>UTF-8_Element</Element> -<Element2></Element2> -</testxml>
--- a/test/javax/xml/jaxp/parsers/8032909/a_utf8.xsl Tue Apr 22 17:15:41 2014 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,13 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> - -<xsl:output method="text" /> - -<xsl:template match="Element"> -<xsl:value-of select="string-length(.)"/> -</xsl:template> -<xsl:template match="Element2"> -<xsl:value-of select="string-length(.)"/> -</xsl:template> - -</xsl:stylesheet>
--- a/test/javax/xml/jaxp/parsers/8032909/a_windows1252.xml Tue Apr 22 17:15:41 2014 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,5 +0,0 @@ -<?xml version="1.0" encoding="windows-1252"?> -<testxml> -<Element>Windows-1252_Element</Element> -<Element2></Element2> -</testxml>
--- a/test/javax/xml/jaxp/parsers/8032909/a_windows1252.xsl Tue Apr 22 17:15:41 2014 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,13 +0,0 @@ -<?xml version="1.0" encoding="windows-1252"?> -<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> - -<xsl:output method="text" /> - -<xsl:template match="Element"> -<xsl:value-of select="string-length(.)"/> -</xsl:template> -<xsl:template match="Element2"> -<xsl:value-of select="string-length(.)"/> -</xsl:template> - -</xsl:stylesheet>