Mercurial > hg > release > icedtea7-forest-2.4 > jaxp
changeset 566:639d1cc5b2e9
Merge
author | ewendeli |
---|---|
date | Sun, 03 Feb 2013 23:52:22 +0100 |
parents | 596e328459ad (current diff) 798a97097eef (diff) |
children | d42f74a0593c |
files | .hgtags |
diffstat | 13 files changed, 234 insertions(+), 87 deletions(-) [+] |
line wrap: on
line diff
--- a/.hgtags Fri Feb 01 10:25:36 2013 -0800 +++ b/.hgtags Sun Feb 03 23:52:22 2013 +0100 @@ -199,6 +199,7 @@ 8824bcbfd7cd8059ededf70f1e7f2b06f02cb33f jdk7u6-b23 378f719cfb9491b766cd9f7cd47ad7fa3503e141 jdk7u6-b24 5f1b80e8baec46fc28826a3a6ab8e1913c872f4c jdk7u6-b30 +2eafa8a6fd8fdb54b10045e247d1a57f9817f473 jdk7u6-b31 2eafa8a6fd8fdb54b10045e247d1a57f9817f473 jdk7u7-b10 c4aa15da8529451cc678d5747e7b82e9cc38627e jdk7u7-b30 f6e11679b12e1548f407b78a940c568401dd2a19 jdk7u7-b11 @@ -232,3 +233,22 @@ 48491f5a58172f0fbdf9b774842c2ec1a42f609a jdk7u11-b08 eb9d57159e5126cf4316c9571ac39324a8b442a8 jdk7u13-b09 f9fe0d38b1103cb33073538c959d982e28ed7b11 jdk7u13-b20 +1365e7472a3b737dda4a73e06ad41718d667d9be jdk7u8-b01 +0a313d4307930be3a64106b9b8c90f9342673aa0 jdk7u8-b02 +36cba5ea434944cef64fa281112b158fae93c0fa jdk7u8-b03 +07c07608384e1b5b09fc82ff8e42ca72d374b178 jdk7u8-b04 +c579d804e5ca54e3c7f0ba1eb90a7b97c980b889 jdk7u8-b05 +d4e27ea952ad62432d24f7c880227140af5f50ec jdk7u10-b06 +9205eb81886de12f9e3324ac8e0c7cec536b22d5 jdk7u10-b07 +720eb6c26227887ad11eb401f91a10878c3c7b6b jdk7u10-b08 +3a33a35b2d24cb671050e61aa4930a951bc35d2b jdk7u10-b09 +27bab008eee997a2a8a78d6fe72a56c87c1c2b2b jdk7u12-b01 +8e3a4e47ce71a0add89eca5b079e02ae3a81c594 jdk7u12-b02 +1aa52991dfa7468d676557bf9fd6fd0e98c3d097 jdk7u12-b03 +464e19bd9db89b200a002e2001d0e8f352cf5ff9 jdk7u12-b04 +3db0cfb507771458da8978248de7598ebe7c20d8 jdk7u12-b05 +c84c463893504a93a38f4abfa4d057869e9ae918 jdk7u12-b06 +1b914599a6d5560e743b9fecd390924ed0bf7d15 jdk7u12-b07 +427a603569db59f61721e709fcb8a73390d468ae jdk7u12-b08 +366ebbf581df0134d9039b649abc315e87f23772 jdk7u12-b09 +23191c790e12841f81ac1cf956e7dbc0b45914ee jdk7u14-b10
--- a/src/com/sun/org/apache/bcel/internal/Constants.java Fri Feb 01 10:25:36 2013 -0800 +++ b/src/com/sun/org/apache/bcel/internal/Constants.java Sun Feb 03 23:52:22 2013 +0100 @@ -746,27 +746,29 @@ /** Attributes and their corresponding names. */ - public static final byte ATTR_UNKNOWN = -1; - public static final byte ATTR_SOURCE_FILE = 0; - public static final byte ATTR_CONSTANT_VALUE = 1; - public static final byte ATTR_CODE = 2; - public static final byte ATTR_EXCEPTIONS = 3; - public static final byte ATTR_LINE_NUMBER_TABLE = 4; - public static final byte ATTR_LOCAL_VARIABLE_TABLE = 5; - public static final byte ATTR_INNER_CLASSES = 6; - public static final byte ATTR_SYNTHETIC = 7; - public static final byte ATTR_DEPRECATED = 8; - public static final byte ATTR_PMG = 9; - public static final byte ATTR_SIGNATURE = 10; - public static final byte ATTR_STACK_MAP = 11; + public static final byte ATTR_UNKNOWN = -1; + public static final byte ATTR_SOURCE_FILE = 0; + public static final byte ATTR_CONSTANT_VALUE = 1; + public static final byte ATTR_CODE = 2; + public static final byte ATTR_EXCEPTIONS = 3; + public static final byte ATTR_LINE_NUMBER_TABLE = 4; + public static final byte ATTR_LOCAL_VARIABLE_TABLE = 5; + public static final byte ATTR_INNER_CLASSES = 6; + public static final byte ATTR_SYNTHETIC = 7; + public static final byte ATTR_DEPRECATED = 8; + public static final byte ATTR_PMG = 9; + public static final byte ATTR_SIGNATURE = 10; + public static final byte ATTR_STACK_MAP = 11; + public static final byte ATTR_LOCAL_VARIABLE_TYPE_TABLE = 12; - public static final short KNOWN_ATTRIBUTES = 12; + public static final short KNOWN_ATTRIBUTES = 13; public static final String[] ATTRIBUTE_NAMES = { "SourceFile", "ConstantValue", "Code", "Exceptions", "LineNumberTable", "LocalVariableTable", "InnerClasses", "Synthetic", "Deprecated", - "PMGClass", "Signature", "StackMap" + "PMGClass", "Signature", "StackMap", + "LocalVariableTypeTable" }; /** Constants used in the StackMap attribute.
--- a/src/com/sun/org/apache/bcel/internal/classfile/Attribute.java Fri Feb 01 10:25:36 2013 -0800 +++ b/src/com/sun/org/apache/bcel/internal/classfile/Attribute.java Sun Feb 03 23:52:22 2013 +0100 @@ -206,6 +206,9 @@ case Constants.ATTR_LOCAL_VARIABLE_TABLE: return new LocalVariableTable(name_index, length, file, constant_pool); + case Constants.ATTR_LOCAL_VARIABLE_TYPE_TABLE: + return new LocalVariableTypeTable(name_index, length, file, constant_pool); + case Constants.ATTR_INNER_CLASSES: return new InnerClasses(name_index, length, file, constant_pool);
--- a/src/com/sun/org/apache/bcel/internal/classfile/DescendingVisitor.java Fri Feb 01 10:25:36 2013 -0800 +++ b/src/com/sun/org/apache/bcel/internal/classfile/DescendingVisitor.java Sun Feb 03 23:52:22 2013 +0100 @@ -210,6 +210,12 @@ stack.pop(); } + public void visitLocalVariableTypeTable(LocalVariableTypeTable obj) { + stack.push(obj); + obj.accept(visitor); + stack.pop(); + } + public void visitStackMap(StackMap table) { stack.push(table); table.accept(visitor);
--- a/src/com/sun/org/apache/bcel/internal/classfile/EmptyVisitor.java Fri Feb 01 10:25:36 2013 -0800 +++ b/src/com/sun/org/apache/bcel/internal/classfile/EmptyVisitor.java Sun Feb 03 23:52:22 2013 +0100 @@ -98,6 +98,7 @@ public void visitLineNumberTable(LineNumberTable obj) {} public void visitLocalVariable(LocalVariable obj) {} public void visitLocalVariableTable(LocalVariableTable obj) {} + public void visitLocalVariableTypeTable(LocalVariableTypeTable obj) {} public void visitMethod(Method obj) {} public void visitSignature(Signature obj) {} public void visitSourceFile(SourceFile obj) {}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/com/sun/org/apache/bcel/internal/classfile/LocalVariableTypeTable.java Sun Feb 03 23:52:22 2013 +0100 @@ -0,0 +1,146 @@ +/* + * reserved comment block + * DO NOT REMOVE OR ALTER! + */ +package com.sun.org.apache.bcel.internal.classfile; +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import com.sun.org.apache.bcel.internal.Constants; +import java.io.*; + +// The new table is used when generic types are about... + +//LocalVariableTable_attribute { +// u2 attribute_name_index; +// u4 attribute_length; +// u2 local_variable_table_length; +// { u2 start_pc; +// u2 length; +// u2 name_index; +// u2 descriptor_index; +// u2 index; +// } local_variable_table[local_variable_table_length]; +// } + +//LocalVariableTypeTable_attribute { +// u2 attribute_name_index; +// u4 attribute_length; +// u2 local_variable_type_table_length; +// { +// u2 start_pc; +// u2 length; +// u2 name_index; +// u2 signature_index; +// u2 index; +// } local_variable_type_table[local_variable_type_table_length]; +// } +// J5TODO: Needs some testing ! +public class LocalVariableTypeTable extends Attribute { + private static final long serialVersionUID = -1082157891095177114L; +private int local_variable_type_table_length; // Table of local + private LocalVariable[] local_variable_type_table; // variables + + public LocalVariableTypeTable(LocalVariableTypeTable c) { + this(c.getNameIndex(), c.getLength(), c.getLocalVariableTypeTable(), + c.getConstantPool()); + } + + public LocalVariableTypeTable(int name_index, int length, + LocalVariable[] local_variable_table, + ConstantPool constant_pool) + { + super(Constants.ATTR_LOCAL_VARIABLE_TYPE_TABLE, name_index, length, constant_pool); + setLocalVariableTable(local_variable_table); + } + + LocalVariableTypeTable(int nameIdx, int len, DataInputStream dis,ConstantPool cpool) throws IOException { + this(nameIdx, len, (LocalVariable[])null, cpool); + + local_variable_type_table_length = (dis.readUnsignedShort()); + local_variable_type_table = new LocalVariable[local_variable_type_table_length]; + + for(int i=0; i < local_variable_type_table_length; i++) + local_variable_type_table[i] = new LocalVariable(dis, cpool); + } + + @Override +public void accept(Visitor v) { + v.visitLocalVariableTypeTable(this); + } + + @Override +public final void dump(DataOutputStream file) throws IOException + { + super.dump(file); + file.writeShort(local_variable_type_table_length); + for(int i=0; i < local_variable_type_table_length; i++) + local_variable_type_table[i].dump(file); + } + + public final LocalVariable[] getLocalVariableTypeTable() { + return local_variable_type_table; + } + + public final LocalVariable getLocalVariable(int index) { + for(int i=0; i < local_variable_type_table_length; i++) + if(local_variable_type_table[i].getIndex() == index) + return local_variable_type_table[i]; + + return null; + } + + public final void setLocalVariableTable(LocalVariable[] local_variable_table) + { + this.local_variable_type_table = local_variable_table; + local_variable_type_table_length = (local_variable_table == null)? 0 : + local_variable_table.length; + } + + /** + * @return String representation. + */ + @Override +public final String toString() { + StringBuilder buf = new StringBuilder(); + + for(int i=0; i < local_variable_type_table_length; i++) { + buf.append(local_variable_type_table[i].toString()); + + if(i < local_variable_type_table_length - 1) buf.append('\n'); + } + + return buf.toString(); + } + + /** + * @return deep copy of this attribute + */ + @Override +public Attribute copy(ConstantPool constant_pool) { + LocalVariableTypeTable c = (LocalVariableTypeTable)clone(); + + c.local_variable_type_table = new LocalVariable[local_variable_type_table_length]; + for(int i=0; i < local_variable_type_table_length; i++) + c.local_variable_type_table[i] = local_variable_type_table[i].copy(); + + c.constant_pool = constant_pool; + return c; + } + + public final int getTableLength() { return local_variable_type_table_length; } +}
--- a/src/com/sun/org/apache/bcel/internal/classfile/Visitor.java Fri Feb 01 10:25:36 2013 -0800 +++ b/src/com/sun/org/apache/bcel/internal/classfile/Visitor.java Sun Feb 03 23:52:22 2013 +0100 @@ -94,6 +94,7 @@ public void visitLineNumberTable(LineNumberTable obj); public void visitLocalVariable(LocalVariable obj); public void visitLocalVariableTable(LocalVariableTable obj); + public void visitLocalVariableTypeTable(LocalVariableTypeTable obj); public void visitMethod(Method obj); public void visitSignature(Signature obj); public void visitSourceFile(SourceFile obj);
--- a/src/com/sun/org/apache/bcel/internal/generic/MethodGen.java Fri Feb 01 10:25:36 2013 -0800 +++ b/src/com/sun/org/apache/bcel/internal/generic/MethodGen.java Sun Feb 03 23:52:22 2013 +0100 @@ -258,6 +258,23 @@ addLocalVariable(l.getName(), Type.getType(l.getSignature()), l.getIndex(), start, end); } + } else if (a instanceof LocalVariableTypeTable) { + LocalVariable[] lv = ((LocalVariableTypeTable) a).getLocalVariableTypeTable(); + removeLocalVariables(); + for (int k = 0; k < lv.length; k++) { + LocalVariable l = lv[k]; + InstructionHandle start = il.findHandle(l.getStartPC()); + InstructionHandle end = il.findHandle(l.getStartPC() + l.getLength()); + // Repair malformed handles + if (null == start) { + start = il.getStart(); + } + if (null == end) { + end = il.getEnd(); + } + addLocalVariable(l.getName(), Type.getType(l.getSignature()), l + .getIndex(), start, end); + } } else addCodeAttribute(a); }
--- a/src/com/sun/org/apache/xerces/internal/impl/Version.java Fri Feb 01 10:25:36 2013 -0800 +++ b/src/com/sun/org/apache/xerces/internal/impl/Version.java Sun Feb 03 23:52:22 2013 +0100 @@ -74,7 +74,7 @@ /** Version string. * @deprecated getVersion() should be used instead. */ - public static String fVersion = "Xerces-J 2.7.1"; + public static final String fVersion = getVersion(); private static final String fImmutableVersion = "Xerces-J 2.7.1";
--- a/src/com/sun/org/apache/xerces/internal/impl/XMLDocumentFragmentScannerImpl.java Fri Feb 01 10:25:36 2013 -0800 +++ b/src/com/sun/org/apache/xerces/internal/impl/XMLDocumentFragmentScannerImpl.java Sun Feb 03 23:52:22 2013 +0100 @@ -193,9 +193,12 @@ null, }; - protected static final char [] cdata = {'[','C','D','A','T','A','['}; - protected static final char [] xmlDecl = {'<','?','x','m','l'}; - protected static final char [] endTag = {'<','/'}; + private static final char [] cdata = {'[','C','D','A','T','A','['}; + private static final char [] endTag = {'<','/'}; + + //this variable is also used by XMLDocumentScannerImpl in the same package + static final char [] xmlDecl = {'<','?','x','m','l'}; + // debugging /** Debug scanner state. */ @@ -806,6 +809,7 @@ * where the entity encoding is not auto-detected (e.g. * internal entities or a document entity that is * parsed from a java.io.Reader). + * @param augs Additional information that may include infoset augmentations * * @throws XNIException Thrown by handler to signal an error. */ @@ -833,7 +837,7 @@ // call handler if (fDocumentHandler != null && !fScanningAttribute) { if (!name.equals("[xml]")) { - fDocumentHandler.startGeneralEntity(name, identifier, encoding, null); + fDocumentHandler.startGeneralEntity(name, identifier, encoding, augs); } } @@ -845,6 +849,7 @@ * are just specified by their name. * * @param name The name of the entity. + * @param augs Additional information that may include infoset augmentations * * @throws XNIException Thrown by handler to signal an error. */ @@ -869,7 +874,7 @@ // call handler if (fDocumentHandler != null && !fScanningAttribute) { if (!name.equals("[xml]")) { - fDocumentHandler.endGeneralEntity(name, null); + fDocumentHandler.endGeneralEntity(name, augs); } }
--- a/src/com/sun/org/apache/xerces/internal/impl/XMLEntityManager.java Fri Feb 01 10:25:36 2013 -0800 +++ b/src/com/sun/org/apache/xerces/internal/impl/XMLEntityManager.java Sun Feb 03 23:52:22 2013 +0100 @@ -602,7 +602,7 @@ if (reader == null) { stream = xmlInputSource.getByteStream(); if (stream == null) { - URL location = new URL(escapeNonUSAscii(expandedSystemId)); + URL location = new URL(expandedSystemId); URLConnection connect = location.openConnection(); if (!(connect instanceof HttpURLConnection)) { stream = connect.getInputStream(); @@ -2586,64 +2586,6 @@ } // fixURI(String):String - /** - * Escape invalid URI characters. - * - * Passed a URI that contains invalid characters (like spaces, non-ASCII Unicode characters, and the like), - * this function percent encodes the invalid characters per the URI specification (i.e., as a sequence of - * %-encoded UTF-8 octets). - * - * N.B. There are two problems. If the URI contains a '%' character, that might be an indication that - * the URI has already been escaped by the author, or it might be an invalid '%'. In the former case, - * it's important not to escape it, or we'll wind up with invalid, doubly-escaped '%'s. In the latter, - * the URI is broken if we don't encode it. Similarly, a '#' character might be the start of a fragment - * identifier or it might be an invalid '#'. - * - * Given that the former is vastly more likely than the latter in each case (most users are familiar with - * the magic status of '%' and '#' and they occur relatively infrequently in filenames, and if the user parses - * a proper Java File, we will already have %-escaped the URI), we simply assume that %'s and #'s are legit. - * - * Very rarely, we may be wrong. If so, tell the user to fix the clearly broken URI. - */ - protected static String escapeNonUSAscii(String str) { - if (str == null) { - return str; - } - - // get UTF-8 bytes for the string - StringBuffer buffer = new StringBuffer(); - byte[] bytes = null; - byte b; - try { - bytes = str.getBytes("UTF-8"); - } catch (java.io.UnsupportedEncodingException e) { - // should never happen - return str; - } - int len = bytes.length; - int ch; - - // for each byte - for (int i = 0; i < len; i++) { - b = bytes[i]; - // for non-ascii character: make it positive, then escape - if (b < 0) { - ch = b + 256; - buffer.append('%'); - buffer.append(gHexChs[ch >> 4]); - buffer.append(gHexChs[ch & 0xf]); - } - else if (b != '%' && b != '#' && gNeedEscaping[b]) { - buffer.append('%'); - buffer.append(gAfterEscaping1[b]); - buffer.append(gAfterEscaping2[b]); - } - else { - buffer.append((char)b); - } - } - return buffer.toString(); - } // // Package visible methods
--- a/src/com/sun/org/apache/xerces/internal/impl/XMLEntityScanner.java Fri Feb 01 10:25:36 2013 -0800 +++ b/src/com/sun/org/apache/xerces/internal/impl/XMLEntityScanner.java Sun Feb 03 23:52:22 2013 +0100 @@ -71,7 +71,7 @@ /** Listeners which should know when load is being called */ private Vector listeners = new Vector(); - public static final boolean [] VALID_NAMES = new boolean[127]; + private static final boolean [] VALID_NAMES = new boolean[127]; /** * Debug printing of buffer. This debugging flag works best when you
--- a/src/javax/xml/stream/XMLEventFactory.java Fri Feb 01 10:25:36 2013 -0800 +++ b/src/javax/xml/stream/XMLEventFactory.java Sun Feb 03 23:52:22 2013 +0100 @@ -49,6 +49,10 @@ public abstract class XMLEventFactory { protected XMLEventFactory(){} + static final String JAXPFACTORYID = "javax.xml.stream.XMLEventFactory"; + static final String DEFAULIMPL = "com.sun.xml.internal.stream.events.XMLEventFactoryImpl"; + + /** * Create a new instance of the factory * @throws FactoryConfigurationError if an instance of this factory cannot be loaded @@ -57,8 +61,8 @@ throws FactoryConfigurationError { return (XMLEventFactory) FactoryFinder.find( - "javax.xml.stream.XMLEventFactory", - "com.sun.xml.internal.stream.events.XMLEventFactoryImpl"); + JAXPFACTORYID, + DEFAULIMPL); } /** @@ -90,8 +94,8 @@ throws FactoryConfigurationError { return (XMLEventFactory) FactoryFinder.find( - "javax.xml.stream.XMLEventFactory", - "com.sun.xml.internal.stream.events.XMLEventFactoryImpl"); + JAXPFACTORYID, + DEFAULIMPL); } /** @@ -114,7 +118,7 @@ throws FactoryConfigurationError { try { //do not fallback if given classloader can't find the class, throw exception - return (XMLEventFactory) FactoryFinder.newInstance(factoryId, classLoader, false); + return (XMLEventFactory) FactoryFinder.find(factoryId, classLoader, null); } catch (FactoryFinder.ConfigurationError e) { throw new FactoryConfigurationError(e.getException(), e.getMessage()); @@ -141,7 +145,7 @@ throws FactoryConfigurationError { try { //do not fallback if given classloader can't find the class, throw exception - return (XMLEventFactory) FactoryFinder.newInstance(factoryId, classLoader, false); + return (XMLEventFactory) FactoryFinder.find(factoryId, classLoader, null); } catch (FactoryFinder.ConfigurationError e) { throw new FactoryConfigurationError(e.getException(), e.getMessage());