Mercurial > hg > release > icedtea6-1.12
view patches/security/20140114/8027201-jaxp_setup.patch @ 3035:c802218a85b1
Add 2014-01-14 CPU fixes
author | Omair Majid <omajid@redhat.com> |
---|---|
date | Tue, 14 Jan 2014 14:58:29 -0500 |
parents | |
children |
line wrap: on
line source
# HG changeset patch # User joehw # Date 1384451244 28800 # Thu Nov 14 09:47:24 2013 -0800 # Node ID 674054141ddda3a76dd6e2cf9405a7928dd89afb # Parent 1502dbf19fe21111593ee0d88f262d0cfd9b359a 8027201: Enhance JAX-P set up Reviewed-by: alanb, dfuchs, lancea, hawtin diff -Nru openjdk/jaxp/drop_included/jaxp_src/src/com/sun/org/apache/xalan/internal/lib/ExsltStrings.java openjdk/jaxp/drop_included/jaxp_src/src/com/sun/org/apache/xalan/internal/lib/ExsltStrings.java --- openjdk/jaxp/drop_included/jaxp_src/src/com/sun/org/apache/xalan/internal/lib/ExsltStrings.java +++ openjdk/jaxp/drop_included/jaxp_src/src/com/sun/org/apache/xalan/internal/lib/ExsltStrings.java @@ -227,7 +227,7 @@ token = str.substring(fromIndex); } - Document doc = DocumentHolder.m_doc; + Document doc = getDocument(); synchronized (doc) { Element element = doc.createElement("token"); @@ -291,7 +291,7 @@ { StringTokenizer lTokenizer = new StringTokenizer(toTokenize, delims); - Document doc = DocumentHolder.m_doc; + Document doc = getDocument(); synchronized (doc) { while (lTokenizer.hasMoreTokens()) @@ -307,7 +307,7 @@ else { - Document doc = DocumentHolder.m_doc; + Document doc = getDocument(); synchronized (doc) { for (int i = 0; i < toTokenize.length(); i++) @@ -329,35 +329,23 @@ { return tokenize(toTokenize, " \t\n\r"); } + /** - * This class is not loaded until first referenced (see Java Language - * Specification by Gosling/Joy/Steele, section 12.4.1) - * - * The static members are created when this class is first referenced, as a - * lazy initialization not needing checking against null or any - * synchronization. - * + * @return an instance of DOM Document */ - private static class DocumentHolder - { - // Reuse the Document object to reduce memory usage. - private static final Document m_doc; - static { - try - { - if (System.getSecurityManager() == null) { - m_doc = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument(); - } else { - m_doc = DocumentBuilderFactory.newInstance(JDK_DEFAULT_DOM, null).newDocumentBuilder().newDocument(); - } + private static Document getDocument() + { + try + { + if (System.getSecurityManager() == null) { + return DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument(); + } else { + return DocumentBuilderFactory.newInstance(JDK_DEFAULT_DOM, null).newDocumentBuilder().newDocument(); } - - catch(ParserConfigurationException pce) - { - throw new com.sun.org.apache.xml.internal.utils.WrappedRuntimeException(pce); - } - + } + catch(ParserConfigurationException pce) + { + throw new com.sun.org.apache.xml.internal.utils.WrappedRuntimeException(pce); } } - } diff -Nru openjdk/jaxp/drop_included/jaxp_src/src/com/sun/org/apache/xalan/internal/lib/Extensions.java openjdk/jaxp/drop_included/jaxp_src/src/com/sun/org/apache/xalan/internal/lib/Extensions.java --- openjdk/jaxp/drop_included/jaxp_src/src/com/sun/org/apache/xalan/internal/lib/Extensions.java +++ openjdk/jaxp/drop_included/jaxp_src/src/com/sun/org/apache/xalan/internal/lib/Extensions.java @@ -114,23 +114,14 @@ // This no longer will work right since the DTM. // Document myDoc = myProcessor.getContextNode().getOwnerDocument(); - try - { - DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); - DocumentBuilder db = dbf.newDocumentBuilder(); - Document myDoc = db.newDocument(); + Document myDoc = getDocument(); - Text textNode = myDoc.createTextNode(textNodeValue); - DocumentFragment docFrag = myDoc.createDocumentFragment(); + Text textNode = myDoc.createTextNode(textNodeValue); + DocumentFragment docFrag = myDoc.createDocumentFragment(); - docFrag.appendChild(textNode); + docFrag.appendChild(textNode); - return new NodeSet(docFrag); - } - catch(ParserConfigurationException pce) - { - throw new com.sun.org.apache.xml.internal.utils.WrappedRuntimeException(pce); - } + return new NodeSet(docFrag); } } @@ -249,8 +240,7 @@ public static NodeList tokenize(String toTokenize, String delims) { - Document doc = DocumentHolder.m_doc; - + Document doc = getDocument(); StringTokenizer lTokenizer = new StringTokenizer(toTokenize, delims); NodeSet resultSet = new NodeSet(); @@ -308,17 +298,7 @@ public static Node checkEnvironment(ExpressionContext myContext) { - Document factoryDocument; - try - { - DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); - DocumentBuilder db = dbf.newDocumentBuilder(); - factoryDocument = db.newDocument(); - } - catch(ParserConfigurationException pce) - { - throw new com.sun.org.apache.xml.internal.utils.WrappedRuntimeException(pce); - } + Document factoryDocument = getDocument(); Node resultNode = null; try @@ -392,34 +372,21 @@ } /** - * This class is not loaded until first referenced (see Java Language - * Specification by Gosling/Joy/Steele, section 12.4.1) - * - * The static members are created when this class is first referenced, as a - * lazy initialization not needing checking against null or any - * synchronization. - * + * @return an instance of DOM Document */ - private static class DocumentHolder - { - // Reuse the Document object to reduce memory usage. - private static final Document m_doc; - static + private static Document getDocument() + { + try { - try - { - if (System.getSecurityManager() == null) { - m_doc = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument(); - } else { - m_doc = DocumentBuilderFactory.newInstance(JDK_DEFAULT_DOM, null).newDocumentBuilder().newDocument(); - } + if (System.getSecurityManager() == null) { + return DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument(); + } else { + return DocumentBuilderFactory.newInstance(JDK_DEFAULT_DOM, null).newDocumentBuilder().newDocument(); } - - catch(ParserConfigurationException pce) - { - throw new com.sun.org.apache.xml.internal.utils.WrappedRuntimeException(pce); - } - + } + catch(ParserConfigurationException pce) + { + throw new com.sun.org.apache.xml.internal.utils.WrappedRuntimeException(pce); } } }