changeset 850:1d1e1fc3b88d ppc-aix-port-b04

merge
author Goetz
date Mon, 11 Mar 2013 17:11:38 +0100
parents 8a9a8ee6dd36 (current diff) c99d2ddabfb9 (diff)
children 601174c87338
files .hgtags
diffstat 21 files changed, 546 insertions(+), 560 deletions(-) [+]
line wrap: on
line diff
--- a/.hgtags	Mon Dec 17 19:35:13 2012 +0100
+++ b/.hgtags	Mon Mar 11 17:11:38 2013 +0100
@@ -159,12 +159,21 @@
 b4e5df5b18bb75db15ed97da02e5df086d2c7930 jdk7u4-b12
 7d18bccaec3781f3d4f2d71879f91e257db2f0f7 jdk7u4-b13
 82c5b3166b3194e7348b2a9d146b6760c9a77128 jdk7u4-b14
+36490d49683f7be9d8fbbe1f8eefa1fe9fe550fa jdk7u5-b01
 36490d49683f7be9d8fbbe1f8eefa1fe9fe550fa jdk7u4-b15
 5c881231f1161fbc4fe86383ce59dd6a1bbe4f8e jdk7u4-b16
 77a453ae863fee408035c8986f7e3bb22b7252cb jdk7u4-b17
 02400887d8c82eab88933df7167d1f8ab826113f jdk7u4-b18
 eb1f8bea2e93a498a9b9f42d33efad564d960407 jdk7u4-b19
 b08fa5f665726f578674c2d93b21b37a4330b16f jdk7u4-b20
+501dd924118687733a875bdbebfba3f98ca38a6c jdk7u4-b30
+a90108a5e1612782c4ab49a3e7de422cce7280d8 jdk7u4-b21
+9de44cdaafe7d5fcc0e8f0bc7c7b4df782e8293e jdk7u4-b22
+75ffe94cf0fbbe1a3ed7f613fb60dc2b76c89cb5 jdk7u4-b31
+aa6df713daa9dbddd7fa31db29c6c493687feaa9 jdk7u5-b02
+661bf134f96513c06f009cb4c38e21d661fb2ed5 jdk7u5-b04
+bfd88f182bbeb52d27574efc97e7b1e7c417d90b jdk7u5-b05
+00bf886e24075477b8df5ddff31542eaa5f2fce0 jdk7u5-b30
 82c5b3166b3194e7348b2a9d146b6760c9a77128 jdk7u6-b01
 6211e6e5c90efab0d033a99d9797a60aaad1f203 jdk7u6-b02
 2b8fd45212c5846f7c60e0b64fec9f0fba77b372 jdk7u6-b03
@@ -180,3 +189,74 @@
 15b71daf5e69c169fcbd383c0251cfc99e558d8a ppc-aix-port-b01
 15b71daf5e69c169fcbd383c0251cfc99e558d8a ppc-aix-port-b02
 15b71daf5e69c169fcbd383c0251cfc99e558d8a ppc-aix-port-b03
+15b71daf5e69c169fcbd383c0251cfc99e558d8a jdk7u6-b13
+da79c0fdf9a8b5403904e6ffdd8f5dc335d489d0 jdk7u6-b14
+94474d6f28284a1ef492984dd6d6f66f8787de80 jdk7u6-b15
+0b329a8d325b6a58d89c6042dac62ce5852380ab jdk7u6-b16
+5eb867cdd08ca299fe03b31760acd57aac2b5673 jdk7u6-b17
+1c4b9671de5c7ed5713f55509cb2ada38b36dffe jdk7u6-b18
+3ba4c395d2cf973c8c603b2aedc846bd4ae54656 jdk7u6-b19
+4f7b77cc3b252098f52a8f30a74f603783a2e0f1 jdk7u6-b20
+7403701aa75848ca2a7b297909908b858134e132 jdk7u6-b21
+fcf35906d1d88583878cd2e2d7c63dfba4e9f679 jdk7u6-b22
+8824bcbfd7cd8059ededf70f1e7f2b06f02cb33f jdk7u6-b23
+378f719cfb9491b766cd9f7cd47ad7fa3503e141 jdk7u6-b24
+5f1b80e8baec46fc28826a3a6ab8e1913c872f4c jdk7u6-b30
+2eafa8a6fd8fdb54b10045e247d1a57f9817f473 jdk7u6-b31
+2eafa8a6fd8fdb54b10045e247d1a57f9817f473 jdk7u7-b10
+c4aa15da8529451cc678d5747e7b82e9cc38627e jdk7u7-b30
+f6e11679b12e1548f407b78a940c568401dd2a19 jdk7u7-b11
+7840a267c777e22004912ad0aadd5258ac3d36c6 jdk7u7-b31
+61fc72e9fe26b3acf1572866143c22719c088b62 jdk7u7-b01
+78d9e4853388a2e7be18ff18c0b5330c074cb514 jdk7u7-b02
+fc7c5aa8c722f28c59560ce83140e803d853afc9 jdk7u9-b03
+0000000000000000000000000000000000000000 jdk7u7-b01
+61fc72e9fe26b3acf1572866143c22719c088b62 jdk7u9-b01
+0000000000000000000000000000000000000000 jdk7u7-b02
+78d9e4853388a2e7be18ff18c0b5330c074cb514 jdk7u9-b02
+b12a2d557c5e302b614c5f7e25ad6c8a0e138742 jdk7u9-b04
+ab4bbb93b3831aca230c62431f7fe02b56793450 jdk7u9-b05
+254ed6ae237ee631179819570cf7fb265c6fb3a8 jdk7u10-b10
+c1df39bcc9c1bcdfb2a92682650264b3b7771ce8 jdk7u10-b11
+00cfd60368048c4969785eb52ec50cf5691c4367 jdk7u10-b12
+51efccc2b4e908fa0475075739c1463d1dd50efc jdk7u10-b13
+c245a6332320a86342683e6f732f3f8f2f4de69a jdk7u10-b14
+89b043ba2e01e969090e23a5a7a2e9f7165ff5a0 jdk7u10-b15
+5449d5396bd8deee90f18f29899343129e3cdc4e jdk7u10-b16
+86c75e6aa3a7fa9a587fc7dd2d08af8aa8ffb9a9 jdk7u10-b17
+162a2c6ad8718a63253fa53724f704a4f85731bc jdk7u10-b18
+c59eb287de720ae5ce8087f179ec01f4f6525a32 jdk7u10-b30
+853059839d38432f86e345ba951397ede235a374 jdk7u11-b20
+453a52320a1b8bd425fdb55e14b64067b536f1e2 jdk7u11-b21
+5df9207c4378b7f4b24d70b365714c5ee6318982 jdk7u11-b03
+6ee19b9c8313db32e6d8989aa3782830d2b09710 jdk7u11-b04
+3312b258392eaeab9c4a20e3deb36d3ae3337efe jdk7u11-b05
+86d0250b62bbb4aabab2a7c249aeb14847be2631 jdk7u11-b06
+225aa78c36e9b776c87e585329bbb7ee0e3259a3 jdk7u11-b07
+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
+825eda7553590ce19eb4fa0686c4405d97daafdb jdk7u14-b11
+560e5cf5b57fc91e2bc6dd1809badd58c6eb25bd jdk7u14-b12
+937bae61a48febcc948b7e10ae781c9077360241 jdk7u14-b13
+7038ca4959e50a02f797e639daffe6b2b4065f86 jdk7u14-b14
+aa6fb94c5e7bc645f478b6f60c5e6e06bebcc2bf jdk7u14-b15
--- a/src/com/sun/org/apache/bcel/internal/Constants.java	Mon Dec 17 19:35:13 2012 +0100
+++ b/src/com/sun/org/apache/bcel/internal/Constants.java	Mon Mar 11 17:11:38 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	Mon Dec 17 19:35:13 2012 +0100
+++ b/src/com/sun/org/apache/bcel/internal/classfile/Attribute.java	Mon Mar 11 17:11:38 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	Mon Dec 17 19:35:13 2012 +0100
+++ b/src/com/sun/org/apache/bcel/internal/classfile/DescendingVisitor.java	Mon Mar 11 17:11:38 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	Mon Dec 17 19:35:13 2012 +0100
+++ b/src/com/sun/org/apache/bcel/internal/classfile/EmptyVisitor.java	Mon Mar 11 17:11:38 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	Mon Mar 11 17:11:38 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	Mon Dec 17 19:35:13 2012 +0100
+++ b/src/com/sun/org/apache/bcel/internal/classfile/Visitor.java	Mon Mar 11 17:11:38 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	Mon Dec 17 19:35:13 2012 +0100
+++ b/src/com/sun/org/apache/bcel/internal/generic/MethodGen.java	Mon Mar 11 17:11:38 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	Mon Dec 17 19:35:13 2012 +0100
+++ b/src/com/sun/org/apache/xerces/internal/impl/Version.java	Mon Mar 11 17:11:38 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	Mon Dec 17 19:35:13 2012 +0100
+++ b/src/com/sun/org/apache/xerces/internal/impl/XMLDocumentFragmentScannerImpl.java	Mon Mar 11 17:11:38 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. */
@@ -286,12 +289,13 @@
 
     //STAX related properties
     //defaultValues.
+    protected boolean fSupportDTD = true;
     protected boolean fReplaceEntityReferences = true;
     protected boolean fSupportExternalEntities = false;
     protected boolean fReportCdataEvent = false ;
     protected boolean fIsCoalesce = false ;
     protected String fDeclaredEncoding =  null;
-    /** Disallow doctype declaration. */
+    /** Xerces Feature: Disallow doctype declaration. */
     protected boolean fDisallowDoctype = false;
 
     // drivers
@@ -805,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.
      */
@@ -832,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);
             }
         }
 
@@ -844,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.
      */
@@ -868,7 +874,7 @@
         // call handler
         if (fDocumentHandler != null && !fScanningAttribute) {
             if (!name.equals("[xml]")) {
-                fDocumentHandler.endGeneralEntity(name, null);
+                fDocumentHandler.endGeneralEntity(name, augs);
             }
         }
 
@@ -1847,7 +1853,7 @@
         // start general entity
         if (!fEntityStore.isDeclaredEntity(name)) {
             //SUPPORT_DTD=false && ReplaceEntityReferences should throw exception
-            if (fDisallowDoctype && fReplaceEntityReferences) {
+            if (!fSupportDTD && fReplaceEntityReferences) {
                 reportFatalError("EntityNotDeclared", new Object[]{name});
                 return;
             }
--- a/src/com/sun/org/apache/xerces/internal/impl/XMLDocumentScannerImpl.java	Mon Dec 17 19:35:13 2012 +0100
+++ b/src/com/sun/org/apache/xerces/internal/impl/XMLDocumentScannerImpl.java	Mon Mar 11 17:11:38 2013 +0100
@@ -278,7 +278,7 @@
         fDoctypeSystemId = null;
         fSeenDoctypeDecl = false;
         fNamespaceContext.reset();
-        fDisallowDoctype = !((Boolean)propertyManager.getProperty(XMLInputFactory.SUPPORT_DTD)).booleanValue();
+        fSupportDTD = ((Boolean)propertyManager.getProperty(XMLInputFactory.SUPPORT_DTD)).booleanValue();
 
         // xerces features
         fLoadExternalDTD = !((Boolean)propertyManager.getProperty(Constants.ZEPHYR_PROPERTY_PREFIX + Constants.IGNORE_EXTERNAL_DTD)).booleanValue();
@@ -628,7 +628,7 @@
     // scanning methods
 
     /** Scans a doctype declaration. */
-    protected boolean scanDoctypeDecl(boolean ignore) throws IOException, XNIException {
+    protected boolean scanDoctypeDecl(boolean supportDTD) throws IOException, XNIException {
 
         // spaces
         if (!fEntityScanner.skipSpaces()) {
@@ -653,7 +653,7 @@
         fHasExternalDTD = fDoctypeSystemId != null;
 
         // Attempt to locate an external subset with an external subset resolver.
-        if (!ignore && !fHasExternalDTD && fExternalSubsetResolver != null) {
+        if (supportDTD && !fHasExternalDTD && fExternalSubsetResolver != null) {
             fDTDDescription.setValues(null, null, fEntityManager.getCurrentResourceIdentifier().getExpandedSystemId(), null);
             fDTDDescription.setRootName(fDoctypeName);
             fExternalSubsetSource = fExternalSubsetResolver.getExternalSubset(fDTDDescription);
@@ -661,7 +661,7 @@
         }
 
         // call handler
-        if (!ignore && fDocumentHandler != null) {
+        if (supportDTD && fDocumentHandler != null) {
             // NOTE: I don't like calling the doctypeDecl callback until
             //       end of the *full* doctype line (including internal
             //       subset) is parsed correctly but SAX2 requires that
@@ -916,6 +916,10 @@
                     }
 
                     case SCANNER_STATE_DOCTYPE: {
+                        if (fDisallowDoctype) {
+                            reportFatalError("DoctypeNotAllowed", null);
+                        }
+
 
                         if (fSeenDoctypeDecl) {
                             reportFatalError("AlreadySeenDoctype", null);
@@ -924,7 +928,7 @@
 
                         // scanDoctypeDecl() sends XNI doctypeDecl event that
                         // in SAX is converted to startDTD() event.
-                        if (scanDoctypeDecl(fDisallowDoctype)) {
+                        if (scanDoctypeDecl(fSupportDTD)) {
                             //allow parsing of entity decls to continue in order to stay well-formed
                             setScannerState(SCANNER_STATE_DTD_INTERNAL_DECLS);
                             fSeenInternalSubset = true;
@@ -934,8 +938,6 @@
                             setDriver(fContentDriver);
                             //always return DTD event, the event however, will not contain any entities
                             return fDTDDriver.next();
-                            // If no DTD support, ignore and continue parsing
-                            //return fDisallowDoctype ? next() : dtdEvent;
                         }
 
                         if(fSeenDoctypeDecl){
@@ -950,7 +952,7 @@
                         if (fDoctypeSystemId != null) {
                             if (((fValidation || fLoadExternalDTD)
                                 && (fValidationManager == null || !fValidationManager.isCachedDTD()))) {
-                            if (!fDisallowDoctype)
+                            if (fSupportDTD)
                                 setScannerState(SCANNER_STATE_DTD_EXTERNAL);
                             else
                                 setScannerState(SCANNER_STATE_PROLOG);
@@ -967,7 +969,7 @@
                                 // This handles the case of a DOCTYPE that had neither an internal subset or an external subset.
                                 fDTDScanner.setInputSource(fExternalSubsetSource);
                                 fExternalSubsetSource = null;
-                            if (!fDisallowDoctype)
+                            if (fSupportDTD)
                                 setScannerState(SCANNER_STATE_DTD_EXTERNAL_DECLS);
                             else
                                 setScannerState(SCANNER_STATE_PROLOG);
@@ -1113,7 +1115,7 @@
                                 }
                                 fMarkupDepth--;
 
-                                if (fDisallowDoctype) {
+                                if (!fSupportDTD) {
                                     //simply reset the entity store without having to mess around
                                     //with the DTD Scanner code
                                     fEntityStore = fEntityManager.getEntityStore();
--- a/src/com/sun/org/apache/xerces/internal/impl/XMLEntityManager.java	Mon Dec 17 19:35:13 2012 +0100
+++ b/src/com/sun/org/apache/xerces/internal/impl/XMLEntityManager.java	Mon Mar 11 17:11:38 2013 +0100
@@ -182,7 +182,8 @@
                 EXTERNAL_GENERAL_ENTITIES,
                 EXTERNAL_PARAMETER_ENTITIES,
                 ALLOW_JAVA_ENCODINGS,
-                WARN_ON_DUPLICATE_ENTITYDEF
+                WARN_ON_DUPLICATE_ENTITYDEF,
+                STANDARD_URI_CONFORMANT
     };
 
     /** Feature defaults. */
@@ -192,6 +193,7 @@
                 Boolean.TRUE,
                 Boolean.TRUE,
                 Boolean.FALSE,
+                Boolean.FALSE
     };
 
     /** Recognized properties. */
@@ -600,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();
@@ -2584,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	Mon Dec 17 19:35:13 2012 +0100
+++ b/src/com/sun/org/apache/xerces/internal/impl/XMLEntityScanner.java	Mon Mar 11 17:11:38 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/com/sun/org/apache/xerces/internal/impl/XMLScanner.java	Mon Dec 17 19:35:13 2012 +0100
+++ b/src/com/sun/org/apache/xerces/internal/impl/XMLScanner.java	Mon Mar 11 17:11:38 2013 +0100
@@ -402,6 +402,16 @@
 
         boolean dataFoundForTarget = false;
         boolean sawSpace = fEntityScanner.skipSpaces();
+        // since pseudoattributes are *not* attributes,
+        // their quotes don't need to be preserved in external parameter entities.
+        // the XMLEntityScanner#scanLiteral method will continue to
+        // emit -1 in such cases when it finds a quote; this is
+        // fine for other methods that parse scanned entities,
+        // but not for the scanning of pseudoattributes.  So,
+        // temporarily, we must mark the current entity as not being "literal"
+        Entity.ScannedEntity currEnt = fEntityManager.getCurrentEntity();
+        boolean currLiteral = currEnt.literal;
+        currEnt.literal = false;
         while (fEntityScanner.peekChar() != '?') {
             dataFoundForTarget = true;
             String name = scanPseudoAttribute(scanningTextDecl, fString);
@@ -499,6 +509,9 @@
             }
             sawSpace = fEntityScanner.skipSpaces();
         }
+        // restore original literal value
+        if(currLiteral)
+            currEnt.literal = true;
         // REVISIT: should we remove this error reporting?
         if (scanningTextDecl && state != STATE_DONE) {
             reportFatalError("MorePseudoAttributes", null);
--- a/src/com/sun/org/apache/xml/internal/serializer/CharInfo.java	Mon Dec 17 19:35:13 2012 +0100
+++ b/src/com/sun/org/apache/xml/internal/serializer/CharInfo.java	Mon Mar 11 17:11:38 2013 +0100
@@ -55,7 +55,7 @@
 final class CharInfo
 {
     /** Given a character, lookup a String to output (e.g. a decorated entity reference). */
-    private HashMap m_charToString;
+    private HashMap m_charToString = new HashMap();
 
     /**
      * The name of the HTML entities file.
@@ -72,50 +72,42 @@
                 "com.sun.org.apache.xml.internal.serializer.XMLEntities";
 
     /** The horizontal tab character, which the parser should always normalize. */
-    static final char S_HORIZONAL_TAB = 0x09;
+    public static final char S_HORIZONAL_TAB = 0x09;
 
     /** The linefeed character, which the parser should always normalize. */
-    static final char S_LINEFEED = 0x0A;
+    public static final char S_LINEFEED = 0x0A;
 
     /** The carriage return character, which the parser should always normalize. */
-    static final char S_CARRIAGERETURN = 0x0D;
-    static final char S_SPACE = 0x20;
-    static final char S_QUOTE = 0x22;
-    static final char S_LT = 0x3C;
-    static final char S_GT = 0x3E;
-    static final char S_NEL = 0x85;
-    static final char S_LINE_SEPARATOR = 0x2028;
+    public static final char S_CARRIAGERETURN = 0x0D;
 
     /** This flag is an optimization for HTML entities. It false if entities
      * other than quot (34), amp (38), lt (60) and gt (62) are defined
      * in the range 0 to 127.
      * @xsl.usage internal
      */
-    boolean onlyQuotAmpLtGt;
+    final boolean onlyQuotAmpLtGt;
 
     /** Copy the first 0,1 ... ASCII_MAX values into an array */
-    static final int ASCII_MAX = 128;
+    private static final int ASCII_MAX = 128;
 
     /** Array of values is faster access than a set of bits
-     * to quickly check ASCII characters in attribute values,
-     * the value is true if the character in an attribute value
-     * should be mapped to a String.
+     * to quickly check ASCII characters in attribute values.
      */
-    private final boolean[] shouldMapAttrChar_ASCII;
+    private boolean[] isSpecialAttrASCII = new boolean[ASCII_MAX];
 
     /** Array of values is faster access than a set of bits
-     * to quickly check ASCII characters in text nodes,
-     * the value is true if the character in a text node
-     * should be mapped to a String.
+     * to quickly check ASCII characters in text nodes.
      */
-    private final boolean[] shouldMapTextChar_ASCII;
+    private boolean[] isSpecialTextASCII = new boolean[ASCII_MAX];
+
+    private boolean[] isCleanTextASCII = new boolean[ASCII_MAX];
 
     /** An array of bits to record if the character is in the set.
      * Although information in this array is complete, the
      * isSpecialAttrASCII array is used first because access to its values
      * is common and faster.
      */
-    private final int array_of_bits[];
+    private int array_of_bits[] = createEmptySetOfIntegers(65535);
 
 
     // 5 for 32 bit words,  6 for 64 bit words ...
@@ -146,38 +138,33 @@
 
 
     /**
-     * A base constructor just to explicitly create the fields,
-     * with the exception of m_charToString which is handled
-     * by the constructor that delegates base construction to this one.
-     * <p>
-     * m_charToString is not created here only for performance reasons,
-     * to avoid creating a Hashtable that will be replaced when
-     * making a mutable copy, {@link #mutableCopyOf(CharInfo)}.
+     * Constructor that reads in a resource file that describes the mapping of
+     * characters to entity references.
+     * This constructor is private, just to force the use
+     * of the getCharInfo(entitiesResource) factory
+     *
+     * Resource files must be encoded in UTF-8 and can either be properties
+     * files with a .properties extension assumed.  Alternatively, they can
+     * have the following form, with no particular extension assumed:
      *
+     * <pre>
+     * # First char # is a comment
+     * Entity numericValue
+     * quot 34
+     * amp 38
+     * </pre>
+     *
+     * @param entitiesResource Name of properties or resource file that should
+     * be loaded, which describes that mapping of characters to entity
+     * references.
      */
-    private CharInfo()
+    private CharInfo(String entitiesResource, String method)
     {
-        this.array_of_bits = createEmptySetOfIntegers(65535);
-        this.firstWordNotUsed = 0;
-        this.shouldMapAttrChar_ASCII = new boolean[ASCII_MAX];
-        this.shouldMapTextChar_ASCII = new boolean[ASCII_MAX];
-        this.m_charKey = new CharKey();
-
-        // Not set here, but in a constructor that uses this one
-        // this.m_charToString =  new Hashtable();
-
-        this.onlyQuotAmpLtGt = true;
-
-
-        return;
+        this(entitiesResource, method, false);
     }
 
     private CharInfo(String entitiesResource, String method, boolean internal)
     {
-        // call the default constructor to create the fields
-        this();
-        m_charToString = new HashMap();
-
         ResourceBundle entities = null;
         boolean noExtraEntities = true;
 
@@ -203,10 +190,12 @@
                 String name = (String) keys.nextElement();
                 String value = entities.getString(name);
                 int code = Integer.parseInt(value);
-                boolean extra = defineEntity(name, (char) code);
-                if (extra)
+                defineEntity(name, (char) code);
+                if (extraEntity(code))
                     noExtraEntities = false;
             }
+            set(S_LINEFEED);
+            set(S_CARRIAGERETURN);
         } else {
             InputStream is = null;
 
@@ -290,8 +279,8 @@
 
                             int code = Integer.parseInt(value);
 
-                            boolean extra = defineEntity(name, (char) code);
-                            if (extra)
+                            defineEntity(name, (char) code);
+                            if (extraEntity(code))
                                 noExtraEntities = false;
                         }
                     }
@@ -300,6 +289,8 @@
                 }
 
                 is.close();
+                set(S_LINEFEED);
+                set(S_CARRIAGERETURN);
             } catch (Exception e) {
                 throw new RuntimeException(
                     Utils.messages.createMessage(
@@ -317,8 +308,31 @@
             }
         }
 
+        /* initialize the array isCleanTextASCII[] with a cache of values
+         * for use by ToStream.character(char[], int , int)
+         * and the array isSpecialTextASCII[] with the opposite values
+         * (all in the name of performance!)
+         */
+        for (int ch = 0; ch <ASCII_MAX; ch++)
+        if((((0x20 <= ch || (0x0A == ch || 0x0D == ch || 0x09 == ch)))
+             && (!get(ch))) || ('"' == ch))
+        {
+            isCleanTextASCII[ch] = true;
+            isSpecialTextASCII[ch] = false;
+        }
+        else {
+            isCleanTextASCII[ch] = false;
+            isSpecialTextASCII[ch] = true;
+        }
+
+
+
         onlyQuotAmpLtGt = noExtraEntities;
 
+        // initialize the array with a cache of the BitSet values
+        for (int i=0; i<ASCII_MAX; i++)
+            isSpecialAttrASCII[i] = get(i);
+
         /* Now that we've used get(ch) just above to initialize the
          * two arrays we will change by adding a tab to the set of
          * special chars for XML (but not HTML!).
@@ -330,19 +344,8 @@
          */
         if (Method.XML.equals(method))
         {
-            // We choose not to escape the quotation mark as &quot; in text nodes
-            shouldMapTextChar_ASCII[S_QUOTE] = false;
+            isSpecialAttrASCII[S_HORIZONAL_TAB] = true;
         }
-
-        if (Method.HTML.equals(method)) {
-                // The XSLT 1.0 recommendation says
-                // "The html output method should not escape < characters occurring in attribute values."
-                // So we don't escape '<' in an attribute for HTML
-                shouldMapAttrChar_ASCII['<'] = false;
-
-                // We choose not to escape the quotation mark as &quot; in text nodes.
-            shouldMapTextChar_ASCII[S_QUOTE] = false;
-    }
     }
 
     /**
@@ -350,39 +353,23 @@
      * supplied. Nothing happens if the character reference is already defined.
      * <p>Unlike internal entities, character references are a string to single
      * character mapping. They are used to map non-ASCII characters both on
-     * parsing and printing, primarily for HTML documents. '&amp;lt;' is an
+     * parsing and printing, primarily for HTML documents. '&lt;amp;' is an
      * example of a character reference.</p>
      *
      * @param name The entity's name
      * @param value The entity's value
-     * @return true if the mapping is not one of:
-     * <ul>
-     * <li> '<' to "&lt;"
-     * <li> '>' to "&gt;"
-     * <li> '&' to "&amp;"
-     * <li> '"' to "&quot;"
-     * </ul>
      */
-    private boolean defineEntity(String name, char value)
+    private void defineEntity(String name, char value)
     {
         StringBuilder sb = new StringBuilder("&");
         sb.append(name);
         sb.append(';');
         String entityString = sb.toString();
 
-        boolean extra = defineChar2StringMapping(entityString, value);
-        return extra;
+        defineChar2StringMapping(entityString, value);
     }
 
     /**
-     * A utility object, just used to map characters to output Strings,
-     * needed because a HashMap needs to map an object as a key, not a
-     * Java primitive type, like a char, so this object gets around that
-     * and it is reusable.
-     */
-    private final CharKey m_charKey;
-
-    /**
      * Map a character to a String. For example given
      * the character '>' this method would return the fully decorated
      * entity name "&lt;".
@@ -413,21 +400,21 @@
 
     /**
      * Tell if the character argument that is from
-     * an attribute value has a mapping to a String.
+     * an attribute value should have special treatment.
      *
      * @param value the value of a character that is in an attribute value
      * @return true if the character should have any special treatment,
      * such as when writing out attribute values,
-     * such as when writing out entity references.
+     * or entity references.
      * @xsl.usage internal
      */
-    final boolean shouldMapAttrChar(int value)
+    final boolean isSpecialAttrChar(int value)
     {
         // for performance try the values in the boolean array first,
         // this is faster access than the BitSet for common ASCII values
 
         if (value < ASCII_MAX)
-            return shouldMapAttrChar_ASCII[value];
+            return isSpecialAttrASCII[value];
 
         // rather than java.util.BitSet, our private
         // implementation is faster (and less general).
@@ -436,27 +423,48 @@
 
     /**
      * Tell if the character argument that is from a
-     * text node has a mapping to a String, for example
-     * to map '<' to "&lt;".
+     * text node should have special treatment.
      *
      * @param value the value of a character that is in a text node
-     * @return true if the character has a mapping to a String,
-     * such as when writing out entity references.
+     * @return true if the character should have any special treatment,
+     * such as when writing out attribute values,
+     * or entity references.
      * @xsl.usage internal
      */
-    final boolean shouldMapTextChar(int value)
+    final boolean isSpecialTextChar(int value)
     {
         // for performance try the values in the boolean array first,
         // this is faster access than the BitSet for common ASCII values
 
         if (value < ASCII_MAX)
-            return shouldMapTextChar_ASCII[value];
+            return isSpecialTextASCII[value];
 
         // rather than java.util.BitSet, our private
         // implementation is faster (and less general).
         return get(value);
     }
 
+    /**
+     * This method is used to determine if an ASCII character in
+     * a text node (not an attribute value) is "clean".
+     * @param value the character to check (0 to 127).
+     * @return true if the character can go to the writer as-is
+     * @xsl.usage internal
+     */
+    final boolean isTextASCIIClean(int value)
+    {
+        return isCleanTextASCII[value];
+    }
+
+//  In the future one might want to use the array directly and avoid
+//  the method call, but I think the JIT alreay inlines this well enough
+//  so don't do it (for now) - bjm
+//    public final boolean[] getASCIIClean()
+//    {
+//        return isCleanTextASCII;
+//    }
+
+
     private static CharInfo getCharInfoBasedOnPrivilege(
         final String entitiesFileName, final String method,
         final boolean internal){
@@ -491,17 +499,15 @@
     {
         CharInfo charInfo = (CharInfo) m_getCharInfoCache.get(entitiesFileName);
         if (charInfo != null) {
-            return mutableCopyOf(charInfo);
+            return charInfo;
         }
 
         // try to load it internally - cache
         try {
             charInfo = getCharInfoBasedOnPrivilege(entitiesFileName,
                                         method, true);
-            // Put the common copy of charInfo in the cache, but return
-            // a copy of it.
             m_getCharInfoCache.put(entitiesFileName, charInfo);
-            return mutableCopyOf(charInfo);
+            return charInfo;
         } catch (Exception e) {}
 
         // try to load it externally - do not cache
@@ -528,41 +534,7 @@
                                 method, false);
     }
 
-    /**
-     * Create a mutable copy of the cached one.
-     * @param charInfo The cached one.
-     * @return
-     */
-    private static CharInfo mutableCopyOf(CharInfo charInfo) {
-        CharInfo copy = new CharInfo();
-
-        int max = charInfo.array_of_bits.length;
-        System.arraycopy(charInfo.array_of_bits,0,copy.array_of_bits,0,max);
-
-        copy.firstWordNotUsed = charInfo.firstWordNotUsed;
-
-        max = charInfo.shouldMapAttrChar_ASCII.length;
-        System.arraycopy(charInfo.shouldMapAttrChar_ASCII,0,copy.shouldMapAttrChar_ASCII,0,max);
-
-        max = charInfo.shouldMapTextChar_ASCII.length;
-        System.arraycopy(charInfo.shouldMapTextChar_ASCII,0,copy.shouldMapTextChar_ASCII,0,max);
-
-        // utility field copy.m_charKey is already created in the default constructor
-
-        copy.m_charToString = (HashMap) charInfo.m_charToString.clone();
-
-        copy.onlyQuotAmpLtGt = charInfo.onlyQuotAmpLtGt;
-
-                return copy;
-        }
-
-        /**
-         * Table of user-specified char infos.
-         * The table maps entify file names (the name of the
-         * property file without the .properties extension)
-         * to CharInfo objects populated with entities defined in
-         * corresponding property file.
-         */
+    /** Table of user-specified char infos. */
     private static HashMap m_getCharInfoCache = new HashMap();
 
     /**
@@ -604,8 +576,7 @@
      * the creation of the set.
      */
     private final void set(int i) {
-        setASCIItextDirty(i);
-        setASCIIattrDirty(i);
+        setASCIIdirty(i);
 
         int j = (i >> SHIFT_PER_WORD); // this word is used
         int k = j + 1;
@@ -640,43 +611,24 @@
         return in_the_set;
     }
 
+    // record if there are any entities other than
+    // quot, amp, lt, gt  (probably user defined)
     /**
-     * This method returns true if there are some non-standard mappings to
-     * entities other than quot, amp, lt, gt, and its only purpose is for
-     * performance.
-     * @param charToMap The value of the character that is mapped to a String
-     * @param outputString The String to which the character is mapped, usually
-     * an entity reference such as "&lt;".
-     * @return true if the mapping is not one of:
-     * <ul>
-     * <li> '<' to "&lt;"
-     * <li> '>' to "&gt;"
-     * <li> '&' to "&amp;"
-     * <li> '"' to "&quot;"
-     * </ul>
+     * @return true if the entity
+     * @param code The value of the character that has an entity defined
+     * for it.
      */
-    private boolean extraEntity(String outputString, int charToMap)
+    private boolean extraEntity(int entityValue)
     {
         boolean extra = false;
-        if (charToMap < ASCII_MAX)
+        if (entityValue < 128)
         {
-            switch (charToMap)
+            switch (entityValue)
             {
-                case '"' : // quot
-                        if (!outputString.equals("&quot;"))
-                                extra = true;
-                    break;
-                case '&' : // amp
-                        if (!outputString.equals("&amp;"))
-                                extra = true;
-                        break;
-                case '<' : // lt
-                        if (!outputString.equals("&lt;"))
-                                extra = true;
-                        break;
-                case '>' : // gt
-                        if (!outputString.equals("&gt;"))
-                                extra = true;
+                case 34 : // quot
+                case 38 : // amp
+                case 60 : // lt
+                case 62 : // gt
                     break;
                 default : // other entity in range 0 to 127
                     extra = true;
@@ -686,61 +638,49 @@
     }
 
     /**
-     * If the character is in the ASCII range then
-     * mark it as needing replacement with
-     * a String on output if it occurs in a text node.
+     * If the character is a printable ASCII character then
+     * mark it as not clean and needing replacement with
+     * a String on output.
      * @param ch
      */
-    private void setASCIItextDirty(int j)
+    private void setASCIIdirty(int j)
     {
         if (0 <= j && j < ASCII_MAX)
         {
-            shouldMapTextChar_ASCII[j] = true;
+            isCleanTextASCII[j] = false;
+            isSpecialTextASCII[j] = true;
         }
     }
 
     /**
-     * If the character is in the ASCII range then
-     * mark it as needing replacement with
-     * a String on output if it occurs in a attribute value.
+     * If the character is a printable ASCII character then
+     * mark it as and not needing replacement with
+     * a String on output.
      * @param ch
      */
-    private void setASCIIattrDirty(int j)
+    private void setASCIIclean(int j)
     {
         if (0 <= j && j < ASCII_MAX)
         {
-            shouldMapAttrChar_ASCII[j] = true;
+            isCleanTextASCII[j] = true;
+            isSpecialTextASCII[j] = false;
         }
     }
 
-    /**
-     * Call this method to register a char to String mapping, for example
-     * to map '<' to "&lt;".
-     * @param outputString The String to map to.
-     * @param inputChar The char to map from.
-     * @return true if the mapping is not one of:
-     * <ul>
-     * <li> '<' to "&lt;"
-     * <li> '>' to "&gt;"
-     * <li> '&' to "&amp;"
-     * <li> '"' to "&quot;"
-     * </ul>
-     */
-    boolean defineChar2StringMapping(String outputString, char inputChar)
+    private void defineChar2StringMapping(String outputString, char inputChar)
     {
         CharKey character = new CharKey(inputChar);
         m_charToString.put(character, outputString);
-        set(inputChar);  // mark the character has having a mapping to a String
-
-        boolean extraMapping = extraEntity(outputString, inputChar);
-        return extraMapping;
-
+        set(inputChar);
     }
 
     /**
      * Simple class for fast lookup of char values, when used with
      * hashtables.  You can set the char, then use it as a key.
      *
+     * This class is a copy of the one in com.sun.org.apache.xml.internal.utils.
+     * It exists to cut the serializers dependancy on that package.
+     *
      * @xsl.usage internal
      */
     private static class CharKey extends Object
--- a/src/com/sun/org/apache/xml/internal/serializer/ToHTMLStream.java	Mon Dec 17 19:35:13 2012 +0100
+++ b/src/com/sun/org/apache/xml/internal/serializer/ToHTMLStream.java	Mon Mar 11 17:11:38 2013 +0100
@@ -58,7 +58,7 @@
      * Map that tells which XML characters should have special treatment, and it
      *  provides character to entity name lookup.
      */
-    private final CharInfo m_htmlcharInfo =
+    private static final CharInfo m_htmlcharInfo =
 //        new CharInfo(CharInfo.HTML_ENTITIES_RESOURCE);
         CharInfo.getCharInfo(CharInfo.HTML_ENTITIES_RESOURCE, Method.HTML);
 
@@ -1369,7 +1369,7 @@
             // System.out.println("ch: "+(int)ch);
             // System.out.println("m_maxCharacter: "+(int)m_maxCharacter);
             // System.out.println("m_attrCharsMap[ch]: "+(int)m_attrCharsMap[ch]);
-            if (escapingNotNeeded(ch) && (!m_charInfo.shouldMapAttrChar(ch)))
+            if (escapingNotNeeded(ch) && (!m_charInfo.isSpecialAttrChar(ch)))
             {
                 cleanLength++;
             }
--- a/src/com/sun/org/apache/xml/internal/serializer/ToStream.java	Mon Dec 17 19:35:13 2012 +0100
+++ b/src/com/sun/org/apache/xml/internal/serializer/ToStream.java	Mon Mar 11 17:11:38 2013 +0100
@@ -919,8 +919,7 @@
         {
             // This is the old/fast code here, but is this
             // correct for all encodings?
-            if (ch >= CharInfo.S_SPACE || (CharInfo.S_LINEFEED == ch ||
-                    CharInfo.S_CARRIAGERETURN == ch || CharInfo.S_HORIZONAL_TAB == ch))
+            if (ch >= 0x20 || (0x0A == ch || 0x0D == ch || 0x09 == ch))
                 ret= true;
             else
                 ret = false;
@@ -1029,7 +1028,7 @@
      *
      * @throws java.io.IOException
      */
-    int accumDefaultEntity(
+    protected int accumDefaultEntity(
         java.io.Writer writer,
         char ch,
         int i,
@@ -1048,7 +1047,7 @@
         {
             // if this is text node character and a special one of those,
             // or if this is a character from attribute value and a special one of those
-            if ((fromTextNode && m_charInfo.shouldMapTextChar(ch)) || (!fromTextNode && m_charInfo.shouldMapAttrChar(ch)))
+            if ((fromTextNode && m_charInfo.isSpecialTextChar(ch)) || (!fromTextNode && m_charInfo.isSpecialAttrChar(ch)))
             {
                 String outputStringForChar = m_charInfo.getOutputStringForChar(ch);
 
@@ -1399,6 +1398,7 @@
 
         if (m_cdataTagOpen)
             closeCDATA();
+        // the check with _escaping is a bit of a hack for XLSTC
 
         if (m_disableOutputEscapingStates.peekOrFalse() || (!m_escaping))
         {
@@ -1421,173 +1421,82 @@
         try
         {
             int i;
+            char ch1;
             int startClean;
 
             // skip any leading whitspace
             // don't go off the end and use a hand inlined version
             // of isWhitespace(ch)
             final int end = start + length;
-            int lastDirtyCharProcessed = start - 1; // last non-clean character that was processed
-                                                                                                        // that was processed
-            final Writer writer = m_writer;
-            boolean isAllWhitespace = true;
-
-            // process any leading whitspace
-            i = start;
-            while (i < end && isAllWhitespace) {
-                char ch1 = chars[i];
-
-                if (m_charInfo.shouldMapTextChar(ch1)) {
-                    // The character is supposed to be replaced by a String
-                    // so write out the clean whitespace characters accumulated
-                    // so far
-                    // then the String.
-                    writeOutCleanChars(chars, i, lastDirtyCharProcessed);
-                    String outputStringForChar = m_charInfo
-                            .getOutputStringForChar(ch1);
-                    writer.write(outputStringForChar);
-                    // We can't say that everything we are writing out is
-                    // all whitespace, we just wrote out a String.
-                    isAllWhitespace = false;
-                    lastDirtyCharProcessed = i; // mark the last non-clean
-                    // character processed
-                    i++;
-                } else {
-                    // The character is clean, but is it a whitespace ?
-                    switch (ch1) {
-                    // TODO: Any other whitespace to consider?
-                    case CharInfo.S_SPACE:
-                        // Just accumulate the clean whitespace
-                        i++;
-                        break;
-                    case CharInfo.S_LINEFEED:
-                        lastDirtyCharProcessed = processLineFeed(chars, i,
-                                lastDirtyCharProcessed, writer);
-                        i++;
-                        break;
-                    case CharInfo.S_CARRIAGERETURN:
-                        writeOutCleanChars(chars, i, lastDirtyCharProcessed);
-                        writer.write("&#13;");
-                        lastDirtyCharProcessed = i;
-                        i++;
-                        break;
-                    case CharInfo.S_HORIZONAL_TAB:
-                        // Just accumulate the clean whitespace
-                        i++;
-                        break;
-                    default:
-                        // The character was clean, but not a whitespace
-                        // so break the loop to continue with this character
-                        // (we don't increment index i !!)
-                        isAllWhitespace = false;
-                        break;
+            int lastDirty = start - 1; // last character that needed processing
+            for (i = start;
+                ((i < end)
+                    && ((ch1 = chars[i]) == 0x20
+                        || (ch1 == 0xA && m_lineSepUse)
+                        || ch1 == 0xD
+                        || ch1 == 0x09));
+                i++)
+            {
+                /*
+                 * We are processing leading whitespace, but are doing the same
+                 * processing for dirty characters here as for non-whitespace.
+                 *
+                 */
+                if (!m_charInfo.isTextASCIIClean(ch1))
+                {
+                    lastDirty = processDirty(chars,end, i,ch1, lastDirty, true);
+                    i = lastDirty;
                 }
             }
-            }
             /* If there is some non-whitespace, mark that we may need
              * to preserve this. This is only important if we have indentation on.
              */
-            if (i < end || !isAllWhitespace)
+            if (i < end)
                 m_ispreserve = true;
 
+
+//            int lengthClean;    // number of clean characters in a row
+//            final boolean[] isAsciiClean = m_charInfo.getASCIIClean();
+
+            final boolean isXML10 = XMLVERSION10.equals(getVersion());
+            // we've skipped the leading whitespace, now deal with the rest
             for (; i < end; i++)
             {
-                char ch = chars[i];
-
-                if (m_charInfo.shouldMapTextChar(ch)) {
-                    // The character is supposed to be replaced by a String
-                    // e.g.   '&'  -->  "&amp;"
-                    // e.g.   '<'  -->  "&lt;"
-                    writeOutCleanChars(chars, i, lastDirtyCharProcessed);
-                    String outputStringForChar = m_charInfo.getOutputStringForChar(ch);
-                    writer.write(outputStringForChar);
-                    lastDirtyCharProcessed = i;
-                }
-                else {
-                    if (ch <= 0x1F) {
-                        // Range 0x00 through 0x1F inclusive
-                        //
-                        // This covers the non-whitespace control characters
-                        // in the range 0x1 to 0x1F inclusive.
-                        // It also covers the whitespace control characters in the same way:
-                        // 0x9   TAB
-                        // 0xA   NEW LINE
-                        // 0xD   CARRIAGE RETURN
-                        //
-                        // We also cover 0x0 ... It isn't valid
-                        // but we will output "&#0;"
-
-                        // The default will handle this just fine, but this
-                        // is a little performance boost to handle the more
-                        // common TAB, NEW-LINE, CARRIAGE-RETURN
-                        switch (ch) {
-
-                        case CharInfo.S_HORIZONAL_TAB:
-                            // Leave whitespace TAB as a real character
+                {
+                    // A tight loop to skip over common clean chars
+                    // This tight loop makes it easier for the JIT
+                    // to optimize.
+                    char ch2;
+                    while (i<end
+                            && ((ch2 = chars[i])<127)
+                            && m_charInfo.isTextASCIIClean(ch2))
+                            i++;
+                    if (i == end)
                         break;
-                        case CharInfo.S_LINEFEED:
-                            lastDirtyCharProcessed = processLineFeed(chars, i, lastDirtyCharProcessed, writer);
-                            break;
-                        case CharInfo.S_CARRIAGERETURN:
-                                writeOutCleanChars(chars, i, lastDirtyCharProcessed);
-                                writer.write("&#13;");
-                                lastDirtyCharProcessed = i;
-                            // Leave whitespace carriage return as a real character
-                            break;
-                        default:
-                            writeOutCleanChars(chars, i, lastDirtyCharProcessed);
-                            writer.write("&#");
-                            writer.write(Integer.toString(ch));
-                            writer.write(';');
-                            lastDirtyCharProcessed = i;
-                            break;
-
-                }
-                    }
-                    else if (ch < 0x7F) {
-                        // Range 0x20 through 0x7E inclusive
-                        // Normal ASCII chars, do nothing, just add it to
-                        // the clean characters
-
                 }
-                    else if (ch <= 0x9F){
-                        // Range 0x7F through 0x9F inclusive
-                        // More control characters, including NEL (0x85)
-                        writeOutCleanChars(chars, i, lastDirtyCharProcessed);
-                        writer.write("&#");
-                        writer.write(Integer.toString(ch));
-                        writer.write(';');
-                        lastDirtyCharProcessed = i;
+
+                final char ch = chars[i];
+                /*  The check for isCharacterInC0orC1Ranger and
+                 *  isNELorLSEPCharacter has been added
+                 *  to support Control Characters in XML 1.1
+                 */
+                if (!isCharacterInC0orC1Range(ch) &&
+                    (isXML10 || !isNELorLSEPCharacter(ch)) &&
+                    (escapingNotNeeded(ch) && (!m_charInfo.isSpecialTextChar(ch)))
+                        || ('"' == ch))
+                {
+                    ; // a character needing no special processing
                 }
-                    else if (ch == CharInfo.S_LINE_SEPARATOR) {
-                        // LINE SEPARATOR
-                        writeOutCleanChars(chars, i, lastDirtyCharProcessed);
-                        writer.write("&#8232;");
-                        lastDirtyCharProcessed = i;
-            }
-                    else if (m_encodingInfo.isInEncoding(ch)) {
-                        // If the character is in the encoding, and
-                        // not in the normal ASCII range, we also
-                        // just leave it get added on to the clean characters
-
-                    }
-                    else {
-                        // This is a fallback plan, we should never get here
-                        // but if the character wasn't previously handled
-                        // (i.e. isn't in the encoding, etc.) then what
-                        // should we do?  We choose to write out an entity
-                        writeOutCleanChars(chars, i, lastDirtyCharProcessed);
-                        writer.write("&#");
-                        writer.write(Integer.toString(ch));
-                        writer.write(';');
-                        lastDirtyCharProcessed = i;
-                    }
+                else
+                {
+                    lastDirty = processDirty(chars,end, i, ch, lastDirty, true);
+                    i = lastDirty;
                 }
             }
 
             // we've reached the end. Any clean characters at the
             // end of the array than need to be written out?
-            startClean = lastDirtyCharProcessed + 1;
+            startClean = lastDirty + 1;
             if (i > startClean)
             {
                 int lengthClean = i - startClean;
@@ -1606,32 +1515,6 @@
         if (m_tracer != null)
             super.fireCharEvent(chars, start, length);
     }
-
-        private int processLineFeed(final char[] chars, int i, int lastProcessed, final Writer writer) throws IOException {
-                if (!m_lineSepUse
-                || (m_lineSepLen ==1 && m_lineSep[0] == CharInfo.S_LINEFEED)){
-                    // We are leaving the new-line alone, and it is just
-                    // being added to the 'clean' characters,
-                        // so the last dirty character processed remains unchanged
-                }
-                else {
-                    writeOutCleanChars(chars, i, lastProcessed);
-                    writer.write(m_lineSep, 0, m_lineSepLen);
-                    lastProcessed = i;
-                }
-                return lastProcessed;
-        }
-
-    private void writeOutCleanChars(final char[] chars, int i, int lastProcessed) throws IOException {
-        int startClean;
-        startClean = lastProcessed + 1;
-        if (startClean < i)
-        {
-            int lengthClean = i - startClean;
-            m_writer.write(chars, startClean, lengthClean);
-        }
-     }
-
     /**
      * This method checks if a given character is between C0 or C1 range
      * of Control characters.
@@ -1751,7 +1634,7 @@
      *
      * @throws org.xml.sax.SAXException
      */
-    private int accumDefaultEscape(
+    protected int accumDefaultEscape(
         Writer writer,
         char ch,
         int i,
@@ -1815,15 +1698,16 @@
                  *  to write it out as Numeric Character Reference(NCR) regardless of XML Version
                  *  being used for output document.
                  */
-                if (isCharacterInC0orC1Range(ch) || isNELorLSEPCharacter(ch))
+                if (isCharacterInC0orC1Range(ch) ||
+                        (XMLVERSION11.equals(getVersion()) && isNELorLSEPCharacter(ch)))
                 {
                     writer.write("&#");
                     writer.write(Integer.toString(ch));
                     writer.write(';');
                 }
                 else if ((!escapingNotNeeded(ch) ||
-                    (  (fromTextNode && m_charInfo.shouldMapTextChar(ch))
-                     || (!fromTextNode && m_charInfo.shouldMapAttrChar(ch))))
+                    (  (fromTextNode && m_charInfo.isSpecialTextChar(ch))
+                     || (!fromTextNode && m_charInfo.isSpecialAttrChar(ch))))
                 && m_elemContext.m_currentElemDepth > 0)
                 {
                     writer.write("&#");
@@ -2087,86 +1971,28 @@
         string.getChars(0,len, m_attrBuff, 0);
         final char[] stringChars = m_attrBuff;
 
-        for (int i = 0; i < len;)
+        for (int i = 0; i < len; )
         {
             char ch = stringChars[i];
-
-            if (m_charInfo.shouldMapAttrChar(ch) || !(escapingNotNeeded(ch))) {
-                // The character is supposed to be replaced by a String
-                // e.g.   '&'  -->  "&amp;"
-                // e.g.   '<'  -->  "&lt;"
+            if (escapingNotNeeded(ch) && (!m_charInfo.isSpecialAttrChar(ch)))
+            {
+                writer.write(ch);
+                i++;
+            }
+            else
+            { // I guess the parser doesn't normalize cr/lf in attributes. -sb
+//                if ((CharInfo.S_CARRIAGERETURN == ch)
+//                    && ((i + 1) < len)
+//                    && (CharInfo.S_LINEFEED == stringChars[i + 1]))
+//                {
+//                    i++;
+//                    ch = CharInfo.S_LINEFEED;
+//                }
+
                 i = accumDefaultEscape(writer, ch, i, stringChars, len, false, true);
             }
-            else {
-                i++;
-                if (0x0 <= ch && ch <= 0x1F) {
-                    // Range 0x00 through 0x1F inclusive
-                    // This covers the non-whitespace control characters
-                    // in the range 0x1 to 0x1F inclusive.
-                    // It also covers the whitespace control characters in the same way:
-                    // 0x9   TAB
-                    // 0xA   NEW LINE
-                    // 0xD   CARRIAGE RETURN
-                    //
-                    // We also cover 0x0 ... It isn't valid
-                    // but we will output "&#0;"
-
-                    // The default will handle this just fine, but this
-                    // is a little performance boost to handle the more
-                    // common TAB, NEW-LINE, CARRIAGE-RETURN
-                    switch (ch) {
-
-                    case CharInfo.S_HORIZONAL_TAB:
-                        writer.write("&#9;");
-                        break;
-                    case CharInfo.S_LINEFEED:
-                        writer.write("&#10;");
-                        break;
-                    case CharInfo.S_CARRIAGERETURN:
-                        writer.write("&#13;");
-                        break;
-                    default:
-                        writer.write("&#");
-                        writer.write(Integer.toString(ch));
-                        writer.write(';');
-                        break;
-
         }
-                }
-                else if (ch < 0x7F) {
-                    // Range 0x20 through 0x7E inclusive
-                    // Normal ASCII chars
-                        writer.write(ch);
-                }
-                else if (ch <= 0x9F){
-                    // Range 0x7F through 0x9F inclusive
-                    // More control characters
-                    writer.write("&#");
-                    writer.write(Integer.toString(ch));
-                    writer.write(';');
-                }
-                else if (ch == CharInfo.S_LINE_SEPARATOR) {
-                    // LINE SEPARATOR
-                    writer.write("&#8232;");
-                }
-                else if (m_encodingInfo.isInEncoding(ch)) {
-                    // If the character is in the encoding, and
-                    // not in the normal ASCII range, we also
-                    // just write it out
-                    writer.write(ch);
-                }
-                else {
-                    // This is a fallback plan, we should never get here
-                    // but if the character wasn't previously handled
-                    // (i.e. isn't in the encoding, etc.) then what
-                    // should we do?  We choose to write out a character ref
-                    writer.write("&#");
-                    writer.write(Integer.toString(ch));
-                    writer.write(';');
-                }
-
-    }
-        }
+
     }
 
     /**
@@ -2936,14 +2762,6 @@
                 closeCDATA();
                 m_cdataTagOpen = false;
             }
-            if (m_writer != null) {
-                try {
-                    m_writer.flush();
-    }
-                catch(IOException e) {
-                    // what? me worry?
-                }
-            }
     }
 
     public void setContentHandler(ContentHandler ch)
--- a/src/com/sun/org/apache/xml/internal/serializer/ToXMLStream.java	Mon Dec 17 19:35:13 2012 +0100
+++ b/src/com/sun/org/apache/xml/internal/serializer/ToXMLStream.java	Mon Mar 11 17:11:38 2013 +0100
@@ -56,7 +56,7 @@
      * Map that tells which XML characters should have special treatment, and it
      *  provides character to entity name lookup.
      */
-    private CharInfo m_xmlcharInfo =
+    private static CharInfo m_xmlcharInfo =
 //      new CharInfo(CharInfo.XML_ENTITIES_RESOURCE);
         CharInfo.getCharInfo(CharInfo.XML_ENTITIES_RESOURCE, Method.XML);
 
@@ -329,11 +329,12 @@
 
                 /**
                  * Before Xalan 1497, a newline char was printed out if not inside of an
-                 * element. The whitespace is not significant if the output is standalone
+                 * element. The whitespace is not significant is the output is standalone
                 */
                 if (m_elemContext.m_currentElemDepth <= 0 && m_isStandalone)
                     writer.write(m_lineSep, 0, m_lineSepLen);
 
+
                 /*
                  * Don't write out any indentation whitespace now,
                  * because there may be non-whitespace text after this.
--- a/src/com/sun/org/apache/xpath/internal/functions/FuncSystemProperty.java	Mon Dec 17 19:35:13 2012 +0100
+++ b/src/com/sun/org/apache/xpath/internal/functions/FuncSystemProperty.java	Mon Mar 11 17:11:38 2013 +0100
@@ -165,7 +165,7 @@
    * should already be fully qualified as path/filename
    * @param target The target property bag the file will be placed into.
    */
-  public void loadPropertyFile(String file, Properties target)
+  private void loadPropertyFile(String file, Properties target)
   {
     try
     {
--- a/src/com/sun/xml/internal/stream/XMLEventReaderImpl.java	Mon Dec 17 19:35:13 2012 +0100
+++ b/src/com/sun/xml/internal/stream/XMLEventReaderImpl.java	Mon Mar 11 17:11:38 2013 +0100
@@ -248,8 +248,10 @@
             object = nextEvent();
         }catch(XMLStreamException streamException){
             fLastEvent = null ;
-            //xxx: what should be done in this case ?
-            throw new NoSuchElementException();
+            //don't swallow the cause
+            NoSuchElementException e = new NoSuchElementException(streamException.getMessage());
+            e.initCause(streamException.getCause());
+            throw e;
         }
         return object;
     }
--- a/src/javax/xml/stream/XMLEventFactory.java	Mon Dec 17 19:35:13 2012 +0100
+++ b/src/javax/xml/stream/XMLEventFactory.java	Mon Mar 11 17:11:38 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());