Mercurial > hg > release > icedtea7-forest-2.5 > jaxp
changeset 1165:b9eaa7d194dd jdk7u75-b01
Merge
author | asaha |
---|---|
date | Mon, 22 Sep 2014 09:54:05 -0700 |
parents | aa78a0843bd8 (diff) f04e20bbefd6 (current diff) |
children | 4a7bd4c9d285 |
files | .hgtags |
diffstat | 8 files changed, 203 insertions(+), 138 deletions(-) [+] |
line wrap: on
line diff
--- a/.hgtags Mon Sep 22 09:38:42 2014 -0700 +++ b/.hgtags Mon Sep 22 09:54:05 2014 -0700 @@ -474,6 +474,8 @@ 4e323af07c47061109fb5f585613b0cc4b4208ca jdk7u65-b19 f3b7bb6f1924ab7f635cdd60db7fbab64576cd6d jdk7u65-b32 d41f31b707c87675f3467e980b1ceef2e53b3b5d jdk7u65-b20 +d1f8566d39c56e40516a1afb304ed7c0681355d8 jdk7u67-b01 +4e323af07c47061109fb5f585613b0cc4b4208ca jdk7u65-b40 a5f829d7fa05cf769402dfc82c94b737b8d011b0 jdk7u65-b31 f33ea72260ca7480f4a1405d35a3709895b491a2 jdk7u65-b33 d1f8566d39c56e40516a1afb304ed7c0681355d8 jdk7u67-b01 @@ -481,3 +483,42 @@ e7300cd38793c7620f39be5f73b7fcba2f80555b jdk7u67-b32 78c4bc9bfa12cc97039fd84c5ec1cbd086a0ba35 jdk7u67-b33 39a6fbc6ef75eba7b3c28e8485a0665d904f21eb jdk7u67-b34 +86e93799766d67102a37559b3831abcc825d7e24 jdk7u66-b00 +d34839cb2f15dee01cdfb1fd93378849de34d662 jdk7u66-b01 +19e4e978c8212921104ba16d0db6bf18c6f8d0ab jdk7u66-b09 +533ecae83034da1e68ee9a414b690c9b6eead293 jdk7u66-b10 +763f80d4aae130a89efa4c6544ee98fcb7e6a2ca jdk7u66-b11 +0d91d2f038d19261e0085a76bb8974c3b7609c5d jdk7u66-b12 +cddc3774bebfe597228c7b3e386859b1fa775387 jdk7u66-b13 +15206a7046a97d0a0fd824bec8b0e4174a56d8eb jdk7u66-b14 +af60b8e3b9deb32d50552916e0afd38a30feaef0 jdk7u66-b15 +36bba6c72f866df5c65ba8678544bf0442a952b3 jdk7u66-b16 +9a777cc0d6b3b25d13feca1e610584d042565367 jdk7u66-b17 +174a2f822f4f600f798e9963f0c1496206dce471 jdk7u71-b00 +df8d93eddfc2de1046b8fb87204bc945c538a282 jdk7u71-b01 +153724c929075f0a741aacead679af39f03a0a80 jdk7u71-b02 +9e2007e23f356b7bc5d4d0c6c6350e9b3b3cd56b jdk7u71-b03 +f58a7f8db6c54cd76621d1f48d17102ffbe93983 jdk7u71-b04 +edab7f6d9a30feea45bf9185de0c65e11ab3a7b0 jdk7u71-b05 +ca2992ad734eaf8295e21351b0de329555e9e60a jdk7u71-b06 +5fbecd4c30c2e566e9b815818d51042e20d3ab83 jdk7u71-b07 +acf176ea76f904674228745c25af195e460f1240 jdk7u71-b08 +8a9f55d8d011ad6dc36f307dfac47981b676b379 jdk7u71-b09 +d82fd2f6c5c8ed03c75828033058b675f9239d4b jdk7u71-b10 +f7542072016b7972b383075f84df29bc05495d2e jdk7u71-b11 +109dd4c4a07a8adfaf59e11c29e502277b803c44 jdk7u71-b12 +df2c7c9a3609f8f4b30b09c29a9cfddc8b4b90ef jdk7u71-b13 +0e7c12377e0120b908fc594afc596ce1f5f2b234 jdk7u72-b01 +bc5b33e920af4b34facfa85a6bf48d5f55b05116 jdk7u72-b02 +b1f6b12c1fcac4b0ea89bf3f134324aa8968b847 jdk7u72-b03 +f59d0ae0995d2cdb57ea482a8fa47575e0d8b57f jdk7u72-b04 +ed071d27bf7320265d8ae527bb622f2e26e1a89c jdk7u72-b05 +d3c5c35f617e33f673420ff9da8051c742513af3 jdk7u72-b06 +ef0842fc31d98031ad9bb514b0f8d2db7bcf4162 jdk7u72-b07 +89117e4403e61b9c033bcab65da30abf2219e385 jdk7u72-b08 +7637d4b21a9e3237f129f69a0dc7132877f3ab19 jdk7u72-b09 +a3d6d3327b32cd7fb41a144d48f957170dde3ba8 jdk7u72-b10 +d3fbd111daa01dc1737afd0a59084e14664d581a jdk7u72-b11 +fb713c907f33689a418c87bf721dafcdc9616ca8 jdk7u72-b12 +8f0d267ca63ab2f9d7839604ae88fafbcc0ad2d4 jdk7u72-b13 +4173f90038ff1764576d08efa34109a7895f106b jdk7u75-b00
--- a/src/com/sun/org/apache/xalan/internal/xsltc/compiler/StringLengthCall.java Mon Sep 22 09:38:42 2014 -0700 +++ b/src/com/sun/org/apache/xalan/internal/xsltc/compiler/StringLengthCall.java Mon Sep 22 09:54:05 2014 -0700 @@ -26,7 +26,7 @@ import java.util.Vector; import com.sun.org.apache.bcel.internal.generic.ConstantPoolGen; -import com.sun.org.apache.bcel.internal.generic.INVOKEVIRTUAL; +import com.sun.org.apache.bcel.internal.generic.INVOKESTATIC; import com.sun.org.apache.bcel.internal.generic.InstructionList; import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ClassGenerator; import com.sun.org.apache.xalan.internal.xsltc.compiler.util.MethodGenerator; @@ -51,7 +51,8 @@ il.append(methodGen.loadContextNode()); Type.Node.translateTo(classGen, methodGen, Type.String); } - il.append(new INVOKEVIRTUAL(cpg.addMethodref(STRING_CLASS, - "length", "()I"))); + il.append(new INVOKESTATIC(cpg.addMethodref(BASIS_LIBRARY_CLASS, + "getStringLength", + "(Ljava/lang/String;)I"))); } }
--- a/src/com/sun/org/apache/xalan/internal/xsltc/runtime/BasisLibrary.java Mon Sep 22 09:38:42 2014 -0700 +++ b/src/com/sun/org/apache/xalan/internal/xsltc/runtime/BasisLibrary.java Mon Sep 22 09:54:05 2014 -0700 @@ -1660,5 +1660,14 @@ } + /** + * Utility method to calculate string-length as a number of code points, + * to avoid possible errors with string that contains + * complementary characters + */ + public static int getStringLength(String str) { + return str.codePointCount(0,str.length()); + } + //-- End utility functions }
--- a/src/com/sun/org/apache/xerces/internal/impl/XML11EntityScanner.java Mon Sep 22 09:38:42 2014 -0700 +++ b/src/com/sun/org/apache/xerces/internal/impl/XML11EntityScanner.java Mon Sep 22 09:54:05 2014 -0700 @@ -61,14 +61,13 @@ package com.sun.org.apache.xerces.internal.impl; -import java.io.IOException; - import com.sun.org.apache.xerces.internal.impl.msg.XMLMessageFormatter; +import com.sun.org.apache.xerces.internal.util.XML11Char; import com.sun.org.apache.xerces.internal.util.XMLChar; -import com.sun.org.apache.xerces.internal.util.XML11Char; import com.sun.org.apache.xerces.internal.util.XMLStringBuffer; import com.sun.org.apache.xerces.internal.xni.QName; import com.sun.org.apache.xerces.internal.xni.XMLString; +import java.io.IOException; /** * Implements the entity scanner methods in @@ -78,6 +77,7 @@ * * @author Michael Glavassevich, IBM * @author Neil Graham, IBM + * @version $Id: XML11EntityScanner.java,v 1.5 2010-11-01 04:39:40 joehw Exp $ */ public class XML11EntityScanner @@ -108,7 +108,7 @@ // load more characters, if needed if (fCurrentEntity.position == fCurrentEntity.count) { - load(0, true); + load(0, true, true); } // peek at character @@ -136,7 +136,7 @@ // load more characters, if needed if (fCurrentEntity.position == fCurrentEntity.count) { - load(0, true); + load(0, true, true); } // scan character @@ -148,7 +148,7 @@ fCurrentEntity.columnNumber = 1; if (fCurrentEntity.position == fCurrentEntity.count) { fCurrentEntity.ch[0] = (char)c; - load(1, false); + load(1, false, true); } if (c == '\r' && external) { int cc = fCurrentEntity.ch[fCurrentEntity.position++]; @@ -183,7 +183,7 @@ public String scanNmtoken() throws IOException { // load more characters, if needed if (fCurrentEntity.position == fCurrentEntity.count) { - load(0, true); + load(0, true, true); } // scan nmtoken @@ -194,6 +194,7 @@ if (XML11Char.isXML11Name(ch)) { if (++fCurrentEntity.position == fCurrentEntity.count) { int length = fCurrentEntity.position - offset; + invokeListeners(length); if (length == fCurrentEntity.ch.length) { // bad luck we have to resize our buffer char[] tmp = new char[fCurrentEntity.ch.length << 1]; @@ -206,7 +207,7 @@ fCurrentEntity.ch, 0, length); } offset = 0; - if (load(length, false)) { + if (load(length, false, false)) { break; } } @@ -214,6 +215,7 @@ else if (XML11Char.isXML11NameHighSurrogate(ch)) { if (++fCurrentEntity.position == fCurrentEntity.count) { int length = fCurrentEntity.position - offset; + invokeListeners(length); if (length == fCurrentEntity.ch.length) { // bad luck we have to resize our buffer char[] tmp = new char[fCurrentEntity.ch.length << 1]; @@ -226,7 +228,7 @@ fCurrentEntity.ch, 0, length); } offset = 0; - if (load(length, false)) { + if (load(length, false, false)) { --fCurrentEntity.startPosition; --fCurrentEntity.position; break; @@ -240,6 +242,7 @@ } if (++fCurrentEntity.position == fCurrentEntity.count) { int length = fCurrentEntity.position - offset; + invokeListeners(length); if (length == fCurrentEntity.ch.length) { // bad luck we have to resize our buffer char[] tmp = new char[fCurrentEntity.ch.length << 1]; @@ -252,7 +255,7 @@ fCurrentEntity.ch, 0, length); } offset = 0; - if (load(length, false)) { + if (load(length, false, false)) { break; } } @@ -294,7 +297,7 @@ public String scanName() throws IOException { // load more characters, if needed if (fCurrentEntity.position == fCurrentEntity.count) { - load(0, true); + load(0, true, true); } // scan name @@ -305,7 +308,7 @@ if (++fCurrentEntity.position == fCurrentEntity.count) { fCurrentEntity.ch[0] = ch; offset = 0; - if (load(1, false)) { + if (load(1, false, true)) { fCurrentEntity.columnNumber++; String symbol = fSymbolTable.addSymbol(fCurrentEntity.ch, 0, 1); return symbol; @@ -316,7 +319,7 @@ if (++fCurrentEntity.position == fCurrentEntity.count) { fCurrentEntity.ch[0] = ch; offset = 0; - if (load(1, false)) { + if (load(1, false, true)) { --fCurrentEntity.position; --fCurrentEntity.startPosition; return null; @@ -332,7 +335,7 @@ fCurrentEntity.ch[0] = ch; fCurrentEntity.ch[1] = ch2; offset = 0; - if (load(2, false)) { + if (load(2, false, true)) { fCurrentEntity.columnNumber += 2; String symbol = fSymbolTable.addSymbol(fCurrentEntity.ch, 0, 2); return symbol; @@ -348,6 +351,7 @@ if (XML11Char.isXML11Name(ch)) { if (++fCurrentEntity.position == fCurrentEntity.count) { int length = fCurrentEntity.position - offset; + invokeListeners(length); if (length == fCurrentEntity.ch.length) { // bad luck we have to resize our buffer char[] tmp = new char[fCurrentEntity.ch.length << 1]; @@ -360,7 +364,7 @@ fCurrentEntity.ch, 0, length); } offset = 0; - if (load(length, false)) { + if (load(length, false, false)) { break; } } @@ -368,6 +372,7 @@ else if (XML11Char.isXML11NameHighSurrogate(ch)) { if (++fCurrentEntity.position == fCurrentEntity.count) { int length = fCurrentEntity.position - offset; + invokeListeners(length); if (length == fCurrentEntity.ch.length) { // bad luck we have to resize our buffer char[] tmp = new char[fCurrentEntity.ch.length << 1]; @@ -380,7 +385,7 @@ fCurrentEntity.ch, 0, length); } offset = 0; - if (load(length, false)) { + if (load(length, false, false)) { --fCurrentEntity.position; --fCurrentEntity.startPosition; break; @@ -394,6 +399,7 @@ } if (++fCurrentEntity.position == fCurrentEntity.count) { int length = fCurrentEntity.position - offset; + invokeListeners(length); if (length == fCurrentEntity.ch.length) { // bad luck we have to resize our buffer char[] tmp = new char[fCurrentEntity.ch.length << 1]; @@ -406,7 +412,7 @@ fCurrentEntity.ch, 0, length); } offset = 0; - if (load(length, false)) { + if (load(length, false, false)) { break; } } @@ -449,7 +455,7 @@ // load more characters, if needed if (fCurrentEntity.position == fCurrentEntity.count) { - load(0, true); + load(0, true, true); } // scan name @@ -460,7 +466,7 @@ if (++fCurrentEntity.position == fCurrentEntity.count) { fCurrentEntity.ch[0] = ch; offset = 0; - if (load(1, false)) { + if (load(1, false, true)) { fCurrentEntity.columnNumber++; String symbol = fSymbolTable.addSymbol(fCurrentEntity.ch, 0, 1); return symbol; @@ -471,7 +477,7 @@ if (++fCurrentEntity.position == fCurrentEntity.count) { fCurrentEntity.ch[0] = ch; offset = 0; - if (load(1, false)) { + if (load(1, false, true)) { --fCurrentEntity.position; --fCurrentEntity.startPosition; return null; @@ -487,7 +493,7 @@ fCurrentEntity.ch[0] = ch; fCurrentEntity.ch[1] = ch2; offset = 0; - if (load(2, false)) { + if (load(2, false, true)) { fCurrentEntity.columnNumber += 2; String symbol = fSymbolTable.addSymbol(fCurrentEntity.ch, 0, 2); return symbol; @@ -503,6 +509,7 @@ if (XML11Char.isXML11NCName(ch)) { if (++fCurrentEntity.position == fCurrentEntity.count) { int length = fCurrentEntity.position - offset; + invokeListeners(length); if (length == fCurrentEntity.ch.length) { // bad luck we have to resize our buffer char[] tmp = new char[fCurrentEntity.ch.length << 1]; @@ -515,7 +522,7 @@ fCurrentEntity.ch, 0, length); } offset = 0; - if (load(length, false)) { + if (load(length, false, false)) { break; } } @@ -523,6 +530,7 @@ else if (XML11Char.isXML11NameHighSurrogate(ch)) { if (++fCurrentEntity.position == fCurrentEntity.count) { int length = fCurrentEntity.position - offset; + invokeListeners(length); if (length == fCurrentEntity.ch.length) { // bad luck we have to resize our buffer char[] tmp = new char[fCurrentEntity.ch.length << 1]; @@ -535,7 +543,7 @@ fCurrentEntity.ch, 0, length); } offset = 0; - if (load(length, false)) { + if (load(length, false, false)) { --fCurrentEntity.startPosition; --fCurrentEntity.position; break; @@ -549,6 +557,7 @@ } if (++fCurrentEntity.position == fCurrentEntity.count) { int length = fCurrentEntity.position - offset; + invokeListeners(length); if (length == fCurrentEntity.ch.length) { // bad luck we have to resize our buffer char[] tmp = new char[fCurrentEntity.ch.length << 1]; @@ -561,7 +570,7 @@ fCurrentEntity.ch, 0, length); } offset = 0; - if (load(length, false)) { + if (load(length, false, false)) { break; } } @@ -610,7 +619,7 @@ // load more characters, if needed if (fCurrentEntity.position == fCurrentEntity.count) { - load(0, true); + load(0, true, true); } // scan qualified name @@ -621,7 +630,7 @@ if (++fCurrentEntity.position == fCurrentEntity.count) { fCurrentEntity.ch[0] = ch; offset = 0; - if (load(1, false)) { + if (load(1, false, true)) { fCurrentEntity.columnNumber++; String name = fSymbolTable.addSymbol(fCurrentEntity.ch, 0, 1); qname.setValues(null, name, name, null); @@ -633,7 +642,7 @@ if (++fCurrentEntity.position == fCurrentEntity.count) { fCurrentEntity.ch[0] = ch; offset = 0; - if (load(1, false)) { + if (load(1, false, true)) { --fCurrentEntity.startPosition; --fCurrentEntity.position; return false; @@ -649,7 +658,7 @@ fCurrentEntity.ch[0] = ch; fCurrentEntity.ch[1] = ch2; offset = 0; - if (load(2, false)) { + if (load(2, false, true)) { fCurrentEntity.columnNumber += 2; String name = fSymbolTable.addSymbol(fCurrentEntity.ch, 0, 2); qname.setValues(null, name, name, null); @@ -674,6 +683,7 @@ } if (++fCurrentEntity.position == fCurrentEntity.count) { int length = fCurrentEntity.position - offset; + invokeListeners(length); if (length == fCurrentEntity.ch.length) { // bad luck we have to resize our buffer char[] tmp = new char[fCurrentEntity.ch.length << 1]; @@ -689,7 +699,7 @@ index = index - offset; } offset = 0; - if (load(length, false)) { + if (load(length, false, false)) { break; } } @@ -697,6 +707,7 @@ else if (XML11Char.isXML11NameHighSurrogate(ch)) { if (++fCurrentEntity.position == fCurrentEntity.count) { int length = fCurrentEntity.position - offset; + invokeListeners(length); if (length == fCurrentEntity.ch.length) { // bad luck we have to resize our buffer char[] tmp = new char[fCurrentEntity.ch.length << 1]; @@ -712,7 +723,7 @@ index = index - offset; } offset = 0; - if (load(length, false)) { + if (load(length, false, false)) { sawIncompleteSurrogatePair = true; --fCurrentEntity.startPosition; --fCurrentEntity.position; @@ -728,6 +739,7 @@ } if (++fCurrentEntity.position == fCurrentEntity.count) { int length = fCurrentEntity.position - offset; + invokeListeners(length); if (length == fCurrentEntity.ch.length) { // bad luck we have to resize our buffer char[] tmp = new char[fCurrentEntity.ch.length << 1]; @@ -743,7 +755,7 @@ index = index - offset; } offset = 0; - if (load(length, false)) { + if (load(length, false, false)) { break; } } @@ -820,11 +832,11 @@ // load more characters, if needed if (fCurrentEntity.position == fCurrentEntity.count) { - load(0, true); + load(0, true, true); } else if (fCurrentEntity.position == fCurrentEntity.count - 1) { fCurrentEntity.ch[0] = fCurrentEntity.ch[fCurrentEntity.count - 1]; - load(1, false); + load(1, false, true); fCurrentEntity.position = 0; fCurrentEntity.startPosition = 0; } @@ -846,7 +858,7 @@ fCurrentEntity.baseCharOffset += (fCurrentEntity.position - fCurrentEntity.startPosition); fCurrentEntity.position = newlines; fCurrentEntity.startPosition = newlines; - if (load(newlines, false)) { + if (load(newlines, false, true)) { break; } } @@ -869,7 +881,7 @@ fCurrentEntity.baseCharOffset += (fCurrentEntity.position - fCurrentEntity.startPosition); fCurrentEntity.position = newlines; fCurrentEntity.startPosition = newlines; - if (load(newlines, false)) { + if (load(newlines, false, true)) { break; } } @@ -961,11 +973,11 @@ throws IOException { // load more characters, if needed if (fCurrentEntity.position == fCurrentEntity.count) { - load(0, true); + load(0, true, true); } else if (fCurrentEntity.position == fCurrentEntity.count - 1) { fCurrentEntity.ch[0] = fCurrentEntity.ch[fCurrentEntity.count - 1]; - load(1, false); + load(1, false, true); fCurrentEntity.startPosition = 0; fCurrentEntity.position = 0; } @@ -987,7 +999,7 @@ fCurrentEntity.baseCharOffset += (fCurrentEntity.position - fCurrentEntity.startPosition); fCurrentEntity.position = newlines; fCurrentEntity.startPosition = newlines; - if (load(newlines, false)) { + if (load(newlines, false, true)) { break; } } @@ -1010,7 +1022,7 @@ fCurrentEntity.baseCharOffset += (fCurrentEntity.position - fCurrentEntity.startPosition); fCurrentEntity.position = newlines; fCurrentEntity.startPosition = newlines; - if (load(newlines, false)) { + if (load(newlines, false, true)) { break; } } @@ -1113,7 +1125,7 @@ do { // load more characters, if needed if (fCurrentEntity.position == fCurrentEntity.count) { - load(0, true); + load(0, true, false); } boolean bNextEntity = false; @@ -1127,7 +1139,7 @@ 0, fCurrentEntity.count - fCurrentEntity.position); - bNextEntity = load(fCurrentEntity.count - fCurrentEntity.position, false); + bNextEntity = load(fCurrentEntity.count - fCurrentEntity.position, false, false); fCurrentEntity.position = 0; fCurrentEntity.startPosition = 0; } @@ -1140,7 +1152,7 @@ fCurrentEntity.baseCharOffset += (fCurrentEntity.position - fCurrentEntity.startPosition); fCurrentEntity.position = fCurrentEntity.count; fCurrentEntity.startPosition = fCurrentEntity.count; - load(0,true); + load(0,true, false); return false; } @@ -1160,7 +1172,7 @@ fCurrentEntity.baseCharOffset += (fCurrentEntity.position - fCurrentEntity.startPosition); fCurrentEntity.position = newlines; fCurrentEntity.startPosition = newlines; - if (load(newlines, false)) { + if (load(newlines, false, true)) { break; } } @@ -1184,7 +1196,7 @@ fCurrentEntity.position = newlines; fCurrentEntity.startPosition = newlines; fCurrentEntity.count = newlines; - if (load(newlines, false)) { + if (load(newlines, false, true)) { break; } } @@ -1309,7 +1321,7 @@ // load more characters, if needed if (fCurrentEntity.position == fCurrentEntity.count) { - load(0, true); + load(0, true, true); } // skip character @@ -1335,7 +1347,7 @@ // handle newlines if (fCurrentEntity.position == fCurrentEntity.count) { fCurrentEntity.ch[0] = (char)cc; - load(1, false); + load(1, false, true); } int ccc = fCurrentEntity.ch[++fCurrentEntity.position]; if (ccc == '\n' || ccc == 0x85) { @@ -1369,7 +1381,7 @@ // load more characters, if needed if (fCurrentEntity.position == fCurrentEntity.count) { - load(0, true); + load(0, true, true); } @@ -1397,7 +1409,7 @@ fCurrentEntity.columnNumber = 1; if (fCurrentEntity.position == fCurrentEntity.count - 1) { fCurrentEntity.ch[0] = (char)c; - entityChanged = load(1, true); + entityChanged = load(1, true, true); if (!entityChanged) { // the load change the position to be 1, // need to restore it when entity not changed @@ -1424,7 +1436,7 @@ if (!entityChanged) fCurrentEntity.position++; if (fCurrentEntity.position == fCurrentEntity.count) { - load(0, true); + load(0, true, true); if(fCurrentEntity == null){ return true ; @@ -1445,7 +1457,7 @@ fCurrentEntity.columnNumber = 1; if (fCurrentEntity.position == fCurrentEntity.count - 1) { fCurrentEntity.ch[0] = (char)c; - entityChanged = load(1, true); + entityChanged = load(1, true, true); if (!entityChanged) { // the load change the position to be 1, // need to restore it when entity not changed @@ -1463,7 +1475,7 @@ if (!entityChanged) fCurrentEntity.position++; if (fCurrentEntity.position == fCurrentEntity.count) { - load(0, true); + load(0, true, true); if(fCurrentEntity == null){ return true ; @@ -1496,7 +1508,7 @@ // load more characters, if needed if (fCurrentEntity.position == fCurrentEntity.count) { - load(0, true); + load(0, true, true); } // skip string @@ -1508,10 +1520,11 @@ return false; } if (i < length - 1 && fCurrentEntity.position == fCurrentEntity.count) { + invokeListeners(0); System.arraycopy(fCurrentEntity.ch, fCurrentEntity.count - i - 1, fCurrentEntity.ch, 0, i + 1); // REVISIT: Can a string to be skipped cross an // entity boundary? -Ac - if (load(i + 1, false)) { + if (load(i + 1, false, false)) { fCurrentEntity.startPosition -= i + 1; fCurrentEntity.position -= i + 1; return false;
--- a/src/com/sun/org/apache/xerces/internal/impl/XMLDocumentFragmentScannerImpl.java Mon Sep 22 09:38:42 2014 -0700 +++ b/src/com/sun/org/apache/xerces/internal/impl/XMLDocumentFragmentScannerImpl.java Mon Sep 22 09:54:05 2014 -0700 @@ -612,9 +612,9 @@ //fElementStack2.clear(); //fReplaceEntityReferences = true; //fSupportExternalEntities = true; - Boolean bo = (Boolean)propertyManager.getProperty(XMLInputFactoryImpl.IS_REPLACING_ENTITY_REFERENCES); + Boolean bo = (Boolean)propertyManager.getProperty(XMLInputFactory.IS_REPLACING_ENTITY_REFERENCES); fReplaceEntityReferences = bo.booleanValue(); - bo = (Boolean)propertyManager.getProperty(XMLInputFactoryImpl.IS_SUPPORTING_EXTERNAL_ENTITIES); + bo = (Boolean)propertyManager.getProperty(XMLInputFactory.IS_SUPPORTING_EXTERNAL_ENTITIES); fSupportExternalEntities = bo.booleanValue(); Boolean cdata = (Boolean)propertyManager.getProperty(Constants.ZEPHYR_PROPERTY_PREFIX + Constants.STAX_REPORT_CDATA_EVENT) ; if(cdata != null)
--- a/src/com/sun/org/apache/xerces/internal/impl/XMLEntityManager.java Mon Sep 22 09:38:42 2014 -0700 +++ b/src/com/sun/org/apache/xerces/internal/impl/XMLEntityManager.java Mon Sep 22 09:54:05 2014 -0700 @@ -50,6 +50,7 @@ import java.util.Map; import java.util.Stack; import javax.xml.XMLConstants; +import javax.xml.stream.XMLInputFactory; /** @@ -302,6 +303,11 @@ /** Property Manager. This is used from Stax */ protected PropertyManager fPropertyManager ; + /** StAX properties */ + boolean fSupportDTD = true; + boolean fReplaceEntityReferences = true; + boolean fSupportExternalEntities = true; + /** used to restrict external access */ protected String fAccessExternalDTD = EXTERNAL_ACCESS_DEFAULT; @@ -1133,7 +1139,8 @@ boolean parameter = entityName.startsWith("%"); boolean general = !parameter; if (unparsed || (general && !fExternalGeneralEntities) || - (parameter && !fExternalParameterEntities)) { + (parameter && !fExternalParameterEntities) || + !fSupportDTD || !fSupportExternalEntities) { if (fEntityHandler != null) { fResourceIdentifier.clear(); @@ -1428,6 +1435,10 @@ fStaxEntityResolver = null; } + fSupportDTD = ((Boolean)propertyManager.getProperty(XMLInputFactory.SUPPORT_DTD)).booleanValue(); + fReplaceEntityReferences = ((Boolean)propertyManager.getProperty(XMLInputFactory.IS_REPLACING_ENTITY_REFERENCES)).booleanValue(); + fSupportExternalEntities = ((Boolean)propertyManager.getProperty(XMLInputFactory.IS_SUPPORTING_EXTERNAL_ENTITIES)).booleanValue(); + // Zephyr feature ignore-external-dtd is the opposite of Xerces' load-external-dtd fLoadExternalDTD = !((Boolean)propertyManager.getProperty(Constants.ZEPHYR_PROPERTY_PREFIX + Constants.IGNORE_EXTERNAL_DTD)).booleanValue(); @@ -1499,6 +1510,11 @@ fSecurityManager = (XMLSecurityManager)componentManager.getProperty(SECURITY_MANAGER, null); entityExpansionIndex = fSecurityManager.getIndex(Constants.JDK_ENTITY_EXPANSION_LIMIT); + //StAX Property + fSupportDTD = true; + fReplaceEntityReferences = true; + fSupportExternalEntities = true; + // JAXP 1.5 feature XMLSecurityPropertyManager spm = (XMLSecurityPropertyManager) componentManager.getProperty(XML_SECURITY_PROPERTY_MANAGER, null); if (spm == null) {
--- a/src/com/sun/org/apache/xerces/internal/impl/XMLEntityScanner.java Mon Sep 22 09:38:42 2014 -0700 +++ b/src/com/sun/org/apache/xerces/internal/impl/XMLEntityScanner.java Mon Sep 22 09:54:05 2014 -0700 @@ -20,34 +20,28 @@ package com.sun.org.apache.xerces.internal.impl; -import java.io.EOFException; -import java.io.IOException; -import java.util.Locale; -import java.util.Vector; - -import com.sun.xml.internal.stream.Entity; -import com.sun.xml.internal.stream.XMLBufferListener; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.Reader; import com.sun.org.apache.xerces.internal.impl.io.ASCIIReader; import com.sun.org.apache.xerces.internal.impl.io.UCSReader; import com.sun.org.apache.xerces.internal.impl.io.UTF8Reader; - - import com.sun.org.apache.xerces.internal.impl.msg.XMLMessageFormatter; import com.sun.org.apache.xerces.internal.util.EncodingMap; - import com.sun.org.apache.xerces.internal.util.SymbolTable; import com.sun.org.apache.xerces.internal.util.XMLChar; import com.sun.org.apache.xerces.internal.util.XMLStringBuffer; -import com.sun.org.apache.xerces.internal.xni.QName; -import com.sun.org.apache.xerces.internal.xni.XMLString; +import com.sun.org.apache.xerces.internal.xni.*; import com.sun.org.apache.xerces.internal.xni.parser.XMLComponentManager; import com.sun.org.apache.xerces.internal.xni.parser.XMLConfigurationException; -import com.sun.org.apache.xerces.internal.xni.*; +import com.sun.xml.internal.stream.Entity; +import com.sun.xml.internal.stream.XMLBufferListener; +import java.io.EOFException; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.Reader; +import java.util.Locale; +import java.util.Vector; /** * Implements the entity scanner methods. @@ -493,8 +487,7 @@ // load more characters, if needed if (fCurrentEntity.position == fCurrentEntity.count) { - invokeListeners(0); - load(0, true); + load(0, true, true); } // peek at character @@ -535,8 +528,7 @@ // load more characters, if needed if (fCurrentEntity.position == fCurrentEntity.count) { - invokeListeners(0); - load(0, true); + load(0, true, true); } // scan character @@ -546,9 +538,8 @@ fCurrentEntity.lineNumber++; fCurrentEntity.columnNumber = 1; if (fCurrentEntity.position == fCurrentEntity.count) { - invokeListeners(1); fCurrentEntity.ch[0] = (char)c; - load(1, false); + load(1, false, true); } if (c == '\r' && isExternal) { if (fCurrentEntity.ch[fCurrentEntity.position++] != '\n') { @@ -593,8 +584,7 @@ // load more characters, if needed if (fCurrentEntity.position == fCurrentEntity.count) { - invokeListeners(0); - load(0, true); + load(0, true, true); } // scan nmtoken @@ -626,7 +616,7 @@ fCurrentEntity.ch, 0, length); } offset = 0; - if (load(length, false)) { + if (load(length, false, false)) { break; } } @@ -673,18 +663,16 @@ // load more characters, if needed if (fCurrentEntity.position == fCurrentEntity.count) { - invokeListeners(0); - load(0, true); + load(0, true, true); } // scan name int offset = fCurrentEntity.position; if (XMLChar.isNameStart(fCurrentEntity.ch[offset])) { if (++fCurrentEntity.position == fCurrentEntity.count) { - invokeListeners(1); fCurrentEntity.ch[0] = fCurrentEntity.ch[offset]; offset = 0; - if (load(1, false)) { + if (load(1, false, true)) { fCurrentEntity.columnNumber++; String symbol = fSymbolTable.addSymbol(fCurrentEntity.ch, 0, 1); @@ -721,7 +709,7 @@ fCurrentEntity.ch, 0, length); } offset = 0; - if (load(length, false)) { + if (load(length, false, false)) { break; } } @@ -776,8 +764,7 @@ // load more characters, if needed if (fCurrentEntity.position == fCurrentEntity.count) { - invokeListeners(0); - load(0, true); + load(0, true, true); } // scan qualified name @@ -789,11 +776,10 @@ if (XMLChar.isNameStart(fCurrentEntity.ch[offset])) { if (++fCurrentEntity.position == fCurrentEntity.count) { - invokeListeners(1); fCurrentEntity.ch[0] = fCurrentEntity.ch[offset]; offset = 0; - if (load(1, false)) { + if (load(1, false, true)) { fCurrentEntity.columnNumber++; //adding into symbol table. //XXX We are trying to add single character in SymbolTable?????? @@ -843,7 +829,7 @@ index = index - offset; } offset = 0; - if (load(length, false)) { + if (load(length, false, false)) { break; } } @@ -918,12 +904,10 @@ // load more characters, if needed if (fCurrentEntity.position == fCurrentEntity.count) { - invokeListeners(0); - load(0, true); + load(0, true, true); } else if (fCurrentEntity.position == fCurrentEntity.count - 1) { - invokeListeners(0); fCurrentEntity.ch[0] = fCurrentEntity.ch[fCurrentEntity.count - 1]; - load(1, false); + load(1, false, true); fCurrentEntity.position = 0; } @@ -945,9 +929,8 @@ fCurrentEntity.columnNumber = 1; if (fCurrentEntity.position == fCurrentEntity.count) { offset = 0; - invokeListeners(newlines); fCurrentEntity.position = newlines; - if (load(newlines, false)) { + if (load(newlines, false, true)) { break; } } @@ -965,9 +948,8 @@ fCurrentEntity.columnNumber = 1; if (fCurrentEntity.position == fCurrentEntity.count) { offset = 0; - invokeListeners(newlines); fCurrentEntity.position = newlines; - if (load(newlines, false)) { + if (load(newlines, false, true)) { break; } } @@ -1070,13 +1052,10 @@ } // load more characters, if needed if (fCurrentEntity.position == fCurrentEntity.count) { - invokeListeners(0); - load(0, true); + load(0, true, true); } else if (fCurrentEntity.position == fCurrentEntity.count - 1) { - invokeListeners(0); fCurrentEntity.ch[0] = fCurrentEntity.ch[fCurrentEntity.count - 1]; - - load(1, false); + load(1, false, true); fCurrentEntity.position = 0; } @@ -1099,10 +1078,9 @@ fCurrentEntity.lineNumber++; fCurrentEntity.columnNumber = 1; if (fCurrentEntity.position == fCurrentEntity.count) { - invokeListeners(newlines); offset = 0; fCurrentEntity.position = newlines; - if (load(newlines, false)) { + if (load(newlines, false, true)) { break; } } @@ -1121,9 +1099,8 @@ fCurrentEntity.columnNumber = 1; if (fCurrentEntity.position == fCurrentEntity.count) { offset = 0; - invokeListeners(newlines); fCurrentEntity.position = newlines; - if (load(newlines, false)) { + if (load(newlines, false, true)) { break; } } @@ -1249,7 +1226,7 @@ // load more characters, if needed if (fCurrentEntity.position == fCurrentEntity.count) { - load(0, true); + load(0, true, false); } boolean bNextEntity = false; @@ -1263,7 +1240,7 @@ 0, fCurrentEntity.count - fCurrentEntity.position); - bNextEntity = load(fCurrentEntity.count - fCurrentEntity.position, false); + bNextEntity = load(fCurrentEntity.count - fCurrentEntity.position, false, false); fCurrentEntity.position = 0; fCurrentEntity.startPosition = 0; } @@ -1276,7 +1253,7 @@ fCurrentEntity.baseCharOffset += (fCurrentEntity.position - fCurrentEntity.startPosition); fCurrentEntity.position = fCurrentEntity.count; fCurrentEntity.startPosition = fCurrentEntity.count; - load(0, true); + load(0, true, false); return false; } @@ -1298,9 +1275,8 @@ fCurrentEntity.columnNumber = 1; if (fCurrentEntity.position == fCurrentEntity.count) { offset = 0; - invokeListeners(newlines); fCurrentEntity.position = newlines; - if (load(newlines, false)) { + if (load(newlines, false, true)) { break; } } @@ -1318,10 +1294,9 @@ fCurrentEntity.columnNumber = 1; if (fCurrentEntity.position == fCurrentEntity.count) { offset = 0; - invokeListeners(newlines); fCurrentEntity.position = newlines; fCurrentEntity.count = newlines; - if (load(newlines, false)) { + if (load(newlines, false, true)) { break; } } @@ -1422,8 +1397,7 @@ // load more characters, if needed if (fCurrentEntity.position == fCurrentEntity.count) { - invokeListeners(0); - load(0, true); + load(0, true, true); } // skip character @@ -1445,9 +1419,8 @@ } else if (c == '\n' && cc == '\r' && isExternal) { // handle newlines if (fCurrentEntity.position == fCurrentEntity.count) { - invokeListeners(1); fCurrentEntity.ch[0] = (char)cc; - load(1, false); + load(1, false, true); } fCurrentEntity.position++; if (fCurrentEntity.ch[fCurrentEntity.position] == '\n') { @@ -1498,8 +1471,7 @@ //boolean entityChanged = false; // load more characters, if needed if (fCurrentEntity.position == fCurrentEntity.count) { - invokeListeners(0); - load(0, true); + load(0, true, true); } //we are doing this check only in skipSpace() because it is called by @@ -1522,9 +1494,8 @@ fCurrentEntity.lineNumber++; fCurrentEntity.columnNumber = 1; if (fCurrentEntity.position == fCurrentEntity.count - 1) { - invokeListeners(0); fCurrentEntity.ch[0] = (char)c; - entityChanged = load(1, true); + entityChanged = load(1, true, true); if (!entityChanged){ // the load change the position to be 1, // need to restore it when entity not changed @@ -1549,8 +1520,7 @@ } if (fCurrentEntity.position == fCurrentEntity.count) { - invokeListeners(0); - load(0, true); + load(0, true, true); //we are doing this check only in skipSpace() because it is called by //fMiscDispatcher and we want the parser to exit gracefully when document @@ -1626,7 +1596,7 @@ if((fCurrentEntity.count - fCurrentEntity.position) < length){ int pos = fCurrentEntity.position; invokeListeners(pos); - entityChanged = load(fCurrentEntity.count, changeEntity); + entityChanged = load(fCurrentEntity.count, changeEntity, false); fCurrentEntity.position = pos; if(entityChanged)break; } @@ -1731,17 +1701,22 @@ * the current entity in place and the entity * boundary will be signaled by the return * value. + * @param notify Determine whether to notify listeners of + * the event * * @returns Returns true if the entity changed as a result of this * load operation. */ - final boolean load(int offset, boolean changeEntity) + final boolean load(int offset, boolean changeEntity, boolean notify) throws IOException { if (DEBUG_BUFFER) { System.out.print("(load, "+offset+": "); print(); System.out.println(); } + if (notify) { + invokeListeners(offset); + } //maintaing the count till last load fCurrentEntity.fTotalCountTillLastLoad = fCurrentEntity.fTotalCountTillLastLoad + fCurrentEntity.fLastCount ; // read characters @@ -1778,7 +1753,7 @@ } // handle the trailing edges if (fCurrentEntity.position == fCurrentEntity.count) { - load(0, true); + load(0, true, false); } } @@ -2075,7 +2050,7 @@ * * @param loadPos Starting position from which new data is being loaded into scanner buffer. */ - private void invokeListeners(int loadPos){ + public void invokeListeners(int loadPos){ for(int i=0;i<listeners.size();i++){ XMLBufferListener listener =(XMLBufferListener) listeners.get(i); listener.refresh(loadPos); @@ -2108,7 +2083,7 @@ // load more characters, if needed if (fCurrentEntity.position == fCurrentEntity.count) { - load(0, true); + load(0, true, false); } // skip spaces @@ -2123,7 +2098,7 @@ fCurrentEntity.columnNumber = 1; if (fCurrentEntity.position == fCurrentEntity.count - 1) { fCurrentEntity.ch[0] = (char)c; - entityChanged = load(1, true); + entityChanged = load(1, true, false); if (!entityChanged) // the load change the position to be 1, // need to restore it when entity not changed @@ -2151,7 +2126,7 @@ if (!entityChanged) fCurrentEntity.position++; if (fCurrentEntity.position == fCurrentEntity.count) { - load(0, true); + load(0, true, false); } } while (XMLChar.isSpace(c = fCurrentEntity.ch[fCurrentEntity.position])); if (DEBUG_BUFFER) {
--- a/src/com/sun/org/apache/xerces/internal/impl/xs/XMLSchemaLoader.java Mon Sep 22 09:38:42 2014 -0700 +++ b/src/com/sun/org/apache/xerces/internal/impl/xs/XMLSchemaLoader.java Mon Sep 22 09:54:05 2014 -0700 @@ -54,6 +54,7 @@ import com.sun.org.apache.xerces.internal.util.SymbolTable; import com.sun.org.apache.xerces.internal.util.XMLSymbols; import com.sun.org.apache.xerces.internal.utils.SecuritySupport; +import com.sun.org.apache.xerces.internal.utils.XMLSecurityManager; import com.sun.org.apache.xerces.internal.utils.XMLSecurityPropertyManager; import com.sun.org.apache.xerces.internal.xni.XNIException; import com.sun.org.apache.xerces.internal.xni.grammars.Grammar; @@ -983,6 +984,18 @@ */ public void reset(XMLComponentManager componentManager) throws XMLConfigurationException { + XMLSecurityPropertyManager spm = (XMLSecurityPropertyManager)componentManager.getProperty(XML_SECURITY_PROPERTY_MANAGER); + if (spm == null) { + spm = new XMLSecurityPropertyManager(); + setProperty(XML_SECURITY_PROPERTY_MANAGER, spm); + } + + XMLSecurityManager sm = (XMLSecurityManager)componentManager.getProperty(SECURITY_MANAGER); + if (sm == null) + setProperty(SECURITY_MANAGER,new XMLSecurityManager(true)); + + faccessExternalSchema = spm.getValue(XMLSecurityPropertyManager.Property.ACCESS_EXTERNAL_SCHEMA); + fGrammarBucket.reset(); fSubGroupHandler.reset(); @@ -1066,9 +1079,6 @@ // get generate-synthetic-annotations feature fSchemaHandler.setGenerateSyntheticAnnotations(componentManager.getFeature(GENERATE_SYNTHETIC_ANNOTATIONS, false)); fSchemaHandler.reset(componentManager); - - XMLSecurityPropertyManager spm = (XMLSecurityPropertyManager)componentManager.getProperty(XML_SECURITY_PROPERTY_MANAGER); - faccessExternalSchema = spm.getValue(XMLSecurityPropertyManager.Property.ACCESS_EXTERNAL_SCHEMA); } private void initGrammarBucket(){