changeset 53:44e5ca2a846c

Merge
author xdono
date Thu, 07 May 2009 10:30:34 -0700
parents 04af70c1189c (current diff) fb846b3f9450 (diff)
children 0ea9bb9c6ddc
files
diffstat 25 files changed, 218 insertions(+), 88 deletions(-) [+]
line wrap: on
line diff
--- a/.hgignore	Wed May 06 11:27:39 2009 -0700
+++ b/.hgignore	Thu May 07 10:30:34 2009 -0700
@@ -1,3 +1,4 @@
 ^build/
 ^dist/
+^webrev/
 ^nbproject/private/
--- a/.hgtags	Wed May 06 11:27:39 2009 -0700
+++ b/.hgtags	Thu May 07 10:30:34 2009 -0700
@@ -30,3 +30,5 @@
 e8837366d3fd72f7c7a47ebfdbd5106c16156f12 jdk7-b53
 946a9f0c493261fa6a010dc33e61b9b535ba80c1 jdk7-b54
 039945fba683ee6773a721e2bd4e449f6133769a jdk7-b55
+c197c6801271c60f9c9f5d18fcc95b59e76dcd54 jdk7-b56
+e4851e9f7be26fc52a628be06ffa8aaea0919bd7 jdk7-b57
--- a/THIRD_PARTY_README	Wed May 06 11:27:39 2009 -0700
+++ b/THIRD_PARTY_README	Thu May 07 10:30:34 2009 -0700
@@ -61,6 +61,28 @@
 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
 THE POSSIBILITY OF SUCH DAMAGE.
+
+%% This notice is provided with respect to littlecms, which may be included with this software:  
+
+Little cms
+Copyright (C) 1998-2004 Marti Maria
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of
+this software and associated documentation files (the "Software"), to deal in
+the Software without restriction, including without limitation the rights to
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
+the Software, and to permit persons to whom the Software is furnished to do so,
+subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
+FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
+COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 %% This notice is provided with respect to zlib 1.1.3, which may be included with this software:   
 
 Acknowledgments:
@@ -115,16 +137,6 @@
 The name and trademarks of copyright holders may NOT be used in advertising or publicity pertaining to the software without specific, written prior permission. Title to copyright in this software and any associated documentation will at all times remain with copyright holders.
 ____________________________________
 This formulation of W3C's notice and license became active on August 14 1998 so as to improve compatibility with GPL. This version ensures that W3C software licensing terms are no more restrictive than GPL and consequently W3C software may be distributed in GPL packages. See the older formulation for the policy prior to this date. Please see our Copyright FAQ for common questions about using materials from our site, including specific terms and conditions for packages like libwww, Amaya, and Jigsaw. Other questions about this notice can be directed to site-policy@w3.org.

-%% This notice is provided with respect to jscheme.jar, which may be included with this software: 
-Software License Agreement
-Copyright © 1998-2002 by Peter Norvig. 
-Permission is granted to anyone to use this software, in source or object code form, on any computer system, and to modify, compile, decompile, run, and redistribute it to anyone else, subject to the following restrictions: 
-1.The author makes no warranty of any kind, either expressed or implied, about the suitability of this software for any purpose.
-2.The author accepts no liability of any kind for damages or other consequences of the use of this software, even if they arise from defects in the software.
-3.The origin of this software must not be misrepresented, either by explicit claim or by omission.
-4.Altered versions must be plainly marked as such, and must not be misrepresented as being the original software. Altered versions may be distributed in packages under other licenses (such as the GNU license). 
-If you find this software useful, it would be nice if you let me (peter@norvig.com) know about it, and nicer still if you send me modifications that you are willing to share. However, you are not required to do so.
 
 
 %% This notice is provided with respect to PC/SC Lite for Suse Linux v. 1.1.1, which may be included with this software: 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TRADEMARK	Thu May 07 10:30:34 2009 -0700
@@ -0,0 +1,41 @@
+OpenJDK Trademark Notice
+Version 1.1, 2008/3/10
+
+OpenJDK (the "Name") is a trademark of Sun Microsystems, Inc. (the "Owner").
+Owner permits any person obtaining a copy of this software (the "Software")
+which is based on original software retrieved from one of the following
+websites: http://download.java.net/openjdk, http://hg.openjdk.java.net/jdk6,
+or http://openjdk.java.net (each a "Website", with the original software made
+available by the Owner on a Website being known as the "Website Software") to
+use the Name in package names and version strings of the Software subject to
+the following conditions:
+
+  - The Software is a substantially complete implementation of the OpenJDK
+    development kit or runtime environment code made available by Owner on a
+    Website, and the vast majority of the Software code is identical to the
+    upstream Website Software;
+
+  - No permission is hereby granted to use the Name in any other manner,
+    unless such use constitutes "fair use."
+
+  - The Owner makes no warranties of any kind respecting the Name and all
+    representations and warranties, including any implied warranty of
+    merchantability, fitness for a particular purpose or non-infringement
+    are hereby disclaimed; and
+
+  - This notice and the following legend are included in all copies of the
+    Software or portions of it:
+
+        OpenJDK is a trademark or registered trademark of Sun Microsystems,
+        Inc. in the United States and other countries.
+
+The Name may also be used in connection with descriptions of the Software that
+constitute "fair use," such as "derived from the OpenJDK code base" or "based
+on the OpenJDK source code."
+
+Owner intends to revise this Notice as necessary in order to meet the needs of
+the OpenJDK Community.  Please send questions or comments about this Notice to
+Sun Microsystems at openjdk-tm@sun.com.  Revisions to this Notice will be
+announced on the public mailing list announce@openjdk.java.net, to which you
+may subscribe by visiting http://mail.openjdk.java.net.  The latest version of
+this Notice may be found at http://openjdk.java.net/legal.
--- a/make/jprt.properties	Wed May 06 11:27:39 2009 -0700
+++ b/make/jprt.properties	Thu May 07 10:30:34 2009 -0700
@@ -32,13 +32,13 @@
 solaris_sparcv9_5.10,\
 solaris_i586_5.10,\
 solaris_x64_5.10,\
-linux_i586,\
-linux_x64,\
+linux_i586_2.6,\
+linux_x64_2.6,\
 windows_i586,\
 windows_x64
 
 # The different build flavors we want
-jprt.build.flavors=product
+jprt.build.flavors=product,fastdebug
 
 # Explicitly designate what the 32bit match is for the 64bit build
 jprt.solaris_sparcv9.build.platform.match32=solaris_sparc_5.10
--- a/src/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/Import.java	Wed May 06 11:27:39 2009 -0700
+++ b/src/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/Import.java	Thu May 07 10:30:34 2009 -0700
@@ -18,7 +18,7 @@
  * limitations under the License.
  */
 /*
- * $Id: Import.java,v 1.2.4.1 2005/09/12 10:32:33 pvedula Exp $
+ * $Id: Import.java,v 1.8 2007/04/09 21:30:40 joehw Exp $
  */
 
 package com.sun.org.apache.xalan.internal.xsltc.compiler;
--- a/src/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/Include.java	Wed May 06 11:27:39 2009 -0700
+++ b/src/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/Include.java	Thu May 07 10:30:34 2009 -0700
@@ -18,7 +18,7 @@
  * limitations under the License.
  */
 /*
- * $Id: Include.java,v 1.2.4.1 2005/09/01 15:44:18 pvedula Exp $
+ * $Id: Include.java,v 1.8 2007/04/09 21:30:41 joehw Exp $
  */
 
 package com.sun.org.apache.xalan.internal.xsltc.compiler;
--- a/src/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/util/Type.java	Wed May 06 11:27:39 2009 -0700
+++ b/src/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/util/Type.java	Thu May 07 10:30:34 2009 -0700
@@ -18,7 +18,7 @@
  * limitations under the License.
  */
 /*
- * $Id: Type.java,v 1.2.4.2 2005/09/15 18:34:13 jeffsuttor Exp $
+ * $Id: Type.java,v 1.8 2007/03/28 16:51:19 joehw Exp $
  */
 
 package com.sun.org.apache.xalan.internal.xsltc.compiler.util;
--- a/src/share/classes/com/sun/org/apache/xalan/internal/xsltc/trax/SAX2DOM.java	Wed May 06 11:27:39 2009 -0700
+++ b/src/share/classes/com/sun/org/apache/xalan/internal/xsltc/trax/SAX2DOM.java	Thu May 07 10:30:34 2009 -0700
@@ -18,7 +18,7 @@
  * limitations under the License.
  */
 /*
- * $Id: SAX2DOM.java,v 1.7 2006/01/26 07:01:40 jeffsuttor Exp $
+ * $Id: SAX2DOM.java,v 1.8.2.1 2006/12/04 18:45:41 spericas Exp $
  */
 
 
@@ -68,7 +68,7 @@
     static final DocumentBuilderFactory _factory =
             DocumentBuilderFactory.newInstance();
 
-    public SAX2DOM() throws ParserConfigurationException {
+   public SAX2DOM() throws ParserConfigurationException {
         synchronized (SAX2DOM.class) {
           _document = _factory.newDocumentBuilder().newDocument();
         }
--- a/src/share/classes/com/sun/org/apache/xalan/internal/xsltc/trax/TemplatesImpl.java	Wed May 06 11:27:39 2009 -0700
+++ b/src/share/classes/com/sun/org/apache/xalan/internal/xsltc/trax/TemplatesImpl.java	Thu May 07 10:30:34 2009 -0700
@@ -18,7 +18,7 @@
  * limitations under the License.
  */
 /*
- * $Id: TemplatesImpl.java,v 1.2.4.1 2005/09/06 12:19:26 pvedula Exp $
+ * $Id: TemplatesImpl.java,v 1.8 2007/03/26 20:12:27 spericas Exp $
  */
 
 package com.sun.org.apache.xalan.internal.xsltc.trax;
--- a/src/share/classes/com/sun/org/apache/xalan/internal/xsltc/trax/TransformerFactoryImpl.java	Wed May 06 11:27:39 2009 -0700
+++ b/src/share/classes/com/sun/org/apache/xalan/internal/xsltc/trax/TransformerFactoryImpl.java	Thu May 07 10:30:34 2009 -0700
@@ -18,7 +18,7 @@
  * limitations under the License.
  */
 /*
- * $Id: TransformerFactoryImpl.java,v 1.2.4.1 2005/09/15 06:15:38 pvedula Exp $
+ * $Id: TransformerFactoryImpl.java,v 1.8 2007/04/09 21:30:41 joehw Exp $
  */
 
 package com.sun.org.apache.xalan.internal.xsltc.trax;
--- a/src/share/classes/com/sun/org/apache/xalan/internal/xsltc/trax/TransformerImpl.java	Wed May 06 11:27:39 2009 -0700
+++ b/src/share/classes/com/sun/org/apache/xalan/internal/xsltc/trax/TransformerImpl.java	Thu May 07 10:30:34 2009 -0700
@@ -18,7 +18,7 @@
  * limitations under the License.
  */
 /*
- * $Id: TransformerImpl.java,v 1.5 2005/09/28 13:48:46 pvedula Exp $
+ * $Id: TransformerImpl.java,v 1.10 2007/06/13 01:57:09 joehw Exp $
  */
 
 package com.sun.org.apache.xalan.internal.xsltc.trax;
--- a/src/share/classes/com/sun/org/apache/xerces/internal/dom/EntityImpl.java	Wed May 06 11:27:39 2009 -0700
+++ b/src/share/classes/com/sun/org/apache/xerces/internal/dom/EntityImpl.java	Thu May 07 10:30:34 2009 -0700
@@ -148,7 +148,6 @@
      * @exception DOMException
      *   <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
      */
-
     public void setPrefix(String prefix)
         throws DOMException
     {
--- a/src/share/classes/com/sun/org/apache/xerces/internal/impl/PropertyManager.java	Wed May 06 11:27:39 2009 -0700
+++ b/src/share/classes/com/sun/org/apache/xerces/internal/impl/PropertyManager.java	Thu May 07 10:30:34 2009 -0700
@@ -45,8 +45,8 @@
 public class PropertyManager {
 
 
-    protected static final String STAX_NOTATIONS = "javax.xml.stream.notations";
-    protected static final String STAX_ENTITIES = "javax.xml.stream.entities";
+    public static final String STAX_NOTATIONS = "javax.xml.stream.notations";
+    public static final String STAX_ENTITIES = "javax.xml.stream.entities";
 
     private static final String STRING_INTERNING = "http://xml.org/sax/features/string-interning";
 
--- a/src/share/classes/com/sun/org/apache/xerces/internal/impl/XMLDocumentFragmentScannerImpl.java	Wed May 06 11:27:39 2009 -0700
+++ b/src/share/classes/com/sun/org/apache/xerces/internal/impl/XMLDocumentFragmentScannerImpl.java	Thu May 07 10:30:34 2009 -0700
@@ -289,6 +289,8 @@
     protected boolean fReportCdataEvent = false ;
     protected boolean fIsCoalesce = false ;
     protected String fDeclaredEncoding =  null;
+    /** Disallow doctype declaration. */
+    protected boolean fDisallowDoctype = false;
 
     // drivers
 
@@ -1852,6 +1854,11 @@
         }
         // start general entity
         if (!fEntityStore.isDeclaredEntity(name)) {
+            //SUPPORT_DTD=false && ReplaceEntityReferences should throw exception
+            if (fDisallowDoctype && fReplaceEntityReferences) {
+                reportFatalError("EntityNotDeclared", new Object[]{name});
+                return;
+            }
             //REVISIT: one more case needs to be included: external PE and standalone is no
             if ( fHasExternalDTD && !fStandalone) {
                 if (fValidation)
--- a/src/share/classes/com/sun/org/apache/xerces/internal/impl/XMLDocumentScannerImpl.java	Wed May 06 11:27:39 2009 -0700
+++ b/src/share/classes/com/sun/org/apache/xerces/internal/impl/XMLDocumentScannerImpl.java	Thu May 07 10:30:34 2009 -0700
@@ -62,6 +62,10 @@
  * @author Arnaud  Le Hors, IBM
  * @author Eric Ye, IBM
  * @author Sunitha Reddy, Sun Microsystems
+ *
+ * Refer to the table in unit-test javax.xml.stream.XMLStreamReaderTest.SupportDTD for changes
+ * related to property SupportDTD.
+ * @author Joe Wang, Sun Microsystems
  */
 public class XMLDocumentScannerImpl
         extends XMLDocumentFragmentScannerImpl{
@@ -185,9 +189,6 @@
     /** Load external DTD. */
     protected boolean fLoadExternalDTD = true;
 
-    /** Disallow doctype declaration. */
-    protected boolean fDisallowDoctype = false;
-
     // state
 
     /** Seen doctype declaration. */
@@ -227,8 +228,8 @@
     /** String. */
     private XMLString fString = new XMLString();
 
-    public static final char [] DOCTYPE = {'D','O','C','T','Y','P','E'};
-    public static final char [] COMMENTSTRING = {'-','-'};
+    private static final char [] DOCTYPE = {'D','O','C','T','Y','P','E'};
+    private static final char [] COMMENTSTRING = {'-','-'};
 
     //
     // Constructors
@@ -708,6 +709,12 @@
     //
     // Private methods
     //
+    /** Set the scanner state after scanning DTD */
+    protected void setEndDTDScanState() {
+        setScannerState(SCANNER_STATE_PROLOG);
+        setDriver(fPrologDriver);
+        fEntityManager.setEntityHandler(XMLDocumentScannerImpl.this);
+    }
 
     /** Returns the scanner state name. */
     protected String getScannerStateName(int state) {
@@ -930,19 +937,20 @@
                             reportFatalError("AlreadySeenDoctype", null);
                         }
                         fSeenDoctypeDecl = true;
-                        if(fDTDDriver == null){
-                            fDTDDriver = new DTDDriver();
-                        }
-
                         // scanDoctypeDecl() sends XNI doctypeDecl event that
                         // in SAX is converted to startDTD() event.
                         if (scanDoctypeDecl(fDisallowDoctype)) {
+                            //allow parsing of entity decls to continue in order to stay well-formed
                             setScannerState(SCANNER_STATE_DTD_INTERNAL_DECLS);
                             fSeenInternalSubset = true;
+                            if(fDTDDriver == null){
+                                fDTDDriver = new DTDDriver();
+                            }
                             setDriver(fContentDriver);
-                            int dtdEvent = fDTDDriver.next();
+                            //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;
+                            //return fDisallowDoctype ? next() : dtdEvent;
                         }
 
                         /** xxx:check this part again
@@ -955,17 +963,17 @@
                         }
                          */
 
-                        if (fDisallowDoctype) {
-                            setScannerState(SCANNER_STATE_PROLOG);
-                            return next();
-                        }
-
                         // handle external subset
                         if (fDoctypeSystemId != null) {
                             if (((fValidation || fLoadExternalDTD)
                                 && (fValidationManager == null || !fValidationManager.isCachedDTD()))) {
-                                setScannerState(SCANNER_STATE_DTD_EXTERNAL);
+                                if (!fDisallowDoctype)
+                                    setScannerState(SCANNER_STATE_DTD_EXTERNAL);
+                                else
+                                    setScannerState(SCANNER_STATE_PROLOG);
                                 setDriver(fContentDriver);
+                                if(fDTDDriver == null)
+                                    fDTDDriver = new DTDDriver();
                                 return fDTDDriver.next();
 
                             }
@@ -976,8 +984,13 @@
                                 // This handles the case of a DOCTYPE that had neither an internal subset or an external subset.
                                 fDTDScanner.setInputSource(fExternalSubsetSource);
                                 fExternalSubsetSource = null;
-                                setScannerState(SCANNER_STATE_DTD_EXTERNAL_DECLS);
+                                if (!fDisallowDoctype)
+                                    setScannerState(SCANNER_STATE_DTD_EXTERNAL_DECLS);
+                                else
+                                    setScannerState(SCANNER_STATE_PROLOG);
                                 setDriver(fContentDriver);
+                                if(fDTDDriver == null)
+                                    fDTDDriver = new DTDDriver();
                                 return fDTDDriver.next();
                             }
                         }
@@ -1117,19 +1130,21 @@
                                 }
                                 fMarkupDepth--;
 
-                                // scan external subset next
-                                if (!XMLDocumentScannerImpl.this.fDisallowDoctype &&
-                                        fDoctypeSystemId != null && (fValidation || fLoadExternalDTD)) {
-                                    setScannerState(SCANNER_STATE_DTD_EXTERNAL);
+                                if (fDisallowDoctype) {
+                                    //simply reset the entity store without having to mess around
+                                    //with the DTD Scanner code
+                                    fEntityStore = fEntityManager.getEntityStore();
+                                    fEntityStore.reset();
+                                } else {
+                                    // scan external subset next unless we are ignoring DTDs
+                                    if (fDoctypeSystemId != null && (fValidation || fLoadExternalDTD)) {
+                                        setScannerState(SCANNER_STATE_DTD_EXTERNAL);
+                                        break;
+                                    }
                                 }
 
-                                // break out of here
-                                else {
-                                    setScannerState(SCANNER_STATE_PROLOG);
-                                    setDriver(fPrologDriver);
-                                    fEntityManager.setEntityHandler(XMLDocumentScannerImpl.this);
-                                    return true;
-                                }
+                                setEndDTDScanState();
+                                return true;
                             }
                             break;
                         }
@@ -1160,13 +1175,16 @@
                             boolean completeDTD = true;
                             boolean moreToScan = fDTDScanner.scanDTDExternalSubset(completeDTD);
                             if (!moreToScan) {
-                                setScannerState(SCANNER_STATE_PROLOG);
-                                setDriver(fPrologDriver);
-                                fEntityManager.setEntityHandler(XMLDocumentScannerImpl.this);
+                                setEndDTDScanState();
                                 return true;
                             }
                             break;
                         }
+                        case SCANNER_STATE_PROLOG : {
+                            // skip entity decls
+                            setEndDTDScanState();
+                            return true;
+                        }
                         default: {
                             throw new XNIException("DTDDriver#dispatch: scanner state="+fScannerState+" ("+getScannerStateName(fScannerState)+')');
                         }
--- a/src/share/classes/com/sun/org/apache/xerces/internal/impl/XMLStreamFilterImpl.java	Wed May 06 11:27:39 2009 -0700
+++ b/src/share/classes/com/sun/org/apache/xerces/internal/impl/XMLStreamFilterImpl.java	Thu May 07 10:30:34 2009 -0700
@@ -56,7 +56,6 @@
      * hasNext() to advance the underlining stream in order to find the next acceptable event
      */
     private boolean fStreamAdvancedByHasNext = false;
-
     /** Creates a new instance of XMLStreamFilterImpl */
 
     public XMLStreamFilterImpl(XMLStreamReader reader,StreamFilter filter){
@@ -436,7 +435,6 @@
      */
     public String getVersion() {
         return fStreamReader.getVersion();
-
     }
 
     /**
@@ -532,5 +530,4 @@
     public String getAttributeLocalName(int index){
         return fStreamReader.getAttributeLocalName(index);
     }
-
 }
--- a/src/share/classes/com/sun/org/apache/xerces/internal/impl/msg/XIncludeMessages.properties	Wed May 06 11:27:39 2009 -0700
+++ b/src/share/classes/com/sun/org/apache/xerces/internal/impl/msg/XIncludeMessages.properties	Thu May 07 10:30:34 2009 -0700
@@ -34,4 +34,3 @@
 # Messages from erroneous set-up
 IncompatibleNamespaceContext = The type of the NamespaceContext is incompatible with using XInclude; it must be an instance of XIncludeNamespaceSupport
 ExpandedSystemId = Could not expand system id of included resource
-null
--- a/src/share/classes/com/sun/org/apache/xerces/internal/impl/xs/traversers/XSAttributeChecker.java	Wed May 06 11:27:39 2009 -0700
+++ b/src/share/classes/com/sun/org/apache/xerces/internal/impl/xs/traversers/XSAttributeChecker.java	Thu May 07 10:30:34 2009 -0700
@@ -1214,19 +1214,29 @@
             int max = ((XInt)attrValues[ATTIDX_MAXOCCURS]).intValue();
             if (max != SchemaSymbols.OCCURRENCE_UNBOUNDED) {
 
+                // maxOccurLimit is only check in secure mode
+                if (fSchemaHandler.fSecureProcessing != null) {
+                    String localName = element.getLocalName();
+
                 // The maxOccurs restriction no longer applies to elements
-                // and wildcards. These are now validated using a constant
-                // space algorithm. The restriction still applies to model
-                // groups such as xs:sequence.
+                    // and wildcards in a sequence in which they are the only
+                    // particle. These are now validated using a constant
+                    // space algorithm. The restriction still applies to all
+                    // other cases.
 
-                String localName = element.getLocalName();
-                if (fSchemaHandler.fSecureProcessing != null &&
-                        !localName.equals("element") && !localName.equals("any")) {
+                    // Determine if constant-space algorithm can be applied
+                    final boolean optimize =
+                            (localName.equals("element") || localName.equals("any")) &&
+                            (element.getNextSibling() == null) &&
+                            (element.getPreviousSibling() == null) &&
+                            (element.getParentNode().getLocalName().equals("sequence"));
+
+                    if (!optimize) {
                     //Revisit :: IMO this is not right place to check
                     // maxOccurNodeLimit.
                     int maxOccurNodeLimit = fSchemaHandler.fSecureProcessing.getMaxOccurNodeLimit();
                     if (max > maxOccurNodeLimit) {
-                        reportSchemaError("maxOccurLimit", new Object[] {new Integer(maxOccurNodeLimit)}, element);
+                        reportSchemaFatalError("maxOccurLimit", new Object[] {new Integer(maxOccurNodeLimit)}, element);
 
                         // reset max values in case processing continues on error
                         attrValues[ATTIDX_MAXOCCURS] = fXIntPool.getXInt(maxOccurNodeLimit);
@@ -1234,6 +1244,7 @@
                         max = maxOccurNodeLimit;
                     }
                 }
+                }
 
                 if (min > max) {
                     reportSchemaError ("p-props-correct.2.1",
@@ -1607,6 +1618,10 @@
         return retValue;
     }
 
+    void reportSchemaFatalError (String key, Object[] args, Element ele) {
+        fSchemaHandler.reportSchemaFatalError(key, args, ele);
+    }
+
     void reportSchemaError (String key, Object[] args, Element ele) {
         fSchemaHandler.reportSchemaError(key, args, ele);
     }
--- a/src/share/classes/com/sun/org/apache/xerces/internal/impl/xs/traversers/XSDHandler.java	Wed May 06 11:27:39 2009 -0700
+++ b/src/share/classes/com/sun/org/apache/xerces/internal/impl/xs/traversers/XSDHandler.java	Thu May 07 10:30:34 2009 -0700
@@ -2523,25 +2523,26 @@
         return false;
     }
 
+    void reportSchemaFatalError(String key, Object[] args, Element ele) {
+        reportSchemaErr(key, args, ele, XMLErrorReporter.SEVERITY_FATAL_ERROR);
+    }
+
     void reportSchemaError(String key, Object[] args, Element ele) {
+        reportSchemaErr(key, args, ele, XMLErrorReporter.SEVERITY_ERROR);
+    }
+
+    void reportSchemaWarning(String key, Object[] args, Element ele) {
+        reportSchemaErr(key, args, ele, XMLErrorReporter.SEVERITY_WARNING);
+    }
+
+    void reportSchemaErr(String key, Object[] args, Element ele, short type) {
         if (element2Locator(ele, xl)) {
             fErrorReporter.reportError(xl, XSMessageFormatter.SCHEMA_DOMAIN,
-                    key, args, XMLErrorReporter.SEVERITY_ERROR);
+                    key, args, type);
         }
         else {
             fErrorReporter.reportError(XSMessageFormatter.SCHEMA_DOMAIN,
-                    key, args, XMLErrorReporter.SEVERITY_ERROR);
-        }
-    }
-
-    void reportSchemaWarning(String key, Object[] args, Element ele) {
-        if (element2Locator(ele, xl)) {
-            fErrorReporter.reportError(xl, XSMessageFormatter.SCHEMA_DOMAIN,
-                    key, args, XMLErrorReporter.SEVERITY_WARNING);
-        }
-        else {
-            fErrorReporter.reportError(XSMessageFormatter.SCHEMA_DOMAIN,
-                    key, args, XMLErrorReporter.SEVERITY_WARNING);
+                    key, args, type);
         }
     }
 
--- a/src/share/classes/com/sun/org/apache/xerces/internal/jaxp/validation/XMLSchemaFactory.java	Wed May 06 11:27:39 2009 -0700
+++ b/src/share/classes/com/sun/org/apache/xerces/internal/jaxp/validation/XMLSchemaFactory.java	Thu May 07 10:30:34 2009 -0700
@@ -111,6 +111,10 @@
         fXMLSchemaLoader.setProperty(XMLGRAMMAR_POOL, fXMLGrammarPoolWrapper);
         fXMLSchemaLoader.setEntityResolver(fDOMEntityResolverWrapper);
         fXMLSchemaLoader.setErrorHandler(fErrorHandlerWrapper);
+
+        // Enable secure processing feature by default
+        fSecurityManager = new SecurityManager();
+        fXMLSchemaLoader.setProperty(SECURITY_MANAGER, fSecurityManager);
     }
 
     /**
--- a/src/share/classes/com/sun/org/apache/xerces/internal/xinclude/XIncludeHandler.java	Wed May 06 11:27:39 2009 -0700
+++ b/src/share/classes/com/sun/org/apache/xerces/internal/xinclude/XIncludeHandler.java	Thu May 07 10:30:34 2009 -0700
@@ -943,8 +943,7 @@
                 setState(STATE_IGNORE);
             }
             else {
-                reportFatalError("NoFallback",
-                    new Object[] { attributes.getValue(null, "href") });
+                reportFatalError("NoFallback");
             }
         }
         else if (isFallbackElement(element)) {
@@ -1002,8 +1001,7 @@
             // we check to see if the children of this include element contained a fallback
             if (getState() == STATE_EXPECT_FALLBACK
                 && !getSawFallback(fDepth + 1)) {
-                reportFatalError("NoFallback",
-                    new Object[] { "unknown" });
+                reportFatalError("NoFallback");
             }
         }
         if (isFallbackElement(element)) {
--- a/src/share/classes/com/sun/org/apache/xml/internal/utils/ThreadControllerWrapper.java	Wed May 06 11:27:39 2009 -0700
+++ b/src/share/classes/com/sun/org/apache/xml/internal/utils/ThreadControllerWrapper.java	Thu May 07 10:30:34 2009 -0700
@@ -53,7 +53,35 @@
   {
 
     /**
-     * Will get a thread from the pool, execute the task
+      * This class was introduced as a fix for CR 6607339.
+      */
+     final class SafeThread extends Thread {
+          private volatile boolean ran = false;
+
+          public SafeThread(Runnable target) {
+              super(target);
+          }
+
+          public final void run() {
+              if (Thread.currentThread() != this) {
+                  throw new IllegalStateException("The run() method in a"
+                      + " SafeThread cannot be called from another thread.");
+              }
+              synchronized (this) {
+                 if (!ran) {
+                     ran = true;
+                 }
+                 else {
+                  throw new IllegalStateException("The run() method in a"
+                      + " SafeThread cannot be called more than once.");
+                 }
+              }
+              super.run();
+          }
+     }
+
+     /**
+     *  Will get a thread from the pool, execute the task
      *  and return the thread to the pool.
      *
      *  The return value is used only to wait for completion
@@ -68,7 +96,7 @@
     public Thread run(Runnable task, int priority)
     {
 
-      Thread t = new Thread(task);
+      Thread t = new SafeThread(task);
 
       t.start();
 
--- a/src/share/classes/com/sun/org/apache/xpath/internal/axes/NodeSequence.java	Wed May 06 11:27:39 2009 -0700
+++ b/src/share/classes/com/sun/org/apache/xpath/internal/axes/NodeSequence.java	Thu May 07 10:30:34 2009 -0700
@@ -18,7 +18,7 @@
  * limitations under the License.
  */
 /*
- * $Id: NodeSequence.java,v 1.2.4.2 2005/09/14 19:45:19 jeffsuttor Exp $
+ * $Id: NodeSequence.java,v 1.6 2007/01/12 19:26:42 spericas Exp $
  */
 package com.sun.org.apache.xpath.internal.axes;
 
--- a/src/share/classes/com/sun/xml/internal/stream/events/XMLEventAllocatorImpl.java	Wed May 06 11:27:39 2009 -0700
+++ b/src/share/classes/com/sun/xml/internal/stream/events/XMLEventAllocatorImpl.java	Thu May 07 10:30:34 2009 -0700
@@ -25,6 +25,8 @@
 
 package com.sun.xml.internal.stream.events;
 
+import com.sun.org.apache.xerces.internal.impl.PropertyManager;
+import java.util.List;
 import javax.xml.stream.util.XMLEventAllocator;
 import javax.xml.stream.*;
 import javax.xml.stream.events.*;
@@ -144,7 +146,13 @@
                 break;
             }
             case XMLEvent.DTD:{
-                event = new DTDEvent(streamReader.getText());
+                DTDEvent dtdEvent = new DTDEvent(streamReader.getText());
+                dtdEvent.setLocation(streamReader.getLocation());
+                List entities = (List)streamReader.getProperty(PropertyManager.STAX_ENTITIES);
+                if (entities != null && entities.size() != 0) dtdEvent.setEntities(entities);
+                List notations = (List)streamReader.getProperty(PropertyManager.STAX_NOTATIONS);
+                if (notations != null && notations.size() != 0) dtdEvent.setNotations(notations);
+                event = dtdEvent;
                 break;
             }
             case XMLEvent.CDATA:{