Merge mips64el-jdk8u222-b11

Thu, 05 Sep 2019 18:53:27 +0800

author
aoqi
date
Thu, 05 Sep 2019 18:53:27 +0800
changeset 2013
88fe0ff58268
parent 1990
410b7bf0065c
parent 2012
268ffbdb01e1
child 2014
ce4949393670

Merge

.hgtags file | annotate | diff | comparison | revisions
THIRD_PARTY_README file | annotate | diff | comparison | revisions
src/com/sun/org/apache/xalan/internal/Version.java file | annotate | diff | comparison | revisions
src/com/sun/org/apache/xalan/internal/xsltc/compiler/FunctionAvailableCall.java file | annotate | diff | comparison | revisions
src/com/sun/org/apache/xalan/internal/xsltc/compiler/Sort.java file | annotate | diff | comparison | revisions
src/com/sun/org/apache/xalan/internal/xsltc/dom/AdaptiveResultTreeImpl.java file | annotate | diff | comparison | revisions
src/com/sun/org/apache/xalan/internal/xsltc/runtime/BasisLibrary.java file | annotate | diff | comparison | revisions
src/com/sun/org/apache/xml/internal/dtm/ref/DTMDefaultBase.java file | annotate | diff | comparison | revisions
src/com/sun/org/apache/xml/internal/serializer/ToHTMLStream.java file | annotate | diff | comparison | revisions
src/com/sun/org/apache/xml/internal/serializer/ToStream.java file | annotate | diff | comparison | revisions
src/com/sun/org/apache/xml/internal/serializer/ToTextStream.java file | annotate | diff | comparison | revisions
src/com/sun/org/apache/xml/internal/utils/NodeVector.java file | annotate | diff | comparison | revisions
     1.1 --- a/.hgtags	Thu Sep 05 18:40:51 2019 +0800
     1.2 +++ b/.hgtags	Thu Sep 05 18:53:27 2019 +0800
     1.3 @@ -1004,7 +1004,20 @@
     1.4  a14b334da6a14ff6c800888b31a621671ddedcd4 jdk8u202-b26
     1.5  6c6166477778069fbb8bddda0b2bd490c5165fe4 jdk8u202-ga
     1.6  58a54ab25e5201d29fea1ed1e165c95ce479f5cf jdk8u212-b00
     1.7 +22d26c0a8eb7ddfdbebf835c59b07e8b8da47359 jdk8u222-b00
     1.8  22d26c0a8eb7ddfdbebf835c59b07e8b8da47359 jdk8u212-b01
     1.9  8b263aef666d72459ac637e3ff19554c9fb4e7ca jdk8u212-b02
    1.10 +7dca173f654edf0720e62b72ef750c673bc6ebfe jdk8u212-b03
    1.11 +90f8352e7f0642918735d66c38b3c6c44473691a jdk8u212-b04
    1.12 +7dca173f654edf0720e62b72ef750c673bc6ebfe jdk8u212-ga
    1.13  2c551607d68cf52d8b372765c5a58fbb1ca7e7db mips64el-jdk8u212-b04
    1.14  87045268ed64e3537614da1c4d1090878823da2a mips64el-jdk8u212-b05
    1.15 +c3b532bf906c9a55952a22dd39b42b711411cbc0 jdk8u222-b01
    1.16 +e0ba0b931da8259728a6a14366734b3f1fcb40bc jdk8u222-b02
    1.17 +33e1a4d78f739eab0cedb232cdc4b328d5867d00 jdk8u222-b03
    1.18 +8ea2487d70605fcea46ab51b91911b46f8f5035b jdk8u222-b04
    1.19 +de624afa6e750486bc1ea3e59bf9fb7de24b1379 jdk8u222-b05
    1.20 +e18fe3687a512b39b08d7d8e288b06cfd7e18840 jdk8u222-b06
    1.21 +08cd0a82185d3aaa614d628977e1809d6b4879cf jdk8u222-b07
    1.22 +2b416473fe205b3abea19b8de53d948fbe4f67f1 jdk8u222-b08
    1.23 +60d685ed9d5bb2eb4847d6e6e4237565fe40089b jdk8u222-b09
     2.1 --- a/THIRD_PARTY_README	Thu Sep 05 18:40:51 2019 +0800
     2.2 +++ b/THIRD_PARTY_README	Thu Sep 05 18:53:27 2019 +0800
     2.3 @@ -1612,7 +1612,7 @@
     2.4  
     2.5  -------------------------------------------------------------------------------
     2.6  
     2.7 -%% This notice is provided with respect to GIFLIB 5.1.1 & libungif 4.1.3, 
     2.8 +%% This notice is provided with respect to GIFLIB 5.1.8 & libungif 4.1.3, 
     2.9  which may be included with JRE 8, JDK 8, and OpenJDK 8.
    2.10  
    2.11  --- begin of LICENSE ---
    2.12 @@ -1682,7 +1682,7 @@
    2.13  --- begin of LICENSE ---
    2.14  
    2.15   Mesa 3-D graphics library
    2.16 - Version:  4.1
    2.17 + Version:  5.0
    2.18  
    2.19   Copyright (C) 1999-2002  Brian Paul   All Rights Reserved.
    2.20  
    2.21 @@ -2797,61 +2797,8 @@
    2.22  not be used in advertising or otherwise to promote the sale, use or
    2.23  other dealings in this Software without prior written authorization
    2.24  from the X Consortium.
    2.25 -___________________________
    2.26 -The files in motif/lib/Xm/util included this copyright:mkdirhier.man,
    2.27 -xmkmf.man, chownxterm.c, makeg.man, mergelib.cpp, lndir.man, makestrs.man, 
    2.28 -checktree.c, lndir.c, makestrs.c
    2.29 -Copyright (c) 1993, 1994 X Consortium
    2.30 -
    2.31 -Permission is hereby granted, free of charge, to any person obtaining a
    2.32 -copy of this software and associated documentation files (the "Software"),
    2.33 -to deal in the Software without restriction, including without limitation
    2.34 -the rights to use, copy, modify, merge, publish, distribute, sublicense,
    2.35 -and/or sell copies of the Software, and to permit persons to whom the
    2.36 -Software furnished to do so, subject to the following conditions:
    2.37 -
    2.38 -The above copyright notice and this permission notice shall be included in
    2.39 -all copies or substantial portions of the Software.
    2.40 -
    2.41 -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
    2.42 -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
    2.43 -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
    2.44 -THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
    2.45 -WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
    2.46 -OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
    2.47 -SOFTWARE.
    2.48 -
    2.49 -Except as contained in this notice, the name of the X Consortium shall not
    2.50 -be used in advertising or otherwise to promote the sale, use or other
    2.51 -dealing in this Software without prior written authorization from the
    2.52 -X Consortium.
    2.53 -_____________________________
    2.54 -Xmos_r.h:
    2.55 -/*
    2.56 -Copyright (c) 1996 X Consortium
    2.57 -
    2.58 -Permission is hereby granted, free of charge, to any person obtaining a copy
    2.59 -of this software and associated documentation files (the "Software"), to deal
    2.60 -in the Software without restriction, including without limitation the rights
    2.61 -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
    2.62 -copies of the Software, and to permit persons to whom the Software is
    2.63 -furnished to do so, subject to the following conditions:
    2.64 -
    2.65 -The above copyright notice and this permission notice shall be included in
    2.66 -all copies or substantial portions of the Software.
    2.67 -
    2.68 -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
    2.69 -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
    2.70 -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
    2.71 -X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
    2.72 -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
    2.73 -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
    2.74 -
    2.75 -Except as contained in this notice, the name of the X Consortium shall not be
    2.76 -used in advertising or otherwise to promote the sale, use or other dealings
    2.77 -in this Software without prior written authorization from the X Consortium.
    2.78 -*/
    2.79 -
    2.80 +
    2.81 +--- end of LICENSE ---
    2.82  _____________________________
    2.83  Copyright notice for HPkeysym.h:
    2.84  /*
    2.85 @@ -2906,55 +2853,6 @@
    2.86  performance, or use of this material.
    2.87  
    2.88  */
    2.89 -_____________________________________
    2.90 -Copyright notice in keysym2ucs.h:
    2.91 -
    2.92 -Copyright 1987, 1994, 1998 The Open Group
    2.93 -
    2.94 -Permission to use, copy, modify, distribute, and sell this software and its
    2.95 -documentation for any purpose is hereby granted without fee, provided that
    2.96 -the above copyright notice appear in all copies and that both that
    2.97 -copyright notice and this permission notice appear in supporting
    2.98 -documentation.
    2.99 -
   2.100 -The above copyright notice and this permission notice shall be included
   2.101 -in all copies or substantial portions of the Software.
   2.102 -
   2.103 -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
   2.104 -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
   2.105 -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
   2.106 -IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
   2.107 -OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
   2.108 -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
   2.109 -OTHER DEALINGS IN THE SOFTWARE.
   2.110 -
   2.111 -Except as contained in this notice, the name of The Open Group shall
   2.112 -not be used in advertising or otherwise to promote the sale, use or
   2.113 -other dealings in this Software without prior written authorization
   2.114 -from The Open Group.
   2.115 -
   2.116 -
   2.117 -Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts
   2.118 -
   2.119 -All Rights Reserved
   2.120 -
   2.121 -Permission to use, copy, modify, and distribute this software and its
   2.122 -documentation for any purpose and without fee is hereby granted,
   2.123 -provided that the above copyright notice appear in all copies and that
   2.124 -both that copyright notice and this permission notice appear in
   2.125 -supporting documentation, and that the name of Digital not be
   2.126 -used in advertising or publicity pertaining to distribution of the
   2.127 -software without specific, written prior permission.
   2.128 -
   2.129 -DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
   2.130 -ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
   2.131 -DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
   2.132 -ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
   2.133 -WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
   2.134 -ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
   2.135 -SOFTWARE.
   2.136 -
   2.137 -*/
   2.138  
   2.139  --- end of LICENSE ---
   2.140  
   2.141 @@ -3000,7 +2898,7 @@
   2.142    Apache Jakarta BCEL 5.1 
   2.143    Apache Jakarta Regexp 1.4 
   2.144    Apache Santuario XML Security for Java 1.5.4
   2.145 -  Apache Xalan-Java 2.7.1 
   2.146 +  Apache Xalan-Java 2.7.2
   2.147    Apache Xerces Java 2.10.0 
   2.148    Apache XML Resolver 1.1 
   2.149  
     3.1 --- a/src/com/sun/org/apache/xalan/internal/Version.java	Thu Sep 05 18:40:51 2019 +0800
     3.2 +++ b/src/com/sun/org/apache/xalan/internal/Version.java	Thu Sep 05 18:53:27 2019 +0800
     3.3 @@ -121,7 +121,7 @@
     3.4     */
     3.5    public static int getMaintenanceVersionNum()
     3.6    {
     3.7 -    return 0;
     3.8 +    return 2;
     3.9    }
    3.10  
    3.11    /**
     4.1 --- a/src/com/sun/org/apache/xalan/internal/xsltc/compiler/FunctionAvailableCall.java	Thu Sep 05 18:40:51 2019 +0800
     4.2 +++ b/src/com/sun/org/apache/xalan/internal/xsltc/compiler/FunctionAvailableCall.java	Thu Sep 05 18:53:27 2019 +0800
     4.3 @@ -100,20 +100,19 @@
     4.4       * the specified method is found in the specifed class.
     4.5       */
     4.6      private boolean hasMethods() {
     4.7 -        LiteralExpr arg = (LiteralExpr)_arg;
     4.8  
     4.9          // Get the class name from the namespace uri
    4.10          String className = getClassNameFromUri(_namespaceOfFunct);
    4.11  
    4.12          // Get the method name from the argument to function-available
    4.13          String methodName = null;
    4.14 -        int colonIndex = _nameOfFunct.indexOf(":");
    4.15 +        int colonIndex = _nameOfFunct.indexOf(':');
    4.16          if (colonIndex > 0) {
    4.17            String functionName = _nameOfFunct.substring(colonIndex+1);
    4.18            int lastDotIndex = functionName.lastIndexOf('.');
    4.19            if (lastDotIndex > 0) {
    4.20              methodName = functionName.substring(lastDotIndex+1);
    4.21 -            if (className != null && !className.equals(""))
    4.22 +            if (className != null && className.length() != 0)
    4.23                className = className + "." + functionName.substring(0, lastDotIndex);
    4.24              else
    4.25                className = functionName.substring(0, lastDotIndex);
     5.1 --- a/src/com/sun/org/apache/xalan/internal/xsltc/compiler/Sort.java	Thu Sep 05 18:40:51 2019 +0800
     5.2 +++ b/src/com/sun/org/apache/xalan/internal/xsltc/compiler/Sort.java	Thu Sep 05 18:53:27 2019 +0800
     5.3 @@ -65,7 +65,7 @@
     5.4      private AttributeValue _order;
     5.5      private AttributeValue _caseOrder;
     5.6      private AttributeValue _dataType;
     5.7 -    private String         _lang; // bug! see 26869
     5.8 +    private AttributeValue _lang; // bug! see 26869, see XALANJ-2546
     5.9  
    5.10      private String _className = null;
    5.11      private ArrayList<VariableRefBase> _closureVars = null;
    5.12 @@ -153,13 +153,11 @@
    5.13          }
    5.14          _dataType = AttributeValue.create(this, val, parser);
    5.15  
    5.16 -         _lang =  getAttribute("lang"); // bug! see 26869
    5.17 -  // val =  getAttribute("lang");
    5.18 -  // _lang = AttributeValue.create(this, val, parser);
    5.19 +        val =  getAttribute("lang");
    5.20 +        _lang = AttributeValue.create(this, val, parser);
    5.21          // Get the case order; default is language dependant
    5.22 -    val = getAttribute("case-order");
    5.23 -    _caseOrder = AttributeValue.create(this, val, parser);
    5.24 -
    5.25 +        val = getAttribute("case-order");
    5.26 +        _caseOrder = AttributeValue.create(this, val, parser);
    5.27      }
    5.28  
    5.29      /**
    5.30 @@ -178,6 +176,7 @@
    5.31          _order.typeCheck(stable);
    5.32          _caseOrder.typeCheck(stable);
    5.33          _dataType.typeCheck(stable);
    5.34 +        _lang.typeCheck(stable);
    5.35          return Type.Void;
    5.36      }
    5.37  
    5.38 @@ -195,16 +194,14 @@
    5.39          _order.translate(classGen, methodGen);
    5.40      }
    5.41  
    5.42 -     public void translateCaseOrder(ClassGenerator classGen,
    5.43 +    public void translateCaseOrder(ClassGenerator classGen,
    5.44                     MethodGenerator methodGen) {
    5.45 -    _caseOrder.translate(classGen, methodGen);
    5.46 +        _caseOrder.translate(classGen, methodGen);
    5.47      }
    5.48  
    5.49      public void translateLang(ClassGenerator classGen,
    5.50                     MethodGenerator methodGen) {
    5.51 -    final ConstantPoolGen cpg = classGen.getConstantPool();
    5.52 -    final InstructionList il = methodGen.getInstructionList();
    5.53 -    il.append(new PUSH(cpg, _lang)); // bug! see 26869
    5.54 +        _lang.translate(classGen, methodGen);
    5.55      }
    5.56  
    5.57      /**
     6.1 --- a/src/com/sun/org/apache/xalan/internal/xsltc/dom/AdaptiveResultTreeImpl.java	Thu Sep 05 18:40:51 2019 +0800
     6.2 +++ b/src/com/sun/org/apache/xalan/internal/xsltc/dom/AdaptiveResultTreeImpl.java	Thu Sep 05 18:53:27 2019 +0800
     6.3 @@ -570,7 +570,7 @@
     6.4          if (_openElementName != null) {
     6.5  
     6.6             int index;
     6.7 -           if ((index =_openElementName.indexOf(":")) < 0)
     6.8 +           if ((index =_openElementName.indexOf(':')) < 0)
     6.9                 _dom.startElement(null, _openElementName, _openElementName, _attributes);
    6.10             else {
    6.11                  String uri =_dom.getNamespaceURI(_openElementName.substring(0,index));
    6.12 @@ -682,7 +682,7 @@
    6.13      public void addAttribute(String qName, String value)
    6.14      {
    6.15          // "prefix:localpart" or "localpart"
    6.16 -        int colonpos = qName.indexOf(":");
    6.17 +        int colonpos = qName.indexOf(':');
    6.18          String uri = EMPTY_STRING;
    6.19          String localName = qName;
    6.20          if (colonpos >0)
     7.1 --- a/src/com/sun/org/apache/xalan/internal/xsltc/runtime/BasisLibrary.java	Thu Sep 05 18:40:51 2019 +0800
     7.2 +++ b/src/com/sun/org/apache/xalan/internal/xsltc/runtime/BasisLibrary.java	Thu Sep 05 18:53:27 2019 +0800
     7.3 @@ -1421,8 +1421,8 @@
     7.4       * This method should only be invoked if the name attribute is an AVT
     7.5       */
     7.6      public static void checkAttribQName(String name) {
     7.7 -        final int firstOccur = name.indexOf(":");
     7.8 -        final int lastOccur = name.lastIndexOf(":");
     7.9 +        final int firstOccur = name.indexOf(':');
    7.10 +        final int lastOccur = name.lastIndexOf(':');
    7.11          final String localName = name.substring(lastOccur + 1);
    7.12  
    7.13          if (firstOccur > 0) {
     8.1 --- a/src/com/sun/org/apache/xml/internal/dtm/ref/DTMDefaultBase.java	Thu Sep 05 18:40:51 2019 +0800
     8.2 +++ b/src/com/sun/org/apache/xml/internal/dtm/ref/DTMDefaultBase.java	Thu Sep 05 18:53:27 2019 +0800
     8.3 @@ -359,7 +359,7 @@
     8.4  
     8.5      while (low <= high)
     8.6      {
     8.7 -      int mid = (low + high) / 2;
     8.8 +      int mid = (low + high) >>> 1;
     8.9        int c = list[mid];
    8.10  
    8.11        if (c > value)
     9.1 --- a/src/com/sun/org/apache/xml/internal/serializer/ToHTMLStream.java	Thu Sep 05 18:40:51 2019 +0800
     9.2 +++ b/src/com/sun/org/apache/xml/internal/serializer/ToHTMLStream.java	Thu Sep 05 18:53:27 2019 +0800
     9.3 @@ -1,6 +1,5 @@
     9.4  /*
     9.5 - * reserved comment block
     9.6 - * DO NOT REMOVE OR ALTER!
     9.7 + * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
     9.8   */
     9.9  /*
    9.10   * Copyright 2001-2004 The Apache Software Foundation.
    9.11 @@ -43,6 +42,7 @@
    9.12   * because it is used from another package.
    9.13   *
    9.14   * @xsl.usage internal
    9.15 + * @LastModified: Sept 2018
    9.16   */
    9.17  public final class ToHTMLStream extends ToStream
    9.18  {
    9.19 @@ -1021,7 +1021,7 @@
    9.20          String name,
    9.21          String value,
    9.22          ElemDesc elemDesc)
    9.23 -        throws IOException
    9.24 +        throws IOException, SAXException
    9.25      {
    9.26          writer.write(' ');
    9.27  
    9.28 @@ -1345,7 +1345,7 @@
    9.29       */
    9.30      public void writeAttrString(
    9.31          final java.io.Writer writer, String string, String encoding)
    9.32 -        throws IOException
    9.33 +        throws IOException, SAXException
    9.34      {
    9.35          final int end = string.length();
    9.36          if (end > m_attrBuff.length)
    9.37 @@ -1397,13 +1397,16 @@
    9.38                  }
    9.39                  else
    9.40                  {
    9.41 -                    if (Encodings.isHighUTF16Surrogate(ch))
    9.42 +                    if (Encodings.isHighUTF16Surrogate(ch) ||
    9.43 +                            Encodings.isLowUTF16Surrogate(ch))
    9.44                      {
    9.45 -
    9.46 -                            writeUTF16Surrogate(ch, chars, i, end);
    9.47 -                            i++; // two input characters processed
    9.48 -                                 // this increments by one and the for()
    9.49 -                                 // loop itself increments by another one.
    9.50 +                        if (writeUTF16Surrogate(ch, chars, i, end) >= 0) {
    9.51 +                            // move the index if the low surrogate is consumed
    9.52 +                            // as writeUTF16Surrogate has written the pair
    9.53 +                            if (Encodings.isHighUTF16Surrogate(ch)) {
    9.54 +                                i++;
    9.55 +                            }
    9.56 +                        }
    9.57                      }
    9.58  
    9.59                      // The next is kind of a hack to keep from escaping in the case
    10.1 --- a/src/com/sun/org/apache/xml/internal/serializer/ToStream.java	Thu Sep 05 18:40:51 2019 +0800
    10.2 +++ b/src/com/sun/org/apache/xml/internal/serializer/ToStream.java	Thu Sep 05 18:53:27 2019 +0800
    10.3 @@ -1,6 +1,5 @@
    10.4  /*
    10.5 - * reserved comment block
    10.6 - * DO NOT REMOVE OR ALTER!
    10.7 + * Copyright (c) 2006, 2018, Oracle and/or its affiliates. All rights reserved.
    10.8   */
    10.9  /*
   10.10   * Copyright 2001-2004 The Apache Software Foundation.
   10.11 @@ -51,6 +50,7 @@
   10.12   * serializers (xml, html, text ...) that write output to a stream.
   10.13   *
   10.14   * @xsl.usage internal
   10.15 + * @LastModified: Sept 2018
   10.16   */
   10.17  abstract public class ToStream extends SerializerBase
   10.18  {
   10.19 @@ -200,6 +200,7 @@
   10.20       */
   10.21      private boolean m_expandDTDEntities = true;
   10.22  
   10.23 +    private char m_highSurrogate = 0;
   10.24  
   10.25      /**
   10.26       * Default constructor
   10.27 @@ -947,45 +948,46 @@
   10.28       * @param ch Character array.
   10.29       * @param i position Where the surrogate was detected.
   10.30       * @param end The end index of the significant characters.
   10.31 -     * @return 0 if the pair of characters was written out as-is,
   10.32 -     * the unicode code point of the character represented by
   10.33 -     * the surrogate pair if an entity reference with that value
   10.34 -     * was written out.
   10.35 +     * @return the status of writing a surrogate pair.
   10.36 +     *        -1 -- nothing is written
   10.37 +     *         0 -- the pair is written as-is
   10.38 +     *         code point -- the pair is written as an entity reference
   10.39       *
   10.40       * @throws IOException
   10.41       * @throws org.xml.sax.SAXException if invalid UTF-16 surrogate detected.
   10.42       */
   10.43      protected int writeUTF16Surrogate(char c, char ch[], int i, int end)
   10.44 -        throws IOException
   10.45 +        throws IOException, SAXException
   10.46      {
   10.47 -        int codePoint = 0;
   10.48 +        int status = -1;
   10.49          if (i + 1 >= end)
   10.50          {
   10.51 -            throw new IOException(
   10.52 -                Utils.messages.createMessage(
   10.53 -                    MsgKey.ER_INVALID_UTF16_SURROGATE,
   10.54 -                    new Object[] { Integer.toHexString((int) c)}));
   10.55 +            m_highSurrogate = c;
   10.56 +            return status;
   10.57          }
   10.58  
   10.59 -        final char high = c;
   10.60 -        final char low = ch[i+1];
   10.61 +        char high, low;
   10.62 +        if (m_highSurrogate == 0) {
   10.63 +            high = c;
   10.64 +            low = ch[i+1];
   10.65 +            status = 0;
   10.66 +        } else {
   10.67 +            high = m_highSurrogate;
   10.68 +            low = c;
   10.69 +            m_highSurrogate = 0;
   10.70 +        }
   10.71 +
   10.72          if (!Encodings.isLowUTF16Surrogate(low)) {
   10.73 -            throw new IOException(
   10.74 -                Utils.messages.createMessage(
   10.75 -                    MsgKey.ER_INVALID_UTF16_SURROGATE,
   10.76 -                    new Object[] {
   10.77 -                        Integer.toHexString((int) c)
   10.78 -                            + " "
   10.79 -                            + Integer.toHexString(low)}));
   10.80 +            throwIOE(high, low);
   10.81          }
   10.82  
   10.83          final java.io.Writer writer = m_writer;
   10.84  
   10.85          // If we make it to here we have a valid high, low surrogate pair
   10.86 -        if (m_encodingInfo.isInEncoding(c,low)) {
   10.87 +        if (m_encodingInfo.isInEncoding(high,low)) {
   10.88              // If the character formed by the surrogate pair
   10.89              // is in the encoding, so just write it out
   10.90 -            writer.write(ch,i,2);
   10.91 +            writer.write(new char[]{high, low}, 0, 2);
   10.92          }
   10.93          else {
   10.94              // Don't know what to do with this char, it is
   10.95 @@ -993,24 +995,16 @@
   10.96              // a surrogate pair, so write out as an entity ref
   10.97              final String encoding = getEncoding();
   10.98              if (encoding != null) {
   10.99 -                /* The output encoding is known,
  10.100 -                 * so somthing is wrong.
  10.101 -                  */
  10.102 -                codePoint = Encodings.toCodePoint(high, low);
  10.103 -                // not in the encoding, so write out a character reference
  10.104 -                writer.write('&');
  10.105 -                writer.write('#');
  10.106 -                writer.write(Integer.toString(codePoint));
  10.107 -                writer.write(';');
  10.108 +                status = writeCharRef(writer, high, low);
  10.109              } else {
  10.110                  /* The output encoding is not known,
  10.111                   * so just write it out as-is.
  10.112                   */
  10.113 -                writer.write(ch, i, 2);
  10.114 +                writer.write(new char[]{high, low}, 0, 2);
  10.115              }
  10.116          }
  10.117          // non-zero only if character reference was written out.
  10.118 -        return codePoint;
  10.119 +        return status;
  10.120      }
  10.121  
  10.122      /**
  10.123 @@ -1100,32 +1094,7 @@
  10.124              }
  10.125              else if (isCData && (!escapingNotNeeded(c)))
  10.126              {
  10.127 -                //                if (i != 0)
  10.128 -                if (m_cdataTagOpen)
  10.129 -                    closeCDATA();
  10.130 -
  10.131 -                // This needs to go into a function...
  10.132 -                if (Encodings.isHighUTF16Surrogate(c))
  10.133 -                {
  10.134 -                    writeUTF16Surrogate(c, ch, i, end);
  10.135 -                    i++ ; // process two input characters
  10.136 -                }
  10.137 -                else
  10.138 -                {
  10.139 -                    writer.write("&#");
  10.140 -
  10.141 -                    String intStr = Integer.toString((int) c);
  10.142 -
  10.143 -                    writer.write(intStr);
  10.144 -                    writer.write(';');
  10.145 -                }
  10.146 -
  10.147 -                //                if ((i != 0) && (i < (end - 1)))
  10.148 -                //                if (!m_cdataTagOpen && (i < (end - 1)))
  10.149 -                //                {
  10.150 -                //                    writer.write(CDATA_DELIMITER_OPEN);
  10.151 -                //                    m_cdataTagOpen = true;
  10.152 -                //                }
  10.153 +                i = handleEscaping(writer, c, ch, i, end);
  10.154              }
  10.155              else if (
  10.156                  isCData
  10.157 @@ -1149,25 +1118,8 @@
  10.158                      }
  10.159                      writer.write(c);
  10.160                  }
  10.161 -
  10.162 -                // This needs to go into a function...
  10.163 -                else if (Encodings.isHighUTF16Surrogate(c))
  10.164 -                {
  10.165 -                    if (m_cdataTagOpen)
  10.166 -                        closeCDATA();
  10.167 -                    writeUTF16Surrogate(c, ch, i, end);
  10.168 -                    i++; // process two input characters
  10.169 -                }
  10.170 -                else
  10.171 -                {
  10.172 -                    if (m_cdataTagOpen)
  10.173 -                        closeCDATA();
  10.174 -                    writer.write("&#");
  10.175 -
  10.176 -                    String intStr = Integer.toString((int) c);
  10.177 -
  10.178 -                    writer.write(intStr);
  10.179 -                    writer.write(';');
  10.180 +                else {
  10.181 +                    i = handleEscaping(writer, c, ch, i, end);
  10.182                  }
  10.183              }
  10.184          }
  10.185 @@ -1175,6 +1127,38 @@
  10.186      }
  10.187  
  10.188      /**
  10.189 +     * Handles escaping, writes either with a surrogate pair or a character
  10.190 +     * reference.
  10.191 +     *
  10.192 +     * @param c the current char
  10.193 +     * @param ch the character array
  10.194 +     * @param i the current position
  10.195 +     * @param end the end index of the array
  10.196 +     * @return the next index
  10.197 +     *
  10.198 +     * @throws IOException
  10.199 +     * @throws org.xml.sax.SAXException if invalid UTF-16 surrogate detected.
  10.200 +     */
  10.201 +    private int handleEscaping(Writer writer, char c, char ch[], int i, int end)
  10.202 +            throws IOException, SAXException {
  10.203 +        if (Encodings.isHighUTF16Surrogate(c) || Encodings.isLowUTF16Surrogate(c))
  10.204 +        {
  10.205 +            if (writeUTF16Surrogate(c, ch, i, end) >= 0) {
  10.206 +                // move the index if the low surrogate is consumed
  10.207 +                // as writeUTF16Surrogate has written the pair
  10.208 +                if (Encodings.isHighUTF16Surrogate(c)) {
  10.209 +                    i++ ;
  10.210 +                }
  10.211 +            }
  10.212 +        }
  10.213 +        else
  10.214 +        {
  10.215 +            writeCharRef(writer, c);
  10.216 +        }
  10.217 +        return i;
  10.218 +    }
  10.219 +
  10.220 +    /**
  10.221       * Ends an un-escaping section.
  10.222       *
  10.223       * @see #startNonEscaping
  10.224 @@ -1242,7 +1226,7 @@
  10.225              }
  10.226              m_ispreserve = true;
  10.227  
  10.228 -            if (shouldIndent())
  10.229 +            if (!m_cdataTagOpen && shouldIndent())
  10.230                  indent();
  10.231  
  10.232              boolean writeCDataBrackets =
  10.233 @@ -1564,7 +1548,7 @@
  10.234          int i,
  10.235          char ch,
  10.236          int lastDirty,
  10.237 -        boolean fromTextNode) throws IOException
  10.238 +        boolean fromTextNode) throws IOException, SAXException
  10.239      {
  10.240          int startClean = lastDirty + 1;
  10.241          // if we have some clean characters accumulated
  10.242 @@ -1643,54 +1627,41 @@
  10.243          int len,
  10.244          boolean fromTextNode,
  10.245          boolean escLF)
  10.246 -        throws IOException
  10.247 +        throws IOException, SAXException
  10.248      {
  10.249  
  10.250          int pos = accumDefaultEntity(writer, ch, i, chars, len, fromTextNode, escLF);
  10.251  
  10.252          if (i == pos)
  10.253          {
  10.254 +            if (m_highSurrogate != 0) {
  10.255 +                if (!(Encodings.isLowUTF16Surrogate(ch))) {
  10.256 +                    throwIOE(m_highSurrogate, ch);
  10.257 +                }
  10.258 +                writeCharRef(writer, m_highSurrogate, ch);
  10.259 +                m_highSurrogate = 0;
  10.260 +                return ++pos;
  10.261 +            }
  10.262 +
  10.263              if (Encodings.isHighUTF16Surrogate(ch))
  10.264              {
  10.265 -
  10.266 -                // Should be the UTF-16 low surrogate of the hig/low pair.
  10.267 -                char next;
  10.268 -                // Unicode code point formed from the high/low pair.
  10.269 -                int codePoint = 0;
  10.270 -
  10.271                  if (i + 1 >= len)
  10.272                  {
  10.273 -                    throw new IOException(
  10.274 -                        Utils.messages.createMessage(
  10.275 -                            MsgKey.ER_INVALID_UTF16_SURROGATE,
  10.276 -                            new Object[] { Integer.toHexString(ch)}));
  10.277 -                    //"Invalid UTF-16 surrogate detected: "
  10.278 -
  10.279 -                    //+Integer.toHexString(ch)+ " ?");
  10.280 +                    // save for the next read
  10.281 +                    m_highSurrogate = ch;
  10.282 +                    pos++;
  10.283                  }
  10.284                  else
  10.285                  {
  10.286 -                    next = chars[++i];
  10.287 +                    // the next should be the UTF-16 low surrogate of the hig/low pair.
  10.288 +                    char next = chars[++i];
  10.289  
  10.290                      if (!(Encodings.isLowUTF16Surrogate(next)))
  10.291 -                        throw new IOException(
  10.292 -                            Utils.messages.createMessage(
  10.293 -                                MsgKey
  10.294 -                                    .ER_INVALID_UTF16_SURROGATE,
  10.295 -                                new Object[] {
  10.296 -                                    Integer.toHexString(ch)
  10.297 -                                        + " "
  10.298 -                                        + Integer.toHexString(next)}));
  10.299 -                    //"Invalid UTF-16 surrogate detected: "
  10.300 -
  10.301 -                    //+Integer.toHexString(ch)+" "+Integer.toHexString(next));
  10.302 -                    codePoint = Encodings.toCodePoint(ch,next);
  10.303 +                        throwIOE(ch, next);
  10.304 +
  10.305 +                    writeCharRef(writer, ch, next);
  10.306 +                    pos += 2; // count the two characters that went into writing out this entity
  10.307                  }
  10.308 -
  10.309 -                writer.write("&#");
  10.310 -                writer.write(Integer.toString(codePoint));
  10.311 -                writer.write(';');
  10.312 -                pos += 2; // count the two characters that went into writing out this entity
  10.313              }
  10.314              else
  10.315              {
  10.316 @@ -1702,18 +1673,14 @@
  10.317                  if (isCharacterInC0orC1Range(ch) ||
  10.318                          (XMLVERSION11.equals(getVersion()) && isNELorLSEPCharacter(ch)))
  10.319                  {
  10.320 -                    writer.write("&#");
  10.321 -                    writer.write(Integer.toString(ch));
  10.322 -                    writer.write(';');
  10.323 +                    writeCharRef(writer, ch);
  10.324                  }
  10.325                  else if ((!escapingNotNeeded(ch) ||
  10.326                      (  (fromTextNode && m_charInfo.isSpecialTextChar(ch))
  10.327                       || (!fromTextNode && m_charInfo.isSpecialAttrChar(ch))))
  10.328 -                && m_elemContext.m_currentElemDepth > 0)
  10.329 +                     && m_elemContext.m_currentElemDepth > 0)
  10.330                  {
  10.331 -                    writer.write("&#");
  10.332 -                    writer.write(Integer.toString(ch));
  10.333 -                    writer.write(';');
  10.334 +                    writeCharRef(writer, ch);
  10.335                  }
  10.336                  else
  10.337                  {
  10.338 @@ -1727,6 +1694,45 @@
  10.339      }
  10.340  
  10.341      /**
  10.342 +     * Writes out a character reference.
  10.343 +     * @param writer the writer
  10.344 +     * @param c the character
  10.345 +     * @throws IOException
  10.346 +     */
  10.347 +    private void writeCharRef(Writer writer, char c) throws IOException, SAXException {
  10.348 +        if (m_cdataTagOpen)
  10.349 +            closeCDATA();
  10.350 +        writer.write("&#");
  10.351 +        writer.write(Integer.toString(c));
  10.352 +        writer.write(';');
  10.353 +    }
  10.354 +
  10.355 +    /**
  10.356 +     * Writes out a pair of surrogates as a character reference
  10.357 +     * @param writer the writer
  10.358 +     * @param high the high surrogate
  10.359 +     * @param low the low surrogate
  10.360 +     * @throws IOException
  10.361 +     */
  10.362 +    private int writeCharRef(Writer writer, char high, char low) throws IOException, SAXException {
  10.363 +        if (m_cdataTagOpen)
  10.364 +            closeCDATA();
  10.365 +        // Unicode code point formed from the high/low pair.
  10.366 +        int codePoint = Encodings.toCodePoint(high, low);
  10.367 +        writer.write("&#");
  10.368 +        writer.write(Integer.toString(codePoint));
  10.369 +        writer.write(';');
  10.370 +        return codePoint;
  10.371 +    }
  10.372 +
  10.373 +    private void throwIOE(char ch, char next) throws IOException {
  10.374 +        throw new IOException(Utils.messages.createMessage(
  10.375 +                MsgKey.ER_INVALID_UTF16_SURROGATE,
  10.376 +                new Object[] {Integer.toHexString(ch) + " "
  10.377 +                        + Integer.toHexString(next)}));
  10.378 +    }
  10.379 +
  10.380 +    /**
  10.381       * Receive notification of the beginning of an element, although this is a
  10.382       * SAX method additional namespace or attribute information can occur before
  10.383       * or after this call, that is associated with this element.
  10.384 @@ -1962,7 +1968,7 @@
  10.385          Writer writer,
  10.386          String string,
  10.387          String encoding)
  10.388 -        throws IOException
  10.389 +        throws IOException, SAXException
  10.390      {
  10.391          final int len = string.length();
  10.392          if (len > m_attrBuff.length)
    11.1 --- a/src/com/sun/org/apache/xml/internal/serializer/ToTextStream.java	Thu Sep 05 18:40:51 2019 +0800
    11.2 +++ b/src/com/sun/org/apache/xml/internal/serializer/ToTextStream.java	Thu Sep 05 18:53:27 2019 +0800
    11.3 @@ -1,6 +1,5 @@
    11.4  /*
    11.5 - * reserved comment block
    11.6 - * DO NOT REMOVE OR ALTER!
    11.7 + * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
    11.8   */
    11.9  /*
   11.10   * Copyright 2001-2004 The Apache Software Foundation.
   11.11 @@ -35,6 +34,7 @@
   11.12   * This class converts SAX or SAX-like calls to a
   11.13   * serialized document for xsl:output method of "text".
   11.14   * @xsl.usage internal
   11.15 + * @LastModified: Sept 2018
   11.16   */
   11.17  public final class ToTextStream extends ToStream
   11.18  {
   11.19 @@ -296,23 +296,32 @@
   11.20              } else if (m_encodingInfo.isInEncoding(c)) {
   11.21                  writer.write(c);
   11.22                  // one input char processed
   11.23 -            } else if (Encodings.isHighUTF16Surrogate(c)) {
   11.24 +            } else if (Encodings.isHighUTF16Surrogate(c) ||
   11.25 +                       Encodings.isLowUTF16Surrogate(c)) {
   11.26                  final int codePoint = writeUTF16Surrogate(c, ch, i, end);
   11.27 -                if (codePoint != 0) {
   11.28 -                    // I think we can just emit the message,
   11.29 -                    // not crash and burn.
   11.30 -                    final String integralValue = Integer.toString(codePoint);
   11.31 -                    final String msg = Utils.messages.createMessage(
   11.32 -                        MsgKey.ER_ILLEGAL_CHARACTER,
   11.33 -                        new Object[] { integralValue, encoding });
   11.34 +                if (codePoint >= 0) {
   11.35 +                    // move the index if the low surrogate is consumed
   11.36 +                    // as writeUTF16Surrogate has written the pair
   11.37 +                    if (Encodings.isHighUTF16Surrogate(c)) {
   11.38 +                        i++;
   11.39 +                    }
   11.40  
   11.41 -                    //Older behavior was to throw the message,
   11.42 -                    //but newer gentler behavior is to write a message to System.err
   11.43 -                    //throw new SAXException(msg);
   11.44 -                    System.err.println(msg);
   11.45 +                    // printing to the console is not appropriate, but will leave
   11.46 +                    // it as is for compatibility.
   11.47 +                    if (codePoint >0) {
   11.48 +                        // I think we can just emit the message,
   11.49 +                        // not crash and burn.
   11.50 +                        final String integralValue = Integer.toString(codePoint);
   11.51 +                        final String msg = Utils.messages.createMessage(
   11.52 +                            MsgKey.ER_ILLEGAL_CHARACTER,
   11.53 +                            new Object[] { integralValue, encoding });
   11.54  
   11.55 +                        //Older behavior was to throw the message,
   11.56 +                        //but newer gentler behavior is to write a message to System.err
   11.57 +                        //throw new SAXException(msg);
   11.58 +                        System.err.println(msg);
   11.59 +                    }
   11.60                  }
   11.61 -                i++; // two input chars processed
   11.62              } else {
   11.63                  // Don't know what to do with this char, it is
   11.64                  // not in the encoding and not a high char in
    12.1 --- a/src/com/sun/org/apache/xml/internal/utils/NodeVector.java	Thu Sep 05 18:40:51 2019 +0800
    12.2 +++ b/src/com/sun/org/apache/xml/internal/utils/NodeVector.java	Thu Sep 05 18:53:27 2019 +0800
    12.3 @@ -670,9 +670,9 @@
    12.4      /*
    12.5       *  Pick a pivot and move it out of the way
    12.6       */
    12.7 -    int pivot = a[(lo + hi) / 2];
    12.8 -
    12.9 -    a[(lo + hi) / 2] = a[hi];
   12.10 +    int mid = (lo + hi) >>> 1;
   12.11 +    int pivot = a[mid];
   12.12 +    a[mid] = a[hi];
   12.13      a[hi] = pivot;
   12.14  
   12.15      while (lo < hi)

mercurial