changeset 42802:2a03abb03c06

8170556: Warnings cleanup related to JDK-8167340 Reviewed-by: dfuchs, lancea, clanger
author joehw
date Thu, 15 Dec 2016 13:57:04 -0800
parents b6efd9c4f416
children 0bdf34ac888c
files jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/XMLDocumentFragmentScannerImpl.java jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/XMLDocumentScannerImpl.java jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/XMLEntityManager.java jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/XMLStreamReaderImpl.java jaxp/src/java.xml/share/classes/com/sun/xml/internal/stream/XMLEntityStorage.java jaxp/src/java.xml/share/classes/com/sun/xml/internal/stream/dtd/DTDGrammarUtil.java jaxp/src/java.xml/share/classes/com/sun/xml/internal/stream/dtd/nonvalidating/DTDGrammar.java jaxp/src/java.xml/share/classes/com/sun/xml/internal/stream/dtd/nonvalidating/XMLAttributeDecl.java jaxp/src/java.xml/share/classes/com/sun/xml/internal/stream/dtd/nonvalidating/XMLElementDecl.java jaxp/src/java.xml/share/classes/com/sun/xml/internal/stream/dtd/nonvalidating/XMLNotationDecl.java jaxp/src/java.xml/share/classes/com/sun/xml/internal/stream/events/DTDEvent.java jaxp/src/java.xml/share/classes/com/sun/xml/internal/stream/events/EndElementEvent.java jaxp/src/java.xml/share/classes/com/sun/xml/internal/stream/events/StartElementEvent.java jaxp/src/java.xml/share/classes/com/sun/xml/internal/stream/events/XMLEventAllocatorImpl.java jaxp/src/java.xml/share/classes/com/sun/xml/internal/stream/events/XMLEventFactoryImpl.java jaxp/src/java.xml/share/classes/com/sun/xml/internal/stream/util/ReadOnlyIterator.java jaxp/src/java.xml/share/classes/com/sun/xml/internal/stream/util/ThreadLocalBufferAllocator.java jaxp/src/java.xml/share/classes/com/sun/xml/internal/stream/writers/UTF8OutputStreamWriter.java jaxp/src/java.xml/share/classes/com/sun/xml/internal/stream/writers/XMLEventWriterImpl.java jaxp/src/java.xml/share/classes/com/sun/xml/internal/stream/writers/XMLStreamWriterImpl.java jaxp/src/java.xml/share/classes/javax/xml/stream/EventFilter.java jaxp/src/java.xml/share/classes/javax/xml/stream/FactoryConfigurationError.java jaxp/src/java.xml/share/classes/javax/xml/stream/Location.java jaxp/src/java.xml/share/classes/javax/xml/stream/SecuritySupport.java jaxp/src/java.xml/share/classes/javax/xml/stream/StreamFilter.java jaxp/src/java.xml/share/classes/javax/xml/stream/XMLEventFactory.java jaxp/src/java.xml/share/classes/javax/xml/stream/XMLEventReader.java jaxp/src/java.xml/share/classes/javax/xml/stream/XMLEventWriter.java jaxp/src/java.xml/share/classes/javax/xml/stream/XMLInputFactory.java jaxp/src/java.xml/share/classes/javax/xml/stream/XMLOutputFactory.java jaxp/src/java.xml/share/classes/javax/xml/stream/XMLReporter.java jaxp/src/java.xml/share/classes/javax/xml/stream/XMLResolver.java jaxp/src/java.xml/share/classes/javax/xml/stream/XMLStreamConstants.java jaxp/src/java.xml/share/classes/javax/xml/stream/XMLStreamException.java jaxp/src/java.xml/share/classes/javax/xml/stream/XMLStreamReader.java jaxp/src/java.xml/share/classes/javax/xml/stream/XMLStreamWriter.java jaxp/src/java.xml/share/classes/javax/xml/stream/events/Attribute.java jaxp/src/java.xml/share/classes/javax/xml/stream/events/Characters.java jaxp/src/java.xml/share/classes/javax/xml/stream/events/Comment.java jaxp/src/java.xml/share/classes/javax/xml/stream/events/DTD.java jaxp/src/java.xml/share/classes/javax/xml/stream/events/EndDocument.java jaxp/src/java.xml/share/classes/javax/xml/stream/events/EndElement.java jaxp/src/java.xml/share/classes/javax/xml/stream/events/EntityDeclaration.java jaxp/src/java.xml/share/classes/javax/xml/stream/events/EntityReference.java jaxp/src/java.xml/share/classes/javax/xml/stream/events/Namespace.java jaxp/src/java.xml/share/classes/javax/xml/stream/events/NotationDeclaration.java jaxp/src/java.xml/share/classes/javax/xml/stream/events/ProcessingInstruction.java jaxp/src/java.xml/share/classes/javax/xml/stream/events/StartDocument.java jaxp/src/java.xml/share/classes/javax/xml/stream/events/StartElement.java jaxp/src/java.xml/share/classes/javax/xml/stream/events/XMLEvent.java jaxp/src/java.xml/share/classes/javax/xml/stream/util/EventReaderDelegate.java jaxp/src/java.xml/share/classes/javax/xml/stream/util/StreamReaderDelegate.java jaxp/src/java.xml/share/classes/javax/xml/stream/util/XMLEventAllocator.java jaxp/src/java.xml/share/classes/javax/xml/stream/util/XMLEventConsumer.java
diffstat 54 files changed, 1423 insertions(+), 1385 deletions(-) [+]
line wrap: on
line diff
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/XMLDocumentFragmentScannerImpl.java	Thu Dec 15 09:03:36 2016 +0100
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/XMLDocumentFragmentScannerImpl.java	Thu Dec 15 13:57:04 2016 -0800
@@ -218,8 +218,8 @@
     };
 
 
-    private static final char [] cdata = {'[','C','D','A','T','A','['};
-    static final char [] xmlDecl = {'<','?','x','m','l'};
+    private static final char [] CDATA = {'[','C','D','A','T','A','['};
+    static final char [] XMLDECL = {'<','?','x','m','l'};
     // private static final char [] endTag = {'<','/'};
     // debugging
 
@@ -232,13 +232,9 @@
     /** Debug content driver scanning. */
     protected static final boolean DEBUG_START_END_ELEMENT = false;
 
-
-    /** Debug driver next */
-    protected static final boolean DEBUG_NEXT = false ;
-
     /** Debug driver next */
     protected static final boolean DEBUG = false;
-    protected static final boolean DEBUG_COALESCE = false;
+
     //
     // Data
     //
@@ -371,16 +367,16 @@
     protected XMLString fTempString2 = new XMLString();
 
     /** Array of 3 strings. */
-    private String[] fStrings = new String[3];
-
-    /** Making the buffer accesible to derived class -- String buffer. */
+    private final String[] fStrings = new String[3];
+
+    /** Making the buffer accessible to derived class -- String buffer. */
     protected XMLStringBuffer fStringBuffer = new XMLStringBuffer();
 
-    /** Making the buffer accesible to derived class -- String buffer. */
+    /** Making the buffer accessible to derived class -- String buffer. */
     protected XMLStringBuffer fStringBuffer2 = new XMLStringBuffer();
 
     /** stores character data. */
-    /** Making the buffer accesible to derived class -- stores PI data */
+    /** Making the buffer accessible to derived class -- stores PI data */
     protected XMLStringBuffer fContentBuffer = new XMLStringBuffer();
 
     /** Single character array. */
@@ -633,22 +629,23 @@
 
         // other settings
         // fDocumentSystemId = null;
-        fNamespaces = ((Boolean)propertyManager.getProperty(XMLInputFactory.IS_NAMESPACE_AWARE)).booleanValue();
+        fNamespaces = ((Boolean)propertyManager.getProperty(XMLInputFactory.IS_NAMESPACE_AWARE));
         fNotifyBuiltInRefs = false ;
 
         //fElementStack2.clear();
         //fReplaceEntityReferences = true;
         //fSupportExternalEntities = true;
         Boolean bo = (Boolean)propertyManager.getProperty(XMLInputFactory.IS_REPLACING_ENTITY_REFERENCES);
-        fReplaceEntityReferences = bo.booleanValue();
+        fReplaceEntityReferences = bo;
         bo = (Boolean)propertyManager.getProperty(XMLInputFactory.IS_SUPPORTING_EXTERNAL_ENTITIES);
-        fSupportExternalEntities = bo.booleanValue();
-        Boolean cdata = (Boolean)propertyManager.getProperty(Constants.ZEPHYR_PROPERTY_PREFIX + Constants.STAX_REPORT_CDATA_EVENT) ;
+        fSupportExternalEntities = bo;
+        Boolean cdata = (Boolean)propertyManager.getProperty(
+                Constants.ZEPHYR_PROPERTY_PREFIX + Constants.STAX_REPORT_CDATA_EVENT) ;
         if(cdata != null)
-            fReportCdataEvent = cdata.booleanValue() ;
+            fReportCdataEvent = cdata ;
         Boolean coalesce = (Boolean)propertyManager.getProperty(XMLInputFactory.IS_COALESCING) ;
         if(coalesce != null)
-            fIsCoalesce = coalesce.booleanValue();
+            fIsCoalesce = coalesce;
         fReportCdataEvent = fIsCoalesce ? false : (fReportCdataEvent && true) ;
         //if fIsCoalesce is set to true, set the value of fReplaceEntityReferences to true,
         //if fIsCoalesce is set to false, take the value of fReplaceEntityReferences as set by application
@@ -703,7 +700,7 @@
      * are recognized by this component.
      */
     public String[] getRecognizedFeatures() {
-        return (String[])(RECOGNIZED_FEATURES.clone());
+        return RECOGNIZED_FEATURES.clone();
     } // getRecognizedFeatures():String[]
 
     /**
@@ -742,7 +739,7 @@
      * are recognized by this component.
      */
     public String[] getRecognizedProperties() {
-        return (String[])(RECOGNIZED_PROPERTIES.clone());
+        return RECOGNIZED_PROPERTIES.clone();
     } // getRecognizedProperties():String[]
 
     /**
@@ -990,7 +987,8 @@
         // set standalone
         fStandaloneSet = standalone != null;
         fStandalone = fStandaloneSet && standalone.equals("yes");
-        ///xxx see where its used.. this is not used anywhere. it may be useful for entity to store this information
+        ///xxx see where its used.. this is not used anywhere.
+        //it may be useful for entity to store this information
         //but this information is only related with Document Entity.
         fEntityManager.setStandalone(fStandalone);
 
@@ -1199,7 +1197,8 @@
             if(rawname != null && skipFromTheBuffer(rawname)){
                 fLastPointerLocation++ ;
                 if(DEBUG_SKIP_ALGORITHM){
-                    System.out.println("Element " + fElementRawname + " was SKIPPED at pointer location = " + fLastPointerLocation);
+                    System.out.println("Element " + fElementRawname +
+                            " was SKIPPED at pointer location = " + fLastPointerLocation);
                 }
                 return true ;
             } else{
@@ -1233,7 +1232,8 @@
             if(fElementArray[pointer] != null && skipFromTheBuffer(fElementArray[pointer])){
                 if(DEBUG_SKIP_ALGORITHM){
                     System.out.println();
-                    System.out.println("Element " + fElementRawname + " was SKIPPED at depth = " + fElementStack.fDepth + " column = " + column );
+                    System.out.println("Element " + fElementRawname + " was SKIPPED at depth = " +
+                            fElementStack.fDepth + " column = " + column );
                     System.out.println();
                 }
                 fLastPointerLocation = pointer ;
@@ -1317,7 +1317,8 @@
             if(DEBUG)System.out.println("Element scanned in start element is " + fElementQName.toString());
             if(DEBUG_SKIP_ALGORITHM){
                 if(fAdd){
-                    System.out.println("Elements are being ADDED -- elemet added is = " + fElementQName.rawname + " at count = " + fElementStack.fCount);
+                    System.out.println("Elements are being ADDED -- elemet added is = " +
+                            fElementQName.rawname + " at count = " + fElementStack.fCount);
                 }
             }
 
@@ -1395,7 +1396,8 @@
         }
 
 
-        if (DEBUG_START_END_ELEMENT) System.out.println(this.getClass().toString() + "<<< scanStartElement(): "+fEmptyElement);
+        if (DEBUG_START_END_ELEMENT) System.out.println(this.getClass().toString() +
+                "<<< scanStartElement(): "+fEmptyElement);
         return fEmptyElement;
 
     } // scanStartElement():boolean
@@ -1434,84 +1436,9 @@
     }
 
     public boolean hasAttributes(){
-        return fAttributes.getLength() > 0 ? true : false ;
+        return fAttributes.getLength() > 0;
     }
 
-
-    /**
-     * Scans an attribute.
-     * <p>
-     * <pre>
-     * [41] Attribute ::= Name Eq AttValue
-     * </pre>
-     * <p>
-     * <strong>Note:</strong> This method assumes that the next
-     * character on the stream is the first character of the attribute
-     * name.
-     * <p>
-     * <strong>Note:</strong> This method uses the fAttributeQName and
-     * fQName variables. The contents of these variables will be
-     * destroyed.
-     *
-     * @param attributes The attributes list for the scanned attribute.
-     */
-
-    /**
-     * protected void scanAttribute(AttributeIteratorImpl attributes)
-     * throws IOException, XNIException {
-     * if (DEBUG_START_END_ELEMENT) System.out.println(">>> scanAttribute()");
-     *
-     *
-     * // name
-     * if (fNamespaces) {
-     * fEntityScanner.scanQName(fAttributeQName);
-     * }
-     * else {
-     * String name = fEntityScanner.scanName();
-     * fAttributeQName.setValues(null, name, name, null);
-     * }
-     *
-     * // equals
-     * fEntityScanner.skipSpaces();
-     * if (!fEntityScanner.skipChar('=')) {
-     * reportFatalError("EqRequiredInAttribute",
-     * new Object[]{fAttributeQName.rawname});
-     * }
-     * fEntityScanner.skipSpaces();
-     *
-     *
-     * // content
-     * int oldLen = attributes.getLength();
-     */
-    /**xxx there is one check of duplicate attribute that has been removed.
-     * attributes.addAttribute(fAttributeQName, XMLSymbols.fCDATASymbol, null);
-     *
-     * // WFC: Unique Att Spec
-     * if (oldLen == attributes.getLength()) {
-     * reportFatalError("AttributeNotUnique",
-     * new Object[]{fCurrentElement.rawname,
-     * fAttributeQName.rawname});
-     * }
-     */
-
-    /*
-        //REVISIT: one more case needs to be included: external PE and standalone is no
-        boolean isVC =  fHasExternalDTD && !fStandalone;
-        scanAttributeValue(fTempString, fTempString2,
-                           fAttributeQName.rawname, attributes,
-                           oldLen, isVC);
-
-        //attributes.setValue(oldLen, fTempString.toString());
-        //attributes.setNonNormalizedValue(oldLen, fTempString2.toString());
-        //attributes.setSpecified(oldLen, true);
-
-        AttributeImpl attribute = new AttributeImpl(fAttributeQName.prefix,fAttributeQName.localpart,fAttributeQName.uri,fTempString.toString(),fTempString2.toString(),XMLSymbols.fCDATASymbol,true);
-        fAttributes.addAttribute(attribute);
-        if (DEBUG_START_END_ELEMENT) System.out.println("<<< scanAttribute()");
-    } // scanAttribute(XMLAttributes)
-
-     */
-
     /** return the attribute iterator implementation */
     public XMLAttributesIteratorImpl getAttributeIterator(){
         if(dtdGrammarUtil != null && fAddDefaultAttr){
@@ -2624,7 +2551,7 @@
                                         null);
                             }
                             setScannerState(SCANNER_STATE_COMMENT);
-                        } else if (fEntityScanner.skipString(cdata)) {
+                        } else if (fEntityScanner.skipString(CDATA)) {
                             fCDataStart = true;
                             setScannerState(SCANNER_STATE_CDATA );
                         } else if (!scanForDoctypeHook()) {
@@ -2710,62 +2637,56 @@
         public int next() throws IOException, XNIException {
             while (true) {
             try {
-                if(DEBUG_NEXT){
-                    System.out.println("NOW IN FragmentContentDriver");
-                    System.out.println("Entering the FragmentContentDriver with = " + getScannerStateName(fScannerState));
-                }
 
                 //decide the actual sub state of the scanner.For more information refer to the javadoc of
                 //decideSubState.
 
-                switch (fScannerState) {
-                    case SCANNER_STATE_CONTENT: {
-                        final int ch = fEntityScanner.peekChar();
-                        if (ch == '<') {
-                            fEntityScanner.scanChar(null);
-                            setScannerState(SCANNER_STATE_START_OF_MARKUP);
-                        } else if (ch == '&') {
-                            fEntityScanner.scanChar(NameType.REFERENCE);
-                            setScannerState(SCANNER_STATE_REFERENCE) ; //XMLEvent.ENTITY_REFERENCE ); //SCANNER_STATE_REFERENCE
-                            break;
-                        } else {
-                            //element content is there..
-                            setScannerState(SCANNER_STATE_CHARACTER_DATA);
-                            break;
-                        }
+                if (fScannerState == SCANNER_STATE_CONTENT) {
+                    final int ch = fEntityScanner.peekChar();
+                    if (ch == '<') {
+                        fEntityScanner.scanChar(null);
+                        setScannerState(SCANNER_STATE_START_OF_MARKUP);
+                    } else if (ch == '&') {
+                        fEntityScanner.scanChar(NameType.REFERENCE);
+                        setScannerState(SCANNER_STATE_REFERENCE) ;
+                    } else {
+                        //element content is there..
+                        setScannerState(SCANNER_STATE_CHARACTER_DATA);
                     }
-
-                    case SCANNER_STATE_START_OF_MARKUP: {
-                        startOfMarkup();
-                        break;
-                    }//case: SCANNER_STATE_START_OF_MARKUP
-
-                }//end of switch
+                }
+
+                if (fScannerState == SCANNER_STATE_START_OF_MARKUP) {
+                    startOfMarkup();
+                }
+
                 //decideSubState() ;
 
                 //do some special handling if isCoalesce is set to true.
-                if(fIsCoalesce){
+                if (fIsCoalesce) {
                     fUsebuffer = true ;
                     //if the last section was character data
-                    if(fLastSectionWasCharacterData){
-
-                        //if we dont encounter any CDATA or ENTITY REFERENCE and current state is also not SCANNER_STATE_CHARACTER_DATA
+                    if (fLastSectionWasCharacterData) {
+
+                        //if we dont encounter any CDATA or ENTITY REFERENCE and
+                        //current state is also not SCANNER_STATE_CHARACTER_DATA
                         //return the last scanned charactrer data.
-                        if((fScannerState != SCANNER_STATE_CDATA) && (fScannerState != SCANNER_STATE_REFERENCE)
-                        && (fScannerState != SCANNER_STATE_CHARACTER_DATA)){
+                        if ((fScannerState != SCANNER_STATE_CDATA)
+                                && (fScannerState != SCANNER_STATE_REFERENCE)
+                                && (fScannerState != SCANNER_STATE_CHARACTER_DATA)) {
                             fLastSectionWasCharacterData = false;
                             return XMLEvent.CHARACTERS;
                         }
                     }//if last section was CDATA or ENTITY REFERENCE
                     //xxx: there might be another entity reference or CDATA after this
                     //<foo>blah blah &amp;&lt;<![CDATA[[aa]]>blah blah</foo>
-                    else if((fLastSectionWasCData || fLastSectionWasEntityReference)){
+                    else if ((fLastSectionWasCData || fLastSectionWasEntityReference)) {
                         //and current state is not SCANNER_STATE_CHARACTER_DATA
                         //or SCANNER_STATE_CDATA or SCANNER_STATE_REFERENCE
                         //this means there is nothing more to be coalesced.
                         //return the CHARACTERS event.
-                        if((fScannerState != SCANNER_STATE_CDATA) && (fScannerState != SCANNER_STATE_REFERENCE)
-                        && (fScannerState != SCANNER_STATE_CHARACTER_DATA)){
+                        if ((fScannerState != SCANNER_STATE_CDATA)
+                                && (fScannerState != SCANNER_STATE_REFERENCE)
+                                && (fScannerState != SCANNER_STATE_CHARACTER_DATA)){
 
                             fLastSectionWasCData = false;
                             fLastSectionWasEntityReference = false;
@@ -2774,11 +2695,6 @@
                     }
                 }
 
-
-                if(DEBUG_NEXT){
-                    System.out.println("Actual scanner state set by decideSubState is = " + getScannerStateName(fScannerState));
-                }
-
                 switch(fScannerState){
 
                     case XMLEvent.START_DOCUMENT :
@@ -2786,7 +2702,6 @@
 
                     case SCANNER_STATE_START_ELEMENT_TAG :{
 
-                        //xxx this function returns true when element is empty.. can be linked to end element event.
                         //returns true if the element is empty
                         fEmptyElement = scanStartElement() ;
                         //if the element is empty the next event is "end element"
@@ -2800,15 +2715,16 @@
                     }
 
                     case SCANNER_STATE_CHARACTER_DATA: {
-                        if(DEBUG_COALESCE){
-                            System.out.println("fLastSectionWasCData = " + fLastSectionWasCData);
-                            System.out.println("fIsCoalesce = " + fIsCoalesce);
-                        }
-                        //if last section was either entity reference or cdata or character data we should be using buffer
-                        fUsebuffer = fLastSectionWasEntityReference || fLastSectionWasCData || fLastSectionWasCharacterData ;
-
-                        //When coalesce is set to true and last state was REFERENCE or CDATA or CHARACTER_DATA, buffer should not be cleared.
-                        if( fIsCoalesce && (fLastSectionWasEntityReference || fLastSectionWasCData || fLastSectionWasCharacterData) ){
+
+                        //if last section was either entity reference or cdata or
+                        //character data we should be using buffer
+                        fUsebuffer = fLastSectionWasEntityReference || fLastSectionWasCData
+                                || fLastSectionWasCharacterData ;
+
+                        //When coalesce is set to true and last state was REFERENCE or
+                        //CDATA or CHARACTER_DATA, buffer should not be cleared.
+                        if( fIsCoalesce && (fLastSectionWasEntityReference ||
+                                fLastSectionWasCData || fLastSectionWasCharacterData) ){
                             fLastSectionWasEntityReference = false;
                             fLastSectionWasCData = false;
                             fLastSectionWasCharacterData = true ;
@@ -2822,9 +2738,7 @@
                         //scanContent sets the correct co-ordinates as per the content read
                         fTempString.length = 0;
                         int c = fEntityScanner.scanContent(fTempString);
-                        if(DEBUG){
-                            System.out.println("fTempString = " + fTempString);
-                        }
+
                         if(fEntityScanner.skipChar('<', null)){
                             //check if we have reached end of element
                             if(fEntityScanner.skipChar('/', NameType.ELEMENTEND)){
@@ -2841,21 +2755,17 @@
                                 setScannerState(SCANNER_STATE_START_OF_MARKUP);
                                 //there can be cdata ahead if coalesce is true we should call again
                                 if(fIsCoalesce){
-                                    fUsebuffer = true;
                                     fLastSectionWasCharacterData = true;
-                                    fContentBuffer.append(fTempString);
-                                    fTempString.length = 0;
+                                    bufferContent();
                                     continue;
                                 }
                             }
-                            //in case last section was either entity reference or cdata or character data -- we should be using buffer
+                            //in case last section was either entity reference or
+                            //cdata or character data -- we should be using buffer
                             if(fUsebuffer){
-                                fContentBuffer.append(fTempString);
-                                fTempString.length = 0;
+                                bufferContent();
                             }
-                            if(DEBUG){
-                                System.out.println("NOT USING THE BUFFER, STRING = " + fTempString.toString());
-                            }
+
                             if(dtdGrammarUtil!= null && dtdGrammarUtil.isIgnorableWhiteSpace(fContentBuffer)){
                                 if(DEBUG)System.out.println("Return SPACE EVENT");
                                 return XMLEvent.SPACE;
@@ -2863,13 +2773,7 @@
                                 return XMLEvent.CHARACTERS;
 
                         } else{
-                            fUsebuffer = true ;
-                            if(DEBUG){
-                                System.out.println("fContentBuffer = " + fContentBuffer);
-                                System.out.println("fTempString = " + fTempString);
-                            }
-                            fContentBuffer.append(fTempString);
-                            fTempString.length = 0;
+                            bufferContent();
                         }
                         if (c == '\r') {
                             if(DEBUG){
@@ -2969,7 +2873,8 @@
                             setScannerState(SCANNER_STATE_CONTENT);
                             //check the case when there is comment after single element document
                             //<foo/> and some comment after this
-                            return (fMarkupDepth == 0 && elementDepthIsZeroHook() ) ? XMLEvent.END_ELEMENT : XMLEvent.END_ELEMENT ;
+                            return (fMarkupDepth == 0 && elementDepthIsZeroHook() ) ?
+                                    XMLEvent.END_ELEMENT : XMLEvent.END_ELEMENT ;
 
                         } else if(scanEndElement() == 0) {
                             //It is last element of the document
@@ -3093,7 +2998,8 @@
 
                             if(fScannerState == SCANNER_STATE_REFERENCE){
                                 setScannerState(SCANNER_STATE_CONTENT);
-                                if (fReplaceEntityReferences && fEntityStore.isDeclaredEntity(fCurrentEntityName)) {
+                                if (fReplaceEntityReferences &&
+                                        fEntityStore.isDeclaredEntity(fCurrentEntityName)) {
                                     // Skip the entity reference, we don't care
                                     continue;
                                 }
@@ -3126,7 +3032,8 @@
                                         fStringBuffer.append((char)fEntityScanner.scanChar(null));
                                     }
                                 }
-                                String target = fSymbolTable.addSymbol(fStringBuffer.ch, fStringBuffer.offset, fStringBuffer.length);
+                                String target = fSymbolTable.addSymbol(fStringBuffer.ch,
+                                        fStringBuffer.offset, fStringBuffer.length);
                                 fContentBuffer.clear();
                                 scanPIData(target, fContentBuffer);
                             }
@@ -3269,7 +3176,8 @@
      */
 
     protected XMLString getString(){
-        if(fAttributeCacheUsedCount < initialCacheCount || fAttributeCacheUsedCount < attributeValueCache.size()){
+        if(fAttributeCacheUsedCount < initialCacheCount ||
+                fAttributeCacheUsedCount < attributeValueCache.size()){
             return attributeValueCache.get(fAttributeCacheUsedCount++);
         } else{
             XMLString str = new XMLString();
@@ -3299,13 +3207,20 @@
             fAttributes.refresh();
         }
         if(fScannerState == SCANNER_STATE_CHARACTER_DATA){
-            //since fTempString directly matches to the underlying main buffer
-            //store the data into buffer
-            fContentBuffer.append(fTempString);
-            //clear the XMLString so that data can't be added again.
-            fTempString.length = 0;
-            fUsebuffer = true;
+            bufferContent();
         }
     }
 
+    /**
+     * Since 'TempString' shares the buffer (a char array) with the CurrentEntity,
+     * when the cursor position reaches the end, that is, before the buffer is
+     * being loaded with new data, the content in the TempString needs to be
+     * copied into the ContentBuffer.
+     */
+    private void bufferContent() {
+        fContentBuffer.append(fTempString);
+        //clear the XMLString so that data can't be added again.
+        fTempString.length = 0;
+        fUsebuffer = true;
+    }
 } // class XMLDocumentFragmentScannerImpl
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/XMLDocumentScannerImpl.java	Thu Dec 15 09:03:36 2016 +0100
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/XMLDocumentScannerImpl.java	Thu Dec 15 13:57:04 2016 -0800
@@ -733,9 +733,6 @@
 
 
         public int next() throws IOException, XNIException {
-            if(DEBUG_NEXT){
-                System.out.println("NOW IN XMLDeclDriver");
-            }
 
             // next driver is prolog regardless of whether there
             // is an XMLDecl in this document
@@ -745,7 +742,7 @@
             //System.out.println("fEntityScanner = " + fEntityScanner);
             // scan XMLDecl
             try {
-                if (fEntityScanner.skipString(xmlDecl)) {
+                if (fEntityScanner.skipString(XMLDECL)) {
                     if (fEntityScanner.peekChar() == ' ') {
                         fMarkupDepth++;
                         scanXMLDeclOrTextDecl(false);
@@ -797,11 +794,7 @@
          */
 
         public int next() throws IOException, XNIException {
-            //System.out.println("here in next");
 
-            if(DEBUG_NEXT){
-                System.out.println("NOW IN PrologDriver");
-            }
             try {
                 do {
                     switch (fScannerState) {
@@ -1014,17 +1007,9 @@
         //
 
         public int next() throws IOException, XNIException{
-            // throw new XNIException("DTD Parsing is currently not supported");
-            if(DEBUG_NEXT){
-                System.out.println("Now in DTD Driver");
-            }
 
             dispatch(true);
 
-            if(DEBUG_NEXT){
-                System.out.println("After calling dispatch(true) -- At this point whole DTD is read.");
-            }
-
             //xxx: remove this hack and align this with reusing DTD components
             //currently this routine will only be executed from Stax
             if(fPropertyManager != null){
@@ -1380,10 +1365,9 @@
                             break;
                         }
                     }
-                }while(fScannerState == SCANNER_STATE_START_OF_MARKUP || fScannerState == SCANNER_STATE_TRAILING_MISC);
-                if(DEBUG_NEXT){
-                    System.out.println("State set by deciding while loop [TrailingMiscellaneous] is = " + getScannerStateName(fScannerState));
-                }
+                } while(fScannerState == SCANNER_STATE_START_OF_MARKUP ||
+                        fScannerState == SCANNER_STATE_TRAILING_MISC);
+
                 switch (fScannerState){
                     case SCANNER_STATE_PI: {
                         fContentBuffer.clear();
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/XMLEntityManager.java	Thu Dec 15 09:03:36 2016 +0100
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/XMLEntityManager.java	Thu Dec 15 13:57:04 2016 -0800
@@ -967,7 +967,7 @@
      */
 
     public void setEntityHandler(com.sun.org.apache.xerces.internal.impl.XMLEntityHandler entityHandler) {
-        fEntityHandler = (XMLEntityHandler) entityHandler;
+        fEntityHandler = entityHandler;
     } // setEntityHandler(XMLEntityHandler)
 
     //this function returns StaxXMLInputSource
@@ -1266,11 +1266,11 @@
         for (int i = size; i >= 0; i--) {
             Entity activeEntity = i == size
                     ? fCurrentEntity
-                    : (Entity)fEntityStack.elementAt(i);
+                    : fEntityStack.elementAt(i);
             if (activeEntity.name == entityName) {
                 String path = entityName;
                 for (int j = i + 1; j < size; j++) {
-                    activeEntity = (Entity)fEntityStack.elementAt(j);
+                    activeEntity = fEntityStack.elementAt(j);
                     path = path + " -> " + activeEntity.name;
                 }
                 path = path + " -> " + fCurrentEntity.name;
@@ -1704,7 +1704,7 @@
      * are recognized by this component.
      */
     public String[] getRecognizedFeatures() {
-        return (String[])(RECOGNIZED_FEATURES.clone());
+        return RECOGNIZED_FEATURES.clone();
     } // getRecognizedFeatures():String[]
 
     /**
@@ -1824,7 +1824,7 @@
      * are recognized by this component.
      */
     public String[] getRecognizedProperties() {
-        return (String[])(RECOGNIZED_PROPERTIES.clone());
+        return RECOGNIZED_PROPERTIES.clone();
     } // getRecognizedProperties():String[]
     /**
      * Returns the default state for a feature, or null if this
@@ -2952,7 +2952,7 @@
         public CharacterBuffer getBuffer(boolean external) {
             if (external) {
                 if (fExternalTop > -1) {
-                    return (CharacterBuffer)fExternalBufferPool[fExternalTop--];
+                    return fExternalBufferPool[fExternalTop--];
                 }
                 else {
                     return new CharacterBuffer(true, fExternalBufferSize);
@@ -2960,7 +2960,7 @@
             }
             else {
                 if (fInternalTop > -1) {
-                    return (CharacterBuffer)fInternalBufferPool[fInternalTop--];
+                    return fInternalBufferPool[fInternalTop--];
                 }
                 else {
                     return new CharacterBuffer(false, fInternalBufferSize);
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/XMLStreamReaderImpl.java	Thu Dec 15 09:03:36 2016 +0100
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/XMLStreamReaderImpl.java	Thu Dec 15 13:57:04 2016 -0800
@@ -25,42 +25,44 @@
 
 package com.sun.org.apache.xerces.internal.impl;
 
+import com.sun.org.apache.xerces.internal.util.NamespaceContextWrapper;
+import com.sun.org.apache.xerces.internal.util.NamespaceSupport;
+import com.sun.org.apache.xerces.internal.util.SymbolTable;
+import com.sun.org.apache.xerces.internal.util.XMLAttributesImpl;
+import com.sun.org.apache.xerces.internal.util.XMLChar;
+import com.sun.org.apache.xerces.internal.util.XMLStringBuffer;
+import com.sun.org.apache.xerces.internal.xni.XNIException;
+import com.sun.org.apache.xerces.internal.xni.parser.XMLInputSource;
 import com.sun.xml.internal.stream.Entity;
 import com.sun.xml.internal.stream.StaxErrorReporter;
 import com.sun.xml.internal.stream.XMLEntityStorage;
+import com.sun.xml.internal.stream.dtd.nonvalidating.DTDGrammar;
+import com.sun.xml.internal.stream.dtd.nonvalidating.XMLNotationDecl;
 import com.sun.xml.internal.stream.events.EntityDeclarationImpl;
 import com.sun.xml.internal.stream.events.NotationDeclarationImpl;
-import javax.xml.namespace.NamespaceContext;
-import com.sun.org.apache.xerces.internal.xni.XNIException;
-import com.sun.org.apache.xerces.internal.xni.parser.XMLInputSource;
-import javax.xml.XMLConstants;
-import javax.xml.namespace.QName;
-import javax.xml.stream.Location;
-import javax.xml.stream.events.XMLEvent;
-import com.sun.org.apache.xerces.internal.util.NamespaceContextWrapper;
-import com.sun.org.apache.xerces.internal.util.SymbolTable;
-import com.sun.xml.internal.stream.dtd.nonvalidating.XMLNotationDecl;
-import com.sun.xml.internal.stream.dtd.nonvalidating.DTDGrammar;
 import java.io.BufferedInputStream;
 import java.io.BufferedReader;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.Reader;
 import java.util.ArrayList;
-import java.util.Enumeration;
-import java.util.Iterator;
 import java.util.List;
+import java.util.Map;
+import javax.xml.XMLConstants;
+import javax.xml.namespace.NamespaceContext;
+import javax.xml.namespace.QName;
+import javax.xml.stream.Location;
 import javax.xml.stream.XMLInputFactory;
 import javax.xml.stream.XMLStreamConstants;
 import javax.xml.stream.XMLStreamException;
-import com.sun.org.apache.xerces.internal.util.XMLChar;
-import com.sun.org.apache.xerces.internal.util.XMLStringBuffer;
-import com.sun.org.apache.xerces.internal.util.NamespaceSupport;
-import com.sun.org.apache.xerces.internal.util.XMLAttributesImpl;
+import javax.xml.stream.events.EntityDeclaration;
+import javax.xml.stream.events.NotationDeclaration;
+import javax.xml.stream.events.XMLEvent;
 
-/** This class implements javax.xml.stream.XMLStreamReader. It makes use of XML*Scanner classes to
- * derive most of its functionality. If desired, Application can reuse this instance by calling
- * reset() and setInputSource().
+/**
+ * This class implements javax.xml.stream.XMLStreamReader. It makes use of
+ * XML*Scanner classes to derive most of its functionality. If desired,
+ * Application can reuse this instance by calling reset() and setInputSource().
  *
  * @author Neeraj Bajaj Sun Microsystems,Inc.
  * @author K.Venugopal Sun Microsystems,Inc.
@@ -68,49 +70,68 @@
  */
 public class XMLStreamReaderImpl implements javax.xml.stream.XMLStreamReader {
 
-    /** Property identifier: entity manager. */
-    protected static final String ENTITY_MANAGER =
-    Constants.XERCES_PROPERTY_PREFIX + Constants.ENTITY_MANAGER_PROPERTY;
+    /**
+     * Property identifier: entity manager.
+     */
+    protected static final String ENTITY_MANAGER
+            = Constants.XERCES_PROPERTY_PREFIX + Constants.ENTITY_MANAGER_PROPERTY;
 
-    /** Property identifier: Error Reporter. */
-    protected static final String ERROR_REPORTER =
-    Constants.XERCES_PROPERTY_PREFIX + Constants.ERROR_REPORTER_PROPERTY;
+    /**
+     * Property identifier: Error Reporter.
+     */
+    protected static final String ERROR_REPORTER
+            = Constants.XERCES_PROPERTY_PREFIX + Constants.ERROR_REPORTER_PROPERTY;
 
-    /** Property identifier: Symbol table. */
-    protected static final String SYMBOL_TABLE =
-    Constants.XERCES_PROPERTY_PREFIX + Constants.SYMBOL_TABLE_PROPERTY;
+    /**
+     * Property identifier: Symbol table.
+     */
+    protected static final String SYMBOL_TABLE
+            = Constants.XERCES_PROPERTY_PREFIX + Constants.SYMBOL_TABLE_PROPERTY;
 
-    protected static final String READER_IN_DEFINED_STATE =
-    Constants.READER_IN_DEFINED_STATE;
+    protected static final String READER_IN_DEFINED_STATE
+            = Constants.READER_IN_DEFINED_STATE;
 
     private SymbolTable fSymbolTable = new SymbolTable();
 
-    /** Document scanner. */
+    /**
+     * Document scanner.
+     */
     protected XMLDocumentScannerImpl fScanner = new XMLNSDocumentScannerImpl();
 
-    //make Global NamespaceContextWrapper object,  fScanner.getNamespaceContext() is dynamic object and ita value changes
-    //as per the state of the parser.
-    protected NamespaceContextWrapper fNamespaceContextWrapper = new NamespaceContextWrapper((NamespaceSupport)fScanner.getNamespaceContext()) ;
+    //make Global NamespaceContextWrapper object,  fScanner.getNamespaceContext()
+    //is dynamic object and ita value changes as per the state of the parser.
+    protected NamespaceContextWrapper fNamespaceContextWrapper =
+            new NamespaceContextWrapper((NamespaceSupport) fScanner.getNamespaceContext());
     protected XMLEntityManager fEntityManager = new XMLEntityManager();
     protected StaxErrorReporter fErrorReporter = new StaxErrorReporter();
 
-
-    /** Entity scanner, this alwasy works on last entity that was opened. */
+    /**
+     * Entity scanner, this alwasy works on last entity that was opened.
+     */
     protected XMLEntityScanner fEntityScanner = null;
 
-    /** Input Source */
+    /**
+     * Input Source
+     */
     protected XMLInputSource fInputSource = null;
-    /** Store properties*/
-    protected PropertyManager fPropertyManager = null ;
+    /**
+     * Store properties
+     */
+    protected PropertyManager fPropertyManager = null;
 
-    /** current event type */
-    private int fEventType ;
-    /** debug flag*/
-    static final boolean DEBUG = false ;
-    /** more to scan */
+    /**
+     * current event type
+     */
+    private int fEventType;
+    /**
+     * debug flag
+     */
+    static final boolean DEBUG = false;
+    /**
+     * more to scan
+     */
     private boolean fReuse = true;
-    private boolean fReaderInDefinedState = true ;
-    private boolean fBindNamespaces = true;
+    private boolean fReaderInDefinedState = true;
     private String fDTDDecl = null;
     private String versionStr = null;
 
@@ -119,24 +140,25 @@
      * @param props
      * @throws XMLStreamException
      */
-    public XMLStreamReaderImpl(InputStream inputStream, PropertyManager props) throws  XMLStreamException {
+    public XMLStreamReaderImpl(InputStream inputStream, PropertyManager props) throws XMLStreamException {
         init(props);
         //publicId, systemid, baseSystemId, inputStream, enocding
-        XMLInputSource inputSource = new XMLInputSource(null,null,null,inputStream,null);
+        XMLInputSource inputSource = new XMLInputSource(null, null, null, inputStream, null);
         //pass the input source to document scanner impl.
         setInputSource(inputSource);
     }
 
-    public XMLDocumentScannerImpl getScanner(){
+    public XMLDocumentScannerImpl getScanner() {
         System.out.println("returning scanner");
         return fScanner;
     }
+
     /**
      * @param systemid
      * @param props
      * @throws XMLStreamException
      */
-    public XMLStreamReaderImpl(String systemid, PropertyManager props) throws  XMLStreamException {
+    public XMLStreamReaderImpl(String systemid, PropertyManager props) throws XMLStreamException {
         init(props);
         //publicId, systemid, baseSystemId, inputStream, enocding
         XMLInputSource inputSource = new XMLInputSource(null, systemid, null, false);
@@ -144,17 +166,18 @@
         setInputSource(inputSource);
     }
 
-
     /**
      * @param inputStream
      * @param encoding
      * @param props
      * @throws XMLStreamException
      */
-    public XMLStreamReaderImpl(InputStream inputStream, String encoding, PropertyManager props ) throws  XMLStreamException {
+    public XMLStreamReaderImpl(InputStream inputStream, String encoding, PropertyManager props)
+            throws XMLStreamException {
         init(props);
         //publicId, systemid, baseSystemId, inputStream, enocding
-        XMLInputSource inputSource = new XMLInputSource(null,null,null, new BufferedInputStream(inputStream),encoding );
+        XMLInputSource inputSource = new XMLInputSource(null, null, null,
+                new BufferedInputStream(inputStream), encoding);
         //pass the input source to document scanner impl.
         setInputSource(inputSource);
     }
@@ -164,11 +187,13 @@
      * @param props
      * @throws XMLStreamException
      */
-    public XMLStreamReaderImpl(Reader reader, PropertyManager props) throws  XMLStreamException {
+    public XMLStreamReaderImpl(Reader reader, PropertyManager props)
+            throws XMLStreamException {
         init(props);
         //publicId, systemid, baseSystemId, inputStream, enocding
         //xxx: Using buffered reader
-        XMLInputSource inputSource = new XMLInputSource(null,null,null,new BufferedReader(reader),null);
+        XMLInputSource inputSource = new XMLInputSource(null, null, null,
+                new BufferedReader(reader), null);
         //pass the input source to document scanner impl.
         setInputSource(inputSource);
     }
@@ -178,7 +203,8 @@
      * @param props
      * @throws XMLStreamException
      */
-    public XMLStreamReaderImpl(XMLInputSource inputSource, PropertyManager props) throws  XMLStreamException {
+    public XMLStreamReaderImpl(XMLInputSource inputSource, PropertyManager props)
+            throws XMLStreamException {
         init(props);
         //pass the input source to document scanner impl.
         setInputSource(inputSource);
@@ -188,34 +214,36 @@
      * @param inputSource
      * @throws XMLStreamException
      */
-    public void setInputSource(XMLInputSource inputSource ) throws XMLStreamException {
+    public final void setInputSource(XMLInputSource inputSource) throws XMLStreamException {
         //once setInputSource() is called this instance is busy parsing the inputsource supplied
         //this instances is free for reuse if parser has reached END_DOCUMENT state or application has
         //called close()
         fReuse = false;
 
-        try{
+        try {
 
-            fScanner.setInputSource(inputSource) ;
+            fScanner.setInputSource(inputSource);
             //XMLStreamReader should be in defined state
-            if(fReaderInDefinedState){
+            if (fReaderInDefinedState) {
                 fEventType = fScanner.next();
-                if (versionStr == null)
+                if (versionStr == null) {
                     versionStr = getVersion();
+                }
 
-                if (fEventType == XMLStreamConstants.START_DOCUMENT && versionStr != null && versionStr.equals("1.1")){
+                if (fEventType == XMLStreamConstants.START_DOCUMENT && versionStr != null
+                        && versionStr.equals("1.1")) {
                     switchToXML11Scanner();
                 }
 
             }
-        }catch(java.io.IOException ex){
+        } catch (java.io.IOException ex) {
             throw new XMLStreamException(ex);
-        } catch(XNIException ex){ //Issue 56 XNIException not caught
+        } catch (XNIException ex) { //Issue 56 XNIException not caught
             throw new XMLStreamException(ex.getMessage(), getLocation(), ex.getException());
         }
     }//setInputSource
 
-    void init(PropertyManager propertyManager) throws XMLStreamException {
+    final void init(PropertyManager propertyManager) throws XMLStreamException {
         fPropertyManager = propertyManager;
         //set Stax internal properties -- Note that these instances are being created in XMLReaderImpl.
         //1.SymbolTable
@@ -223,23 +251,23 @@
         //3.XMLEntityManager
         //4. call reset()
         //1.
-        propertyManager.setProperty(SYMBOL_TABLE,  fSymbolTable ) ;
+        propertyManager.setProperty(SYMBOL_TABLE, fSymbolTable);
         //2.
-        propertyManager.setProperty(ERROR_REPORTER,  fErrorReporter ) ;
+        propertyManager.setProperty(ERROR_REPORTER, fErrorReporter);
         //3.
         propertyManager.setProperty(ENTITY_MANAGER, fEntityManager);
         //4.
         reset();
     }
 
-    /** This function tells if this instances is available for reuse.
-     * One must call reset() and setInputSource() to be able to reuse
-     * this instance.
+    /**
+     * This function tells if this instances is available for reuse. One must
+     * call reset() and setInputSource() to be able to reuse this instance.
      */
-    public boolean canReuse(){
-        if(DEBUG){
+    public boolean canReuse() {
+        if (DEBUG) {
             System.out.println("fReuse = " + fReuse);
-            System.out.println("fEventType = " + getEventTypeString(fEventType) );
+            System.out.println("fEventType = " + getEventTypeString(fEventType));
         }
         //when parsing begins, fReuse is set to false
         //fReuse is set to 'true' when application calls close()
@@ -249,9 +277,9 @@
     /**
      * Resets this instance so that this instance is ready for reuse.
      */
-    public void reset(){
+    public void reset() {
         fReuse = true;
-        fEventType = 0 ;
+        fEventType = 0;
         //reset entity manager
         fEntityManager.reset(fPropertyManager);
         //reset the scanner
@@ -259,26 +287,30 @@
         //REVISIT:this is too ugly -- we are getting XMLEntityManager and XMLEntityReader from
         //property manager, it should be only XMLEntityManager
         fDTDDecl = null;
-        fEntityScanner = (XMLEntityScanner)fEntityManager.getEntityScanner()  ;
-        //default value for this property is true. However, this should be false when using XMLEventReader... Ugh..
-        //because XMLEventReader should not have defined state.
-        fReaderInDefinedState = ((Boolean)fPropertyManager.getProperty(READER_IN_DEFINED_STATE)).booleanValue();
-        fBindNamespaces = ((Boolean)fPropertyManager.getProperty(XMLInputFactory.IS_NAMESPACE_AWARE)).booleanValue();
+        fEntityScanner = fEntityManager.getEntityScanner();
+        //default value for this property is true. However, this should be false
+        //when using XMLEventReader, because XMLEventReader should not have defined state.
+        fReaderInDefinedState = ((Boolean) fPropertyManager.getProperty(READER_IN_DEFINED_STATE));
         versionStr = null;
     }
 
-
-    /** Frees any resources associated with this Reader. This method does not close the underlying input source.
-     * @throws XMLStreamException if there are errors freeing associated resources
+    /**
+     * Frees any resources associated with this Reader. This method does not
+     * close the underlying input source.
+     *
+     * @throws XMLStreamException if there are errors freeing associated
+     * resources
      */
     public void close() throws XMLStreamException {
         //xxx: Check what this function is intended to do.
         //reset();
-        fReuse = true ;
+        fReuse = true;
     }
 
-
-    /** Returns the character encoding declared on the xml declaration Returns null if none was declared
+    /**
+     * Returns the character encoding declared on the xml declaration Returns
+     * null if none was declared
+     *
      * @return the encoding declared in the document or null
      */
     public String getCharacterEncodingScheme() {
@@ -286,7 +318,6 @@
 
     }
 
-
     /**
      * @return
      */
@@ -294,37 +325,45 @@
         return fEntityScanner.getColumnNumber();
     }//getColumnNumber
 
-    /** Return input encoding if known or null if unknown.
+    /**
+     * Return input encoding if known or null if unknown.
+     *
      * @return the encoding of this instance or null
      */
     public String getEncoding() {
         return fEntityScanner.getEncoding();
     }//getEncoding
 
-    /** Returns the current value of the parse event as a string, this returns the string value of a CHARACTERS event, returns the value of a COMMENT, the replacement value for an ENTITY_REFERENCE, the string value of a CDATA section, the string value for a SPACE event, or the String value of the internal subset of the DTD. If an ENTITY_REFERENCE has been resolved, any character data will be reported as CHARACTERS events.
+    /**
+     * Returns the current value of the parse event as a string, this returns
+     * the string value of a CHARACTERS event, returns the value of a COMMENT,
+     * the replacement value for an ENTITY_REFERENCE, the string value of a
+     * CDATA section, the string value for a SPACE event, or the String value of
+     * the internal subset of the DTD. If an ENTITY_REFERENCE has been resolved,
+     * any character data will be reported as CHARACTERS events.
+     *
      * @return the current text or null
      */
     public int getEventType() {
-        return fEventType ;
+        return fEventType;
     }//getEventType
 
     /**
      * @return
      */
     public int getLineNumber() {
-        return fEntityScanner.getLineNumber() ;
+        return fEntityScanner.getLineNumber();
     }//getLineNumber
 
     public String getLocalName() {
-        if(fEventType == XMLEvent.START_ELEMENT || fEventType == XMLEvent.END_ELEMENT){
+        if (fEventType == XMLEvent.START_ELEMENT || fEventType == XMLEvent.END_ELEMENT) {
             //xxx check whats the value of fCurrentElement
-            return fScanner.getElementQName().localpart ;
-        }
-        else if(fEventType == XMLEvent.ENTITY_REFERENCE){
+            return fScanner.getElementQName().localpart;
+        } else if (fEventType == XMLEvent.ENTITY_REFERENCE) {
             return fScanner.getEntityName();
         }
-        throw new IllegalStateException("Method getLocalName() cannot be called for " +
-            getEventTypeString(fEventType) + " event.");
+        throw new IllegalStateException("Method getLocalName() cannot be called for "
+                + getEventTypeString(fEventType) + " event.");
     }//getLocalName()
 
     /**
@@ -332,115 +371,119 @@
      */
     public String getNamespaceURI() {
         //doesn't take care of Attribute as separte event
-        if(fEventType == XMLEvent.START_ELEMENT || fEventType == XMLEvent.END_ELEMENT){
-            return fScanner.getElementQName().uri ;
+        if (fEventType == XMLEvent.START_ELEMENT || fEventType == XMLEvent.END_ELEMENT) {
+            return fScanner.getElementQName().uri;
         }
-        return null ;
+        return null;
     }//getNamespaceURI
 
-    /** Get the data section of a processing instruction
+    /**
+     * Get the data section of a processing instruction
+     *
      * @return the data or null
      */
-
     public String getPIData() {
-        if( fEventType == XMLEvent.PROCESSING_INSTRUCTION){
+        if (fEventType == XMLEvent.PROCESSING_INSTRUCTION) {
             return fScanner.getPIData().toString();
+        } else {
+            throw new java.lang.IllegalStateException("Current state of the parser is " + getEventTypeString(fEventType)
+                    + " But Expected state is " + XMLEvent.PROCESSING_INSTRUCTION);
         }
-        else throw new java.lang.IllegalStateException("Current state of the parser is " + getEventTypeString(fEventType) +
-        " But Expected state is " + XMLEvent.PROCESSING_INSTRUCTION  ) ;
     }//getPIData
 
-
-    /** Get the target of a processing instruction
+    /**
+     * Get the target of a processing instruction
+     *
      * @return the target or null
      */
     public String getPITarget() {
-        if( fEventType == XMLEvent.PROCESSING_INSTRUCTION){
+        if (fEventType == XMLEvent.PROCESSING_INSTRUCTION) {
             return fScanner.getPITarget();
+        } else {
+            throw new java.lang.IllegalStateException("Current state of the parser is " + getEventTypeString(fEventType)
+                    + " But Expected state is " + XMLEvent.PROCESSING_INSTRUCTION);
         }
-        else throw new java.lang.IllegalStateException("Current state of the parser is " + getEventTypeString(fEventType) +
-        " But Expected state is " + XMLEvent.PROCESSING_INSTRUCTION  ) ;
 
     }//getPITarget
 
-
     /**
-    * @return the prefix of the current event, or null if the event does
-    * not have a prefix. For START_ELEMENT and END_ELEMENT, return
-    * XMLConstants.DEFAULT_NS_PREFIX when no prefix is available.
-    */
+     * @return the prefix of the current event, or null if the event does not
+     * have a prefix. For START_ELEMENT and END_ELEMENT, return
+     * XMLConstants.DEFAULT_NS_PREFIX when no prefix is available.
+     */
     public String getPrefix() {
-        if(fEventType == XMLEvent.START_ELEMENT || fEventType == XMLEvent.END_ELEMENT){
+        if (fEventType == XMLEvent.START_ELEMENT || fEventType == XMLEvent.END_ELEMENT) {
             String prefix = fScanner.getElementQName().prefix;
             return prefix == null ? XMLConstants.DEFAULT_NS_PREFIX : prefix;
         }
-        return null ;
+        return null;
     }//getPrefix()
 
-
-
     /**
      * @return
      */
     public char[] getTextCharacters() {
-        if( fEventType == XMLEvent.CHARACTERS || fEventType == XMLEvent.COMMENT
-                 || fEventType == XMLEvent.CDATA || fEventType == XMLEvent.SPACE){
-             return fScanner.getCharacterData().ch;
-         } else{
-             throw new IllegalStateException("Current state = " + getEventTypeString(fEventType)
-             + " is not among the states " + getEventTypeString(XMLEvent.CHARACTERS) + " , "
-                     + getEventTypeString(XMLEvent.COMMENT) + " , " + getEventTypeString(XMLEvent.CDATA)
-                     + " , " + getEventTypeString(XMLEvent.SPACE) +" valid for getTextCharacters() " ) ;
-         }
+        if (fEventType == XMLEvent.CHARACTERS || fEventType == XMLEvent.COMMENT
+                || fEventType == XMLEvent.CDATA || fEventType == XMLEvent.SPACE) {
+            return fScanner.getCharacterData().ch;
+        } else {
+            throw new IllegalStateException("Current state = " + getEventTypeString(fEventType)
+                    + " is not among the states " + getEventTypeString(XMLEvent.CHARACTERS) + " , "
+                    + getEventTypeString(XMLEvent.COMMENT) + " , " + getEventTypeString(XMLEvent.CDATA)
+                    + " , " + getEventTypeString(XMLEvent.SPACE) + " valid for getTextCharacters() ");
+        }
     }
 
     /**
      * @return
      */
     public int getTextLength() {
-        if( fEventType == XMLEvent.CHARACTERS || fEventType == XMLEvent.COMMENT
-                 || fEventType == XMLEvent.CDATA || fEventType == XMLEvent.SPACE){
-             return fScanner.getCharacterData().length;
-         } else{
-             throw new IllegalStateException("Current state = " + getEventTypeString(fEventType)
-             + " is not among the states " + getEventTypeString(XMLEvent.CHARACTERS) + " , "
-                     + getEventTypeString(XMLEvent.COMMENT) + " , " + getEventTypeString(XMLEvent.CDATA)
-                     + " , " + getEventTypeString(XMLEvent.SPACE) +" valid for getTextLength() " ) ;
-         }
+        if (fEventType == XMLEvent.CHARACTERS || fEventType == XMLEvent.COMMENT
+                || fEventType == XMLEvent.CDATA || fEventType == XMLEvent.SPACE) {
+            return fScanner.getCharacterData().length;
+        } else {
+            throw new IllegalStateException("Current state = " + getEventTypeString(fEventType)
+                    + " is not among the states " + getEventTypeString(XMLEvent.CHARACTERS) + " , "
+                    + getEventTypeString(XMLEvent.COMMENT) + " , " + getEventTypeString(XMLEvent.CDATA)
+                    + " , " + getEventTypeString(XMLEvent.SPACE) + " valid for getTextLength() ");
+        }
 
-   }
+    }
 
     /**
      * @return
      */
     public int getTextStart() {
-        if( fEventType == XMLEvent.CHARACTERS || fEventType == XMLEvent.COMMENT || fEventType == XMLEvent.CDATA || fEventType == XMLEvent.SPACE){
-             return  fScanner.getCharacterData().offset;
-         } else{
-             throw new IllegalStateException("Current state = " + getEventTypeString(fEventType)
-             + " is not among the states " + getEventTypeString(XMLEvent.CHARACTERS) + " , "
-                     + getEventTypeString(XMLEvent.COMMENT) + " , " + getEventTypeString(XMLEvent.CDATA)
-                     + " , " + getEventTypeString(XMLEvent.SPACE) +" valid for getTextStart() " ) ;
-         }
+        if (fEventType == XMLEvent.CHARACTERS || fEventType == XMLEvent.COMMENT
+                || fEventType == XMLEvent.CDATA || fEventType == XMLEvent.SPACE) {
+            return fScanner.getCharacterData().offset;
+        } else {
+            throw new IllegalStateException("Current state = " + getEventTypeString(fEventType)
+                    + " is not among the states " + getEventTypeString(XMLEvent.CHARACTERS) + " , "
+                    + getEventTypeString(XMLEvent.COMMENT) + " , " + getEventTypeString(XMLEvent.CDATA)
+                    + " , " + getEventTypeString(XMLEvent.SPACE) + " valid for getTextStart() ");
+        }
     }
 
     /**
      * @return
      */
     public String getValue() {
-        if(fEventType == XMLEvent.PROCESSING_INSTRUCTION){
+        if (fEventType == XMLEvent.PROCESSING_INSTRUCTION) {
             return fScanner.getPIData().toString();
-        } else if(fEventType == XMLEvent.COMMENT){
+        } else if (fEventType == XMLEvent.COMMENT) {
             return fScanner.getComment();
-        } else if(fEventType == XMLEvent.START_ELEMENT || fEventType == XMLEvent.END_ELEMENT){
-            return fScanner.getElementQName().localpart ;
-        } else if(fEventType == XMLEvent.CHARACTERS){
+        } else if (fEventType == XMLEvent.START_ELEMENT || fEventType == XMLEvent.END_ELEMENT) {
+            return fScanner.getElementQName().localpart;
+        } else if (fEventType == XMLEvent.CHARACTERS) {
             return fScanner.getCharacterData().toString();
         }
         return null;
     }//getValue()
 
-    /** Get the XML language version of the current document being parsed */
+    /**
+     * Get the XML language version of the current document being parsed
+     */
     public String getVersion() {
         //apply SAP's patch: the default version in the scanner was set to 1.0 because of DOM and SAX
         //so this patch is a workaround of the difference between StAX and DOM
@@ -455,14 +498,16 @@
      * @return
      */
     public boolean hasAttributes() {
-        return fScanner.getAttributeIterator().getLength() > 0 ? true : false ;
+        return fScanner.getAttributeIterator().getLength() > 0 ? true : false;
     }
 
-    /** this Funtion returns true if the current event has name */
+    /**
+     * this Funtion returns true if the current event has name
+     */
     public boolean hasName() {
-        if(fEventType == XMLEvent.START_ELEMENT || fEventType == XMLEvent.END_ELEMENT) {
+        if (fEventType == XMLEvent.START_ELEMENT || fEventType == XMLEvent.END_ELEMENT) {
             return true;
-        }  else {
+        } else {
             return false;
         }
     }//hasName()
@@ -473,7 +518,9 @@
      */
     public boolean hasNext() throws XMLStreamException {
         //the scanner returns -1 when it detects a broken stream
-        if (fEventType == -1) return false;
+        if (fEventType == -1) {
+            return false;
+        }
         //we can check in scanners if the scanner state is not set to
         //terminating, we still have more events.
         return fEventType != XMLEvent.END_DOCUMENT;
@@ -483,9 +530,9 @@
      * @return
      */
     public boolean hasValue() {
-        if(fEventType == XMLEvent.START_ELEMENT || fEventType == XMLEvent.END_ELEMENT
-        || fEventType == XMLEvent.ENTITY_REFERENCE || fEventType == XMLEvent.PROCESSING_INSTRUCTION
-        || fEventType == XMLEvent.COMMENT || fEventType == XMLEvent.CHARACTERS) {
+        if (fEventType == XMLEvent.START_ELEMENT || fEventType == XMLEvent.END_ELEMENT
+                || fEventType == XMLEvent.ENTITY_REFERENCE || fEventType == XMLEvent.PROCESSING_INSTRUCTION
+                || fEventType == XMLEvent.COMMENT || fEventType == XMLEvent.CHARACTERS) {
             return true;
         } else {
             return false;
@@ -515,18 +562,19 @@
     }
 
     /**
-     *  Returns true if the cursor points to a character data event that consists of all whitespace
-     *  Application calling this method needs to cache the value and avoid calling this method again
-     *  for the same event.
+     * Returns true if the cursor points to a character data event that consists
+     * of all whitespace Application calling this method needs to cache the
+     * value and avoid calling this method again for the same event.
+     *
      * @return
      */
     public boolean isWhiteSpace() {
-        if(isCharacters() || (fEventType == XMLStreamConstants.CDATA)){
-            char [] ch = this.getTextCharacters();
+        if (isCharacters() || (fEventType == XMLStreamConstants.CDATA)) {
+            char[] ch = this.getTextCharacters();
             final int start = this.getTextStart();
             final int end = start + this.getTextLength();
-            for (int i = start; i < end; i++){
-                if(!XMLChar.isSpace(ch[i])){
+            for (int i = start; i < end; i++) {
+                if (!XMLChar.isSpace(ch[i])) {
                     return false;
                 }
             }
@@ -535,18 +583,18 @@
         return false;
     }
 
-
-
     /**
      * @throws XMLStreamException
      * @return
      */
     public int next() throws XMLStreamException {
-        if( !hasNext() ) {
+        if (!hasNext()) {
             if (fEventType != -1) {
-                throw new java.util.NoSuchElementException( "END_DOCUMENT reached: no more elements on the stream." );
+                throw new java.util.NoSuchElementException(
+                        "END_DOCUMENT reached: no more elements on the stream.");
             } else {
-                throw new XMLStreamException( "Error processing input source. The input stream is not complete." );
+                throw new XMLStreamException(
+                        "Error processing input source. The input stream is not complete.");
             }
         }
         try {
@@ -566,14 +614,14 @@
         } catch (IOException ex) {
             // if this error occured trying to resolve the external DTD subset
             // and IS_VALIDATING == false, then this is not an XML error
-            if (fScanner.fScannerState == fScanner.SCANNER_STATE_DTD_EXTERNAL) {
+            if (fScanner.fScannerState == XMLDocumentScannerImpl.SCANNER_STATE_DTD_EXTERNAL) {
                 Boolean isValidating = (Boolean) fPropertyManager.getProperty(
                         XMLInputFactory.IS_VALIDATING);
                 if (isValidating != null
                         && !isValidating.booleanValue()) {
                     // ignore the error, set scanner to known state
                     fEventType = XMLEvent.DTD;
-                    fScanner.setScannerState(fScanner.SCANNER_STATE_PROLOG);
+                    fScanner.setScannerState(XMLDocumentScannerImpl.SCANNER_STATE_PROLOG);
                     fScanner.setDriver(fScanner.fPrologDriver);
                     if (fDTDDecl == null
                             || fDTDDecl.length() == 0) {
@@ -597,10 +645,11 @@
         }
     } //next()
 
-    private void switchToXML11Scanner() throws IOException{
+    private void switchToXML11Scanner() throws IOException {
 
         int oldEntityDepth = fScanner.fEntityDepth;
-        com.sun.org.apache.xerces.internal.xni.NamespaceContext oldNamespaceContext = fScanner.fNamespaceContext;
+        com.sun.org.apache.xerces.internal.xni.NamespaceContext oldNamespaceContext
+                = fScanner.fNamespaceContext;
 
         fScanner = new XML11NSDocumentScannerImpl();
 
@@ -617,10 +666,8 @@
         fEventType = fScanner.next();
     }
 
-
-
     final static String getEventTypeString(int eventType) {
-        switch (eventType){
+        switch (eventType) {
             case XMLEvent.START_ELEMENT:
                 return "START_ELEMENT";
             case XMLEvent.END_ELEMENT:
@@ -649,10 +696,11 @@
         return "UNKNOWN_EVENT_TYPE, " + String.valueOf(eventType);
     }
 
-    /** Returns the count of attributes on this START_ELEMENT,
-     * this method is only valid on a START_ELEMENT or ATTRIBUTE.  This
-     * count excludes namespace definitions.  Attribute indices are
-     * zero-based.
+    /**
+     * Returns the count of attributes on this START_ELEMENT, this method is
+     * only valid on a START_ELEMENT or ATTRIBUTE. This count excludes namespace
+     * definitions. Attribute indices are zero-based.
+     *
      * @return returns the number of attributes
      * @throws IllegalStateException if this is not a START_ELEMENT or ATTRIBUTE
      */
@@ -661,31 +709,32 @@
         //does length includes namespace declarations ?
 
         //State should be either START_ELEMENT or ATTRIBUTE
-        if( fEventType == XMLEvent.START_ELEMENT || fEventType == XMLEvent.ATTRIBUTE) {
-            return fScanner.getAttributeIterator().getLength() ;
-        } else{
-            throw new java.lang.IllegalStateException( "Current state is not among the states "
-                     + getEventTypeString(XMLEvent.START_ELEMENT) + " , "
-                     + getEventTypeString(XMLEvent.ATTRIBUTE)
-                     + "valid for getAttributeCount()") ;
+        if (fEventType == XMLEvent.START_ELEMENT || fEventType == XMLEvent.ATTRIBUTE) {
+            return fScanner.getAttributeIterator().getLength();
+        } else {
+            throw new java.lang.IllegalStateException("Current state is not among the states "
+                    + getEventTypeString(XMLEvent.START_ELEMENT) + " , "
+                    + getEventTypeString(XMLEvent.ATTRIBUTE)
+                    + "valid for getAttributeCount()");
         }
     }//getAttributeCount
 
-    /** Returns the localName of the attribute at the provided
-     * index
+    /**
+     * Returns the localName of the attribute at the provided index
+     *
      * @param index the position of the attribute
      * @return the localName of the attribute
      * @throws IllegalStateException if this is not a START_ELEMENT or ATTRIBUTE
      */
     public QName getAttributeName(int index) {
         //State should be either START_ELEMENT or ATTRIBUTE
-        if( fEventType == XMLEvent.START_ELEMENT || fEventType == XMLEvent.ATTRIBUTE) {
-            return convertXNIQNametoJavaxQName(fScanner.getAttributeIterator().getQualifiedName(index)) ;
-        } else{
+        if (fEventType == XMLEvent.START_ELEMENT || fEventType == XMLEvent.ATTRIBUTE) {
+            return convertXNIQNametoJavaxQName(fScanner.getAttributeIterator().getQualifiedName(index));
+        } else {
             throw new java.lang.IllegalStateException("Current state is not among the states "
-                     + getEventTypeString(XMLEvent.START_ELEMENT) + " , "
-                     + getEventTypeString(XMLEvent.ATTRIBUTE)
-                     + "valid for getAttributeName()") ;
+                    + getEventTypeString(XMLEvent.START_ELEMENT) + " , "
+                    + getEventTypeString(XMLEvent.ATTRIBUTE)
+                    + "valid for getAttributeName()");
         }
     }//getAttributeName
 
@@ -695,51 +744,54 @@
      */
     public String getAttributeLocalName(int index) {
         //State should be either START_ELEMENT or ATTRIBUTE
-        if( fEventType == XMLEvent.START_ELEMENT || fEventType == XMLEvent.ATTRIBUTE) {
-            return fScanner.getAttributeIterator().getLocalName(index) ;
-        } else{
-            throw new java.lang.IllegalStateException() ;
+        if (fEventType == XMLEvent.START_ELEMENT || fEventType == XMLEvent.ATTRIBUTE) {
+            return fScanner.getAttributeIterator().getLocalName(index);
+        } else {
+            throw new java.lang.IllegalStateException();
         }
     }//getAttributeName
 
-    /** Returns the namespace of the attribute at the provided
-     * index
+    /**
+     * Returns the namespace of the attribute at the provided index
+     *
      * @param index the position of the attribute
      * @return the namespace URI (can be null)
      * @throws IllegalStateException if this is not a START_ELEMENT or ATTRIBUTE
      */
     public String getAttributeNamespace(int index) {
         //State should be either START_ELEMENT or ATTRIBUTE
-        if( fEventType == XMLEvent.START_ELEMENT || fEventType == XMLEvent.ATTRIBUTE) {
+        if (fEventType == XMLEvent.START_ELEMENT || fEventType == XMLEvent.ATTRIBUTE) {
             return fScanner.getAttributeIterator().getURI(index);
-        } else{
+        } else {
             throw new java.lang.IllegalStateException("Current state is not among the states "
-                     + getEventTypeString(XMLEvent.START_ELEMENT) + " , "
-                     + getEventTypeString(XMLEvent.ATTRIBUTE)
-                     + "valid for getAttributeNamespace()") ;
+                    + getEventTypeString(XMLEvent.START_ELEMENT) + " , "
+                    + getEventTypeString(XMLEvent.ATTRIBUTE)
+                    + "valid for getAttributeNamespace()");
         }
 
     }//getAttributeNamespace
 
-    /** Returns the prefix of this attribute at the
-     * provided index
+    /**
+     * Returns the prefix of this attribute at the provided index
+     *
      * @param index the position of the attribute
      * @return the prefix of the attribute
      * @throws IllegalStateException if this is not a START_ELEMENT or ATTRIBUTE
      */
     public String getAttributePrefix(int index) {
         //State should be either START_ELEMENT or ATTRIBUTE
-        if( fEventType == XMLEvent.START_ELEMENT || fEventType == XMLEvent.ATTRIBUTE) {
+        if (fEventType == XMLEvent.START_ELEMENT || fEventType == XMLEvent.ATTRIBUTE) {
             return fScanner.getAttributeIterator().getPrefix(index);
-        } else{
+        } else {
             throw new java.lang.IllegalStateException("Current state is not among the states "
-                     + getEventTypeString(XMLEvent.START_ELEMENT) + " , "
-                     + getEventTypeString(XMLEvent.ATTRIBUTE)
-                     + "valid for getAttributePrefix()") ;
+                    + getEventTypeString(XMLEvent.START_ELEMENT) + " , "
+                    + getEventTypeString(XMLEvent.ATTRIBUTE)
+                    + "valid for getAttributePrefix()");
         }
     }//getAttributePrefix
 
-    /** Returns the qname of the attribute at the provided index
+    /**
+     * Returns the qname of the attribute at the provided index
      *
      * @param index the position of the attribute
      * @return the QName of the attribute
@@ -747,53 +799,55 @@
      */
     public javax.xml.namespace.QName getAttributeQName(int index) {
         //State should be either START_ELEMENT or ATTRIBUTE
-        if( fEventType == XMLEvent.START_ELEMENT || fEventType == XMLEvent.ATTRIBUTE) {
+        if (fEventType == XMLEvent.START_ELEMENT || fEventType == XMLEvent.ATTRIBUTE) {
             // create new object at runtime..
-            String localName = fScanner.getAttributeIterator().getLocalName(index) ;
-            String uri = fScanner.getAttributeIterator().getURI(index) ;
-            return new javax.xml.namespace.QName(uri, localName) ;
-        } else{
+            String localName = fScanner.getAttributeIterator().getLocalName(index);
+            String uri = fScanner.getAttributeIterator().getURI(index);
+            return new javax.xml.namespace.QName(uri, localName);
+        } else {
             throw new java.lang.IllegalStateException("Current state is not among the states "
-                     + getEventTypeString(XMLEvent.START_ELEMENT) + " , "
-                     + getEventTypeString(XMLEvent.ATTRIBUTE)
-                     + "valid for getAttributeQName()") ;
+                    + getEventTypeString(XMLEvent.START_ELEMENT) + " , "
+                    + getEventTypeString(XMLEvent.ATTRIBUTE)
+                    + "valid for getAttributeQName()");
         }
     }//getAttributeQName
 
-    /** Returns the XML type of the attribute at the provided
-     * index
+    /**
+     * Returns the XML type of the attribute at the provided index
+     *
      * @param index the position of the attribute
      * @return the XML type of the attribute
      * @throws IllegalStateException if this is not a START_ELEMENT or ATTRIBUTE
      */
     public String getAttributeType(int index) {
         //State should be either START_ELEMENT or ATTRIBUTE
-        if( fEventType == XMLEvent.START_ELEMENT || fEventType == XMLEvent.ATTRIBUTE) {
-            return fScanner.getAttributeIterator().getType(index) ;
-        } else{
+        if (fEventType == XMLEvent.START_ELEMENT || fEventType == XMLEvent.ATTRIBUTE) {
+            return fScanner.getAttributeIterator().getType(index);
+        } else {
             throw new java.lang.IllegalStateException("Current state is not among the states "
-                     + getEventTypeString(XMLEvent.START_ELEMENT) + " , "
-                     + getEventTypeString(XMLEvent.ATTRIBUTE)
-                     + "valid for getAttributeType()") ;
+                    + getEventTypeString(XMLEvent.START_ELEMENT) + " , "
+                    + getEventTypeString(XMLEvent.ATTRIBUTE)
+                    + "valid for getAttributeType()");
         }
 
     }//getAttributeType
 
-    /** Returns the value of the attribute at the
-     * index
+    /**
+     * Returns the value of the attribute at the index
+     *
      * @param index the position of the attribute
      * @return the attribute value
      * @throws IllegalStateException if this is not a START_ELEMENT or ATTRIBUTE
      */
     public String getAttributeValue(int index) {
         //State should be either START_ELEMENT or ATTRIBUTE
-        if( fEventType == XMLEvent.START_ELEMENT || fEventType == XMLEvent.ATTRIBUTE) {
-            return fScanner.getAttributeIterator().getValue(index) ;
-        } else{
+        if (fEventType == XMLEvent.START_ELEMENT || fEventType == XMLEvent.ATTRIBUTE) {
+            return fScanner.getAttributeIterator().getValue(index);
+        } else {
             throw new java.lang.IllegalStateException("Current state is not among the states "
-                     + getEventTypeString(XMLEvent.START_ELEMENT) + " , "
-                     + getEventTypeString(XMLEvent.ATTRIBUTE)
-                     + "valid for getAttributeValue()") ;
+                    + getEventTypeString(XMLEvent.START_ELEMENT) + " , "
+                    + getEventTypeString(XMLEvent.ATTRIBUTE)
+                    + "valid for getAttributeValue()");
         }
 
     }//getAttributeValue
@@ -805,67 +859,69 @@
      */
     public String getAttributeValue(String namespaceURI, String localName) {
         //State should be either START_ELEMENT or ATTRIBUTE
-        if( fEventType == XMLEvent.START_ELEMENT || fEventType == XMLEvent.ATTRIBUTE) {
+        if (fEventType == XMLEvent.START_ELEMENT || fEventType == XMLEvent.ATTRIBUTE) {
             XMLAttributesImpl attributes = fScanner.getAttributeIterator();
             if (namespaceURI == null) { //sjsxp issue 70
-                return attributes.getValue(attributes.getIndexByLocalName(localName)) ;
+                return attributes.getValue(attributes.getIndexByLocalName(localName));
             } else {
                 return fScanner.getAttributeIterator().getValue(
-                        namespaceURI.length() == 0 ? null : namespaceURI, localName) ;
+                        namespaceURI.length() == 0 ? null : namespaceURI, localName);
             }
 
-        } else{
+        } else {
             throw new java.lang.IllegalStateException("Current state is not among the states "
-                     + getEventTypeString(XMLEvent.START_ELEMENT) + " , "
-                     + getEventTypeString(XMLEvent.ATTRIBUTE)
-                     + "valid for getAttributeValue()") ;
+                    + getEventTypeString(XMLEvent.START_ELEMENT) + " , "
+                    + getEventTypeString(XMLEvent.ATTRIBUTE)
+                    + "valid for getAttributeValue()");
         }
 
     }
 
-    /** Reads the content of a text-only element. Precondition:
-     * the current event is START_ELEMENT. Postcondition:
-     * The current event is the corresponding END_ELEMENT.
-     * @throws XMLStreamException if the current event is not a START_ELEMENT or if
-     * a non text element is encountered
+    /**
+     * Reads the content of a text-only element. Precondition: the current event
+     * is START_ELEMENT. Postcondition: The current event is the corresponding
+     * END_ELEMENT.
+     *
+     * @throws XMLStreamException if the current event is not a START_ELEMENT or
+     * if a non text element is encountered
      */
     public String getElementText() throws XMLStreamException {
 
-        if(getEventType() != XMLStreamConstants.START_ELEMENT) {
+        if (getEventType() != XMLStreamConstants.START_ELEMENT) {
             throw new XMLStreamException(
-            "parser must be on START_ELEMENT to read next text", getLocation());
+                    "parser must be on START_ELEMENT to read next text", getLocation());
         }
         int eventType = next();
-        StringBuffer content = new StringBuffer();
-        while(eventType != XMLStreamConstants.END_ELEMENT ) {
-            if(eventType == XMLStreamConstants.CHARACTERS
-            || eventType == XMLStreamConstants.CDATA
-            || eventType == XMLStreamConstants.SPACE
-            || eventType == XMLStreamConstants.ENTITY_REFERENCE) {
+        StringBuilder content = new StringBuilder();
+        while (eventType != XMLStreamConstants.END_ELEMENT) {
+            if (eventType == XMLStreamConstants.CHARACTERS
+                    || eventType == XMLStreamConstants.CDATA
+                    || eventType == XMLStreamConstants.SPACE
+                    || eventType == XMLStreamConstants.ENTITY_REFERENCE) {
                 content.append(getText());
-            } else if(eventType == XMLStreamConstants.PROCESSING_INSTRUCTION
-            || eventType == XMLStreamConstants.COMMENT) {
+            } else if (eventType == XMLStreamConstants.PROCESSING_INSTRUCTION
+                    || eventType == XMLStreamConstants.COMMENT) {
                 // skipping
-            } else if(eventType == XMLStreamConstants.END_DOCUMENT) {
-                throw new XMLStreamException("unexpected end of document when reading element text content");
-            } else if(eventType == XMLStreamConstants.START_ELEMENT) {
+            } else if (eventType == XMLStreamConstants.END_DOCUMENT) {
                 throw new XMLStreamException(
-                "elementGetText() function expects text only elment but START_ELEMENT was encountered.", getLocation());
+                        "unexpected end of document when reading element text content");
+            } else if (eventType == XMLStreamConstants.START_ELEMENT) {
+                throw new XMLStreamException("elementGetText() function expects text "
+                        + "only elment but START_ELEMENT was encountered.", getLocation());
             } else {
                 throw new XMLStreamException(
-                "Unexpected event type "+ eventType, getLocation());
+                        "Unexpected event type " + eventType, getLocation());
             }
             eventType = next();
         }
         return content.toString();
     }
 
-    /** Return the current location of the processor.
-     * If the Location is unknown the processor should return
-     * an implementation of Location that returns -1 for the
-     * location and null for the publicId and systemId.
-     * The location information is only valid until next() is
-     * called.
+    /**
+     * Return the current location of the processor. If the Location is unknown
+     * the processor should return an implementation of Location that returns -1
+     * for the location and null for the publicId and systemId. The location
+     * information is only valid until next() is called.
      */
     public Location getLocation() {
         return new Location() {
@@ -874,11 +930,12 @@
             int _offset = fEntityScanner.getCharacterOffset();
             int _columnNumber = fEntityScanner.getColumnNumber();
             int _lineNumber = fEntityScanner.getLineNumber();
-            public String getLocationURI(){
+
+            public String getLocationURI() {
                 return _systemId;
             }
 
-            public int getCharacterOffset(){
+            public int getCharacterOffset() {
                 return _offset;
             }
 
@@ -886,224 +943,256 @@
                 return _columnNumber;
             }
 
-            public int getLineNumber(){
+            public int getLineNumber() {
                 return _lineNumber;
             }
 
-            public String getPublicId(){
+            public String getPublicId() {
                 return _publicId;
             }
 
-            public String getSystemId(){
+            public String getSystemId() {
                 return _systemId;
             }
 
-            public String toString(){
-                StringBuffer sbuffer = new StringBuffer() ;
+            public String toString() {
+                StringBuilder sbuffer = new StringBuilder();
                 sbuffer.append("Line number = " + getLineNumber());
-                sbuffer.append("\n") ;
+                sbuffer.append("\n");
                 sbuffer.append("Column number = " + getColumnNumber());
-                sbuffer.append("\n") ;
+                sbuffer.append("\n");
                 sbuffer.append("System Id = " + getSystemId());
-                sbuffer.append("\n") ;
+                sbuffer.append("\n");
                 sbuffer.append("Public Id = " + getPublicId());
-                sbuffer.append("\n") ;
+                sbuffer.append("\n");
                 sbuffer.append("Location Uri= " + getLocationURI());
-                sbuffer.append("\n") ;
+                sbuffer.append("\n");
                 sbuffer.append("CharacterOffset = " + getCharacterOffset());
-                sbuffer.append("\n") ;
+                sbuffer.append("\n");
                 return sbuffer.toString();
             }
-        } ;
+        };
 
     }
 
-    /** Returns a QName for the current START_ELEMENT or END_ELEMENT event
+    /**
+     * Returns a QName for the current START_ELEMENT or END_ELEMENT event
+     *
      * @return the QName for the current START_ELEMENT or END_ELEMENT event
      */
     public javax.xml.namespace.QName getName() {
-        if(fEventType == XMLEvent.START_ELEMENT || fEventType == XMLEvent.END_ELEMENT)
+        if (fEventType == XMLEvent.START_ELEMENT || fEventType == XMLEvent.END_ELEMENT) {
             return convertXNIQNametoJavaxQName(fScanner.getElementQName());
-        else
-            throw new java.lang.IllegalStateException("Illegal to call getName() "+
-            "when event type is "+ getEventTypeString(fEventType) + "."
-                     + " Valid states are " + getEventTypeString(XMLEvent.START_ELEMENT) + ", "
-                     + getEventTypeString(XMLEvent.END_ELEMENT));
+        } else {
+            throw new java.lang.IllegalStateException("Illegal to call getName() "
+                    + "when event type is " + getEventTypeString(fEventType) + "."
+                    + " Valid states are " + getEventTypeString(XMLEvent.START_ELEMENT) + ", "
+                    + getEventTypeString(XMLEvent.END_ELEMENT));
+        }
     }
 
-    /** Returns a read only namespace context for the current
-     * position.  The context is transient and only valid until
-     * a call to next() changes the state of the reader.
+    /**
+     * Returns a read only namespace context for the current position. The
+     * context is transient and only valid until a call to next() changes the
+     * state of the reader.
+     *
      * @return return a namespace context
      */
     public NamespaceContext getNamespaceContext() {
-        return fNamespaceContextWrapper ;
+        return fNamespaceContextWrapper;
     }
 
-    /** Returns the count of namespaces declared on this START_ELEMENT or END_ELEMENT,
-     * this method is only valid on a START_ELEMENT, END_ELEMENT or NAMESPACE. On
-     * an END_ELEMENT the count is of the namespaces that are about to go
-     * out of scope.  This is the equivalent of the information reported
-     * by SAX callback for an end element event.
-     * @return returns the number of namespace declarations on this specific element
-     * @throws IllegalStateException if this is not a START_ELEMENT, END_ELEMENT or NAMESPACE
+    /**
+     * Returns the count of namespaces declared on this START_ELEMENT or
+     * END_ELEMENT, this method is only valid on a START_ELEMENT, END_ELEMENT or
+     * NAMESPACE. On an END_ELEMENT the count is of the namespaces that are
+     * about to go out of scope. This is the equivalent of the information
+     * reported by SAX callback for an end element event.
+     *
+     * @return returns the number of namespace declarations on this specific
+     * element
+     * @throws IllegalStateException if this is not a START_ELEMENT, END_ELEMENT
+     * or NAMESPACE
      */
     public int getNamespaceCount() {
         //namespaceContext is dynamic object.
         //REVISIT: check if it specifies all conditions mentioned in the javadoc
-        if(fEventType == XMLEvent.START_ELEMENT || fEventType == XMLEvent.END_ELEMENT || fEventType == XMLEvent.NAMESPACE){
-            return fScanner.getNamespaceContext().getDeclaredPrefixCount() ;
-        } else{
+        if (fEventType == XMLEvent.START_ELEMENT || fEventType == XMLEvent.END_ELEMENT
+                || fEventType == XMLEvent.NAMESPACE) {
+            return fScanner.getNamespaceContext().getDeclaredPrefixCount();
+        } else {
             throw new IllegalStateException("Current event state is " + getEventTypeString(fEventType)
-             + " is not among the states " + getEventTypeString(XMLEvent.START_ELEMENT)
-             + ", " + getEventTypeString(XMLEvent.END_ELEMENT) + ", "
-                     + getEventTypeString(XMLEvent.NAMESPACE)
-             + " valid for getNamespaceCount()." );
+                    + " is not among the states " + getEventTypeString(XMLEvent.START_ELEMENT)
+                    + ", " + getEventTypeString(XMLEvent.END_ELEMENT) + ", "
+                    + getEventTypeString(XMLEvent.NAMESPACE)
+                    + " valid for getNamespaceCount().");
         }
     }
 
-    /** Returns the prefix for the namespace declared at the
-     * index.  Returns null if this is the default namespace
-     * declaration
+    /**
+     * Returns the prefix for the namespace declared at the index. Returns null
+     * if this is the default namespace declaration
      *
      * @param index the position of the namespace declaration
      * @return returns the namespace prefix
-     * @throws IllegalStateException if this is not a START_ELEMENT, END_ELEMENT or NAMESPACE
+     * @throws IllegalStateException if this is not a START_ELEMENT, END_ELEMENT
+     * or NAMESPACE
      */
     public String getNamespacePrefix(int index) {
-        if(fEventType == XMLEvent.START_ELEMENT || fEventType == XMLEvent.END_ELEMENT || fEventType == XMLEvent.NAMESPACE){
+        if (fEventType == XMLEvent.START_ELEMENT || fEventType == XMLEvent.END_ELEMENT
+                || fEventType == XMLEvent.NAMESPACE) {
             //namespaceContext is dynamic object.
-            String prefix = fScanner.getNamespaceContext().getDeclaredPrefixAt(index) ;
-            return prefix.equals("") ? null : prefix ;
-        }
-        else{
+            String prefix = fScanner.getNamespaceContext().getDeclaredPrefixAt(index);
+            return prefix.equals("") ? null : prefix;
+        } else {
             throw new IllegalStateException("Current state " + getEventTypeString(fEventType)
-             + " is not among the states " + getEventTypeString(XMLEvent.START_ELEMENT)
-             + ", " + getEventTypeString(XMLEvent.END_ELEMENT) + ", "
-                     + getEventTypeString(XMLEvent.NAMESPACE)
-             + " valid for getNamespacePrefix()." );
+                    + " is not among the states " + getEventTypeString(XMLEvent.START_ELEMENT)
+                    + ", " + getEventTypeString(XMLEvent.END_ELEMENT) + ", "
+                    + getEventTypeString(XMLEvent.NAMESPACE)
+                    + " valid for getNamespacePrefix().");
         }
     }
 
-    /** Returns the uri for the namespace declared at the
-     * index.
+    /**
+     * Returns the uri for the namespace declared at the index.
      *
      * @param index the position of the namespace declaration
      * @return returns the namespace uri
-     * @throws IllegalStateException if this is not a START_ELEMENT, END_ELEMENT or NAMESPACE
+     * @throws IllegalStateException if this is not a START_ELEMENT, END_ELEMENT
+     * or NAMESPACE
      */
     public String getNamespaceURI(int index) {
-        if(fEventType == XMLEvent.START_ELEMENT || fEventType == XMLEvent.END_ELEMENT || fEventType == XMLEvent.NAMESPACE){
+        if (fEventType == XMLEvent.START_ELEMENT || fEventType == XMLEvent.END_ELEMENT
+                || fEventType == XMLEvent.NAMESPACE) {
             //namespaceContext is dynamic object.
-            return fScanner.getNamespaceContext().getURI(fScanner.getNamespaceContext().getDeclaredPrefixAt(index));
-        }
-        else{
+            return fScanner.getNamespaceContext().getURI(fScanner.getNamespaceContext()
+                    .getDeclaredPrefixAt(index));
+        } else {
             throw new IllegalStateException("Current state " + getEventTypeString(fEventType)
-             + " is not among the states " + getEventTypeString(XMLEvent.START_ELEMENT)
-             + ", " + getEventTypeString(XMLEvent.END_ELEMENT) + ", "
-                     + getEventTypeString(XMLEvent.NAMESPACE)
-             + " valid for getNamespaceURI()." );
+                    + " is not among the states " + getEventTypeString(XMLEvent.START_ELEMENT)
+                    + ", " + getEventTypeString(XMLEvent.END_ELEMENT) + ", "
+                    + getEventTypeString(XMLEvent.NAMESPACE)
+                    + " valid for getNamespaceURI().");
         }
 
     }
 
-    /** Get the value of a feature/property from the underlying implementation
+    /**
+     * Get the value of a feature/property from the underlying implementation
+     *
      * @param name The name of the property, may not be null
      * @return The value of the property
      * @throws IllegalArgumentException if name is null
      */
     public Object getProperty(java.lang.String name) throws java.lang.IllegalArgumentException {
-        if(name == null) throw new java.lang.IllegalArgumentException() ;
-        if (fPropertyManager != null ){
-            if(name.equals(fPropertyManager.STAX_NOTATIONS)){
+        if (name == null) {
+            throw new java.lang.IllegalArgumentException();
+        }
+        if (fPropertyManager != null) {
+            if (name.equals(PropertyManager.STAX_NOTATIONS)) {
                 return getNotationDecls();
-            }else if(name.equals(fPropertyManager.STAX_ENTITIES)){
+            } else if (name.equals(PropertyManager.STAX_ENTITIES)) {
                 return getEntityDecls();
-            }else
+            } else {
                 return fPropertyManager.getProperty(name);
+            }
         }
         return null;
     }
 
-    /** Returns the current value of the parse event as a string,
-     * this returns the string value of a CHARACTERS event,
-     * returns the value of a COMMENT, the replacement value
-     * for an ENTITY_REFERENCE,
-     * or the String value of the DTD
+    /**
+     * Returns the current value of the parse event as a string, this returns
+     * the string value of a CHARACTERS event, returns the value of a COMMENT,
+     * the replacement value for an ENTITY_REFERENCE, or the String value of the
+     * DTD
+     *
      * @return the current text or null
-     * @throws java.lang.IllegalStateException if this state is not
-     * a valid text state.
+     * @throws java.lang.IllegalStateException if this state is not a valid text
+     * state.
      */
     public String getText() {
-        if( fEventType == XMLEvent.CHARACTERS || fEventType == XMLEvent.COMMENT
-                || fEventType == XMLEvent.CDATA || fEventType == XMLEvent.SPACE){
+        if (fEventType == XMLEvent.CHARACTERS || fEventType == XMLEvent.COMMENT
+                || fEventType == XMLEvent.CDATA || fEventType == XMLEvent.SPACE) {
             //this requires creation of new string
             //fEventType == XMLEvent.ENTITY_REFERENCE
-            return fScanner.getCharacterData().toString() ;
-        } else if(fEventType == XMLEvent.ENTITY_REFERENCE){
+            return fScanner.getCharacterData().toString();
+        } else if (fEventType == XMLEvent.ENTITY_REFERENCE) {
             String name = fScanner.getEntityName();
-            if(name != null){
-                if(fScanner.foundBuiltInRefs)
+            if (name != null) {
+                if (fScanner.foundBuiltInRefs) {
                     return fScanner.getCharacterData().toString();
+                }
 
                 XMLEntityStorage entityStore = fEntityManager.getEntityStore();
                 Entity en = entityStore.getEntity(name);
-                if(en == null)
+                if (en == null) {
                     return null;
-                if(en.isExternal())
-                    return ((Entity.ExternalEntity)en).entityLocation.getExpandedSystemId();
-                else
-                    return ((Entity.InternalEntity)en).text;
-            }else
+                }
+                if (en.isExternal()) {
+                    return ((Entity.ExternalEntity) en).entityLocation.getExpandedSystemId();
+                } else {
+                    return ((Entity.InternalEntity) en).text;
+                }
+            } else {
                 return null;
-        }
-        else if(fEventType == XMLEvent.DTD){
-                if(fDTDDecl != null){
-                    return fDTDDecl;
-                }
-                XMLStringBuffer tmpBuffer = fScanner.getDTDDecl();
-                fDTDDecl = tmpBuffer.toString();
+            }
+        } else if (fEventType == XMLEvent.DTD) {
+            if (fDTDDecl != null) {
                 return fDTDDecl;
-        } else{
-                throw new IllegalStateException("Current state " + getEventTypeString(fEventType)
-                     + " is not among the states" + getEventTypeString(XMLEvent.CHARACTERS) + ", "
-                     + getEventTypeString(XMLEvent.COMMENT) + ", "
-                     + getEventTypeString(XMLEvent.CDATA) + ", "
-                     + getEventTypeString(XMLEvent.SPACE) + ", "
-                     + getEventTypeString(XMLEvent.ENTITY_REFERENCE) + ", "
-                     + getEventTypeString(XMLEvent.DTD) + " valid for getText() " ) ;
+            }
+            XMLStringBuffer tmpBuffer = fScanner.getDTDDecl();
+            fDTDDecl = tmpBuffer.toString();
+            return fDTDDecl;
+        } else {
+            throw new IllegalStateException("Current state " + getEventTypeString(fEventType)
+                    + " is not among the states" + getEventTypeString(XMLEvent.CHARACTERS) + ", "
+                    + getEventTypeString(XMLEvent.COMMENT) + ", "
+                    + getEventTypeString(XMLEvent.CDATA) + ", "
+                    + getEventTypeString(XMLEvent.SPACE) + ", "
+                    + getEventTypeString(XMLEvent.ENTITY_REFERENCE) + ", "
+                    + getEventTypeString(XMLEvent.DTD) + " valid for getText() ");
         }
     }//getText
 
-
-    /** Test if the current event is of the given type and if the namespace and name match the current namespace and name of the current event.
-     * If the namespaceURI is null it is not checked for equality, if the localName is null it is not checked for equality.
+    /**
+     * Test if the current event is of the given type and if the namespace and
+     * name match the current namespace and name of the current event. If the
+     * namespaceURI is null it is not checked for equality, if the localName is
+     * null it is not checked for equality.
+     *
      * @param type the event type
      * @param namespaceURI the uri of the event, may be null
      * @param localName the localName of the event, may be null
      * @throws XMLStreamException if the required values are not matched.
      */
     public void require(int type, String namespaceURI, String localName) throws XMLStreamException {
-        if( type != fEventType)
-             throw new XMLStreamException("Event type " + getEventTypeString(type) + " specified did " +
-                     "not match with current parser event " + getEventTypeString(fEventType));
-          if( namespaceURI != null && !namespaceURI.equals(getNamespaceURI()) )
-             throw new XMLStreamException("Namespace URI " + namespaceURI +" specified did not match " +
-                     "with current namespace URI");
-          if(localName != null && !localName.equals(getLocalName()))
-             throw new XMLStreamException("LocalName " + localName +" specified did not match with " +
-                     "current local name");
+        if (type != fEventType) {
+            throw new XMLStreamException("Event type " + getEventTypeString(type) + " specified did "
+                    + "not match with current parser event " + getEventTypeString(fEventType));
+        }
+        if (namespaceURI != null && !namespaceURI.equals(getNamespaceURI())) {
+            throw new XMLStreamException("Namespace URI " + namespaceURI + " specified did not match "
+                    + "with current namespace URI");
+        }
+        if (localName != null && !localName.equals(getLocalName())) {
+            throw new XMLStreamException("LocalName " + localName + " specified did not match with "
+                    + "current local name");
+        }
         return;
     }
 
-    /** Gets the the text associated with a CHARACTERS, SPACE or CDATA event.
-     * Text starting a "sourceStart" is copied into "destination" starting at "targetStart".
-     * Up to "length" characters are copied.  The number of characters actually copied is returned.
+    /**
+     * Gets the the text associated with a CHARACTERS, SPACE or CDATA event.
+     * Text starting a "sourceStart" is copied into "destination" starting at
+     * "targetStart". Up to "length" characters are copied. The number of
+     * characters actually copied is returned.
      *
-     * The "sourceStart" argument must be greater or equal to 0 and less than or equal to
-     * the number of characters associated with the event.  Usually, one requests text starting at a "sourceStart" of 0.
-     * If the number of characters actually copied is less than the "length", then there is no more text.
-     * Otherwise, subsequent calls need to be made until all text has been retrieved. For example:
+     * The "sourceStart" argument must be greater or equal to 0 and less than or
+     * equal to the number of characters associated with the event. Usually, one
+     * requests text starting at a "sourceStart" of 0. If the number of
+     * characters actually copied is less than the "length", then there is no
+     * more text. Otherwise, subsequent calls need to be made until all text has
+     * been retrieved. For example:
      *
      * <code>
      * int length = 1024;
@@ -1116,30 +1205,36 @@
      *   if (nCopied < length)
      *       break;
      * }
-     * </code>
-     * XMLStreamException may be thrown if there are any XML errors in the underlying source.
-     * The "targetStart" argument must be greater than or equal to 0 and less than the length of "target",
-     * Length must be greater than 0 and "targetStart + length" must be less than or equal to length of "target".
+     * </code> XMLStreamException may be thrown if there are any XML errors in
+     * the underlying source. The "targetStart" argument must be greater than or
+     * equal to 0 and less than the length of "target", Length must be greater
+     * than 0 and "targetStart + length" must be less than or equal to length of
+     * "target".
      *
-     * @param sourceStart the index of the first character in the source array to copy
+     * @param sourceStart the index of the first character in the source array
+     * to copy
      * @param target the destination array
      * @param targetStart the start offset in the target array
      * @param length the number of characters to copy
      * @return the number of characters actually copied
-     * @throws XMLStreamException if the underlying XML source is not well-formed
-     * @throws IndexOutOfBoundsException if targetStart < 0 or > than the length of target
-     * @throws IndexOutOfBoundwhile(isCharacters()) ;sException if length < 0 or targetStart + length > length of target
+     * @throws XMLStreamException if the underlying XML source is not
+     * well-formed
+     * @throws IndexOutOfBoundsException if targetStart < 0 or > than the length
+     * of target
+     * @throws IndexOutOfBoundwhile(isCharacters()) ;sException if length < 0 or targetStart + length
+     * > length of target
      * @throws UnsupportedOperationException if this method is not supported
      * @throws NullPointerException is if target is null
      */
-    public int getTextCharacters(int sourceStart, char[] target, int targetStart, int length) throws XMLStreamException {
+    public int getTextCharacters(int sourceStart, char[] target, int targetStart, int length)
+            throws XMLStreamException {
 
-        if(target == null){
-            throw new NullPointerException("target char array can't be null") ;
+        if (target == null) {
+            throw new NullPointerException("target char array can't be null");
         }
 
-        if(targetStart < 0 || length < 0 || sourceStart < 0 || targetStart >= target.length ||
-            (targetStart + length ) > target.length) {
+        if (targetStart < 0 || length < 0 || sourceStart < 0 || targetStart >= target.length
+                || (targetStart + length) > target.length) {
             throw new IndexOutOfBoundsException();
         }
 
@@ -1148,97 +1243,105 @@
         int copiedLength = 0;
         //int presentDataLen = getTextLength() - (getTextStart()+sourceStart);
         int available = getTextLength() - sourceStart;
-        if(available < 0){
-            throw new IndexOutOfBoundsException("sourceStart is greater than" +
-                "number of characters associated with this event");
+        if (available < 0) {
+            throw new IndexOutOfBoundsException("sourceStart is greater than"
+                    + "number of characters associated with this event");
         }
-        if(available < length){
+        if (available < length) {
             copiedLength = available;
-        } else{
+        } else {
             copiedLength = length;
         }
 
-        System.arraycopy(getTextCharacters(), getTextStart() + sourceStart , target, targetStart, copiedLength);
+        System.arraycopy(getTextCharacters(), getTextStart() + sourceStart, target, targetStart, copiedLength);
         return copiedLength;
     }
 
-    /** Return true if the current event has text, false otherwise
-     * The following events have text:
-     * CHARACTERS,DTD ,ENTITY_REFERENCE, COMMENT
+    /**
+     * Return true if the current event has text, false otherwise The following
+     * events have text: CHARACTERS,DTD ,ENTITY_REFERENCE, COMMENT
      */
     public boolean hasText() {
-        if(DEBUG) pr("XMLReaderImpl#EVENT TYPE = " + fEventType ) ;
-        if( fEventType == XMLEvent.CHARACTERS || fEventType == XMLEvent.COMMENT || fEventType == XMLEvent.CDATA) {
+        if (DEBUG) {
+            pr("XMLReaderImpl#EVENT TYPE = " + fEventType);
+        }
+        if (fEventType == XMLEvent.CHARACTERS || fEventType == XMLEvent.COMMENT
+                || fEventType == XMLEvent.CDATA) {
             return fScanner.getCharacterData().length > 0;
-        } else if(fEventType == XMLEvent.ENTITY_REFERENCE) {
+        } else if (fEventType == XMLEvent.ENTITY_REFERENCE) {
             String name = fScanner.getEntityName();
-            if(name != null){
-                if(fScanner.foundBuiltInRefs)
+            if (name != null) {
+                if (fScanner.foundBuiltInRefs) {
                     return true;
+                }
 
                 XMLEntityStorage entityStore = fEntityManager.getEntityStore();
                 Entity en = entityStore.getEntity(name);
-                if(en == null)
+                if (en == null) {
                     return false;
-                if(en.isExternal()){
-                    return ((Entity.ExternalEntity)en).entityLocation.getExpandedSystemId() != null;
-                } else{
-                    return ((Entity.InternalEntity)en).text != null ;
                 }
-            }else
+                if (en.isExternal()) {
+                    return ((Entity.ExternalEntity) en).entityLocation.getExpandedSystemId() != null;
+                } else {
+                    return ((Entity.InternalEntity) en).text != null;
+                }
+            } else {
                 return false;
-        } else {
-            if(fEventType == XMLEvent.DTD)
-                return fScanner.fSeenDoctypeDecl;
+            }
+        } else if (fEventType == XMLEvent.DTD) {
+            return fScanner.fSeenDoctypeDecl;
         }
         return false;
     }
 
-    /** Returns a boolean which indicates if this
-     * attribute was created by default
+    /**
+     * Returns a boolean which indicates if this attribute was created by
+     * default
+     *
      * @param index the position of the attribute
      * @return true if this is a default attribute
      * @throws IllegalStateException if this is not a START_ELEMENT or ATTRIBUTE
      */
     public boolean isAttributeSpecified(int index) {
         //check that current state should be either START_ELEMENT or ATTRIBUTE
-        if( (fEventType == XMLEvent.START_ELEMENT) || (fEventType == XMLEvent.ATTRIBUTE)){
-            return fScanner.getAttributeIterator().isSpecified(index) ;
-        } else{
+        if ((fEventType == XMLEvent.START_ELEMENT) || (fEventType == XMLEvent.ATTRIBUTE)) {
+            return fScanner.getAttributeIterator().isSpecified(index);
+        } else {
             throw new IllegalStateException("Current state is not among the states "
-                     + getEventTypeString(XMLEvent.START_ELEMENT) + " , "
-                     + getEventTypeString(XMLEvent.ATTRIBUTE)
-                     + "valid for isAttributeSpecified()")  ;
+                    + getEventTypeString(XMLEvent.START_ELEMENT) + " , "
+                    + getEventTypeString(XMLEvent.ATTRIBUTE)
+                    + "valid for isAttributeSpecified()");
         }
     }
 
-    /** Returns true if the cursor points to a character data event
+    /**
+     * Returns true if the cursor points to a character data event
+     *
      * @return true if the cursor points to character data, false otherwise
      */
     public boolean isCharacters() {
-        return fEventType == XMLEvent.CHARACTERS ;
+        return fEventType == XMLEvent.CHARACTERS;
     }
 
-    /** Skips any insignificant events (COMMENT and PROCESSING_INSTRUCTION)
-     * until a START_ELEMENT or
-     * END_ELEMENT is reached. If other than space characters are
-     * encountered, an exception is thrown. This method should
-     * be used when processing element-only content because
-     * the parser is not able to recognize ignorable whitespace if
-     * then DTD is missing or not interpreted.
+    /**
+     * Skips any insignificant events (COMMENT and PROCESSING_INSTRUCTION) until
+     * a START_ELEMENT or END_ELEMENT is reached. If other than space characters
+     * are encountered, an exception is thrown. This method should be used when
+     * processing element-only content because the parser is not able to
+     * recognize ignorable whitespace if then DTD is missing or not interpreted.
+     *
      * @return the event type of the element read
      * @throws XMLStreamException if the current event is not white space
      */
     public int nextTag() throws XMLStreamException {
 
         int eventType = next();
-        while((eventType == XMLStreamConstants.CHARACTERS && isWhiteSpace()) // skip whitespace
-        || (eventType == XMLStreamConstants.CDATA && isWhiteSpace())
-        // skip whitespace
-        || eventType == XMLStreamConstants.SPACE
-        || eventType == XMLStreamConstants.PROCESSING_INSTRUCTION
-        || eventType == XMLStreamConstants.COMMENT
-        ) {
+        while ((eventType == XMLStreamConstants.CHARACTERS && isWhiteSpace()) // skip whitespace
+                || (eventType == XMLStreamConstants.CDATA && isWhiteSpace())
+                // skip whitespace
+                || eventType == XMLStreamConstants.SPACE
+                || eventType == XMLStreamConstants.PROCESSING_INSTRUCTION
+                || eventType == XMLStreamConstants.COMMENT) {
             eventType = next();
         }
 
@@ -1253,87 +1356,100 @@
         return eventType;
     }
 
-    /** Checks if standalone was set in the document
+    /**
+     * Checks if standalone was set in the document
+     *
      * @return true if standalone was set in the document, or false otherwise
      */
     public boolean standaloneSet() {
         //xxx: it requires if the standalone was set in the document ? This is different that if the document
         // is standalone
-        return fScanner.standaloneSet() ;
+        return fScanner.standaloneSet();
     }
 
     /**
      * @param qname
      * @return
      */
-    public javax.xml.namespace.QName convertXNIQNametoJavaxQName(com.sun.org.apache.xerces.internal.xni.QName qname){
-        if (qname == null) return null;
+    public javax.xml.namespace.QName convertXNIQNametoJavaxQName(
+            com.sun.org.apache.xerces.internal.xni.QName qname) {
+        if (qname == null) {
+            return null;
+        }
         //xxx: prefix definition ?
-        if(qname.prefix == null){
-            return new javax.xml.namespace.QName(qname.uri, qname.localpart) ;
-        } else{
-            return new javax.xml.namespace.QName(qname.uri, qname.localpart, qname.prefix) ;
+        if (qname.prefix == null) {
+            return new javax.xml.namespace.QName(qname.uri, qname.localpart);
+        } else {
+            return new javax.xml.namespace.QName(qname.uri, qname.localpart, qname.prefix);
         }
     }
 
-    /** Return the uri for the given prefix.
-     * The uri returned depends on the current state of the processor.
+    /**
+     * Return the uri for the given prefix. The uri returned depends on the
+     * current state of the processor.
      *
-     * <p><strong>NOTE:</strong>The 'xml' prefix is bound as defined in
-     * <a href="http://www.w3.org/TR/REC-xml-names/#ns-using">Namespaces in XML</a>
+     * <p>
+     * <strong>NOTE:</strong>The 'xml' prefix is bound as defined in
+     * <a href="http://www.w3.org/TR/REC-xml-names/#ns-using">Namespaces in
+     * XML</a>
      * specification to "http://www.w3.org/XML/1998/namespace".
      *
-     * <p><strong>NOTE:</strong> The 'xmlns' prefix must be resolved to following namespace
+     * <p>
+     * <strong>NOTE:</strong> The 'xmlns' prefix must be resolved to following
+     * namespace
      * <a href="http://www.w3.org/2000/xmlns/">http://www.w3.org/2000/xmlns/</a>
+     *
      * @return the uri bound to the given prefix or null if it is not bound
      * @param prefix The prefix to lookup, may not be null
      * @throws IllegalStateException - if the prefix is null
      */
     public String getNamespaceURI(String prefix) {
-        if(prefix == null) throw new java.lang.IllegalArgumentException("prefix cannot be null.") ;
+        if (prefix == null) {
+            throw new java.lang.IllegalArgumentException("prefix cannot be null.");
+        }
 
         //first add the string to symbol table.. since internally identity comparisons are done.
-        return fScanner.getNamespaceContext().getURI(fSymbolTable.addSymbol(prefix)) ;
+        return fScanner.getNamespaceContext().getURI(fSymbolTable.addSymbol(prefix));
     }
 
     //xxx: this function is not being used.
-    protected void setPropertyManager(PropertyManager propertyManager){
-        fPropertyManager = propertyManager ;
+    protected void setPropertyManager(PropertyManager propertyManager) {
+        fPropertyManager = propertyManager;
         //REVISIT: we were supplying hashmap ealier
-        fScanner.setProperty("stax-properties",propertyManager);
-        fScanner.setPropertyManager(propertyManager) ;
+        fScanner.setProperty("stax-properties", propertyManager);
+        fScanner.setPropertyManager(propertyManager);
     }
 
     /**
      * @return returns the reference to property manager.
      */
-    protected PropertyManager getPropertyManager(){
-        return fPropertyManager ;
+    protected PropertyManager getPropertyManager() {
+        return fPropertyManager;
     }
 
     static void pr(String str) {
-        System.out.println(str) ;
+        System.out.println(str);
     }
 
-    protected List getEntityDecls(){
-        if(fEventType == XMLStreamConstants.DTD){
+    protected List<EntityDeclaration> getEntityDecls() {
+        if (fEventType == XMLStreamConstants.DTD) {
             XMLEntityStorage entityStore = fEntityManager.getEntityStore();
-            ArrayList list = null;
-            if(entityStore.hasEntities()){
+            ArrayList<EntityDeclaration> list = null;
+            Map<String, Entity> entities = entityStore.getEntities();
+            if (entities.size() > 0) {
                 EntityDeclarationImpl decl = null;
-                list = new ArrayList(entityStore.getEntitySize());
-                Enumeration enu = entityStore.getEntityKeys();
-                while(enu.hasMoreElements()){
-                    String key = (String)enu.nextElement();
-                    Entity en = (Entity)entityStore.getEntity(key);
+                list = new ArrayList<>(entities.size());
+                for (Map.Entry<String, Entity> entry : entities.entrySet()) {
+                    String key = entry.getKey();
+                    Entity en = entry.getValue();
                     decl = new EntityDeclarationImpl();
                     decl.setEntityName(key);
-                    if(en.isExternal()){
-                        decl.setXMLResourceIdentifier(((Entity.ExternalEntity)en).entityLocation);
-                        decl.setNotationName(((Entity.ExternalEntity)en).notation);
+                    if (en.isExternal()) {
+                        decl.setXMLResourceIdentifier(((Entity.ExternalEntity) en).entityLocation);
+                        decl.setNotationName(((Entity.ExternalEntity) en).notation);
+                    } else {
+                        decl.setEntityReplacementText(((Entity.InternalEntity) en).text);
                     }
-                    else
-                        decl.setEntityReplacementText(((Entity.InternalEntity)en).text);
                     list.add(decl);
                 }
             }
@@ -1342,19 +1458,20 @@
         return null;
     }
 
-    protected List getNotationDecls(){
-        if(fEventType == XMLStreamConstants.DTD){
-            if(fScanner.fDTDScanner == null) return null;
-            DTDGrammar grammar = ((XMLDTDScannerImpl)(fScanner.fDTDScanner)).getGrammar();
-            if(grammar == null) return null;
-            List notations = grammar.getNotationDecls();
-
-            Iterator it = notations.iterator();
-            ArrayList list = new ArrayList();
-            while(it.hasNext()){
-                XMLNotationDecl ni = (XMLNotationDecl)it.next();
-                if(ni!= null){
-                    list.add(new NotationDeclarationImpl(ni));
+    protected List<NotationDeclaration> getNotationDecls() {
+        if (fEventType == XMLStreamConstants.DTD) {
+            if (fScanner.fDTDScanner == null) {
+                return null;
+            }
+            DTDGrammar grammar = ((XMLDTDScannerImpl) (fScanner.fDTDScanner)).getGrammar();
+            if (grammar == null) {
+                return null;
+            }
+            List<XMLNotationDecl> notations = grammar.getNotationDecls();
+            ArrayList<NotationDeclaration> list = new ArrayList<>();
+            for (XMLNotationDecl notation : notations) {
+                if (notation != null) {
+                    list.add(new NotationDeclarationImpl(notation));
                 }
             }
             return list;
@@ -1362,6 +1479,4 @@
         return null;
     }
 
-
-
 }//XMLReaderImpl
--- a/jaxp/src/java.xml/share/classes/com/sun/xml/internal/stream/XMLEntityStorage.java	Thu Dec 15 09:03:36 2016 +0100
+++ b/jaxp/src/java.xml/share/classes/com/sun/xml/internal/stream/XMLEntityStorage.java	Thu Dec 15 13:57:04 2016 -0800
@@ -35,8 +35,6 @@
 import com.sun.org.apache.xerces.internal.utils.SecuritySupport;
 import com.sun.org.apache.xerces.internal.xni.parser.XMLComponentManager;
 import com.sun.org.apache.xerces.internal.xni.parser.XMLConfigurationException;
-import java.util.Collections;
-import java.util.Enumeration;
 import java.util.HashMap;
 import java.util.Map;
 
@@ -142,16 +140,8 @@
         return fEntities.get(name);
     } // getEntity(String)
 
-    public boolean hasEntities() {
-            return (fEntities!=null);
-    } // getEntity(String)
-
-    public int getEntitySize() {
-        return fEntities.size();
-    } // getEntity(String)
-
-    public Enumeration getEntityKeys() {
-        return Collections.enumeration(fEntities.keySet());
+    public Map<String, Entity> getEntities() {
+        return fEntities;
     }
     /**
      * Adds an internal entity declaration.
@@ -310,9 +300,9 @@
 
         fCurrentEntity = fEntityManager.getCurrentEntity();
         if (!fEntities.containsKey(name)) {
-            Entity entity = new Entity.ExternalEntity(name, new XMLResourceIdentifierImpl(publicId, systemId, baseSystemId, null), notation, fInExternalSubset);
-            //                  (fCurrentEntity == null) ? fasle : fCurrentEntity.isEntityDeclInExternalSubset());
-            //                  fCurrentEntity.isEntityDeclInExternalSubset());
+            Entity entity = new Entity.ExternalEntity(name,
+                    new XMLResourceIdentifierImpl(publicId, systemId, baseSystemId, null),
+                    notation, fInExternalSubset);
             fEntities.put(name, entity);
         }
         else{
@@ -438,7 +428,7 @@
         userDir = userDir.replace(separator, '/');
 
         int len = userDir.length(), ch;
-        StringBuffer buffer = new StringBuffer(len*3);
+        StringBuilder buffer = new StringBuilder(len*3);
         // change C:/blah to /C:/blah
         if (len >= 2 && userDir.charAt(1) == ':') {
             ch = Character.toUpperCase(userDir.charAt(0));
--- a/jaxp/src/java.xml/share/classes/com/sun/xml/internal/stream/dtd/DTDGrammarUtil.java	Thu Dec 15 09:03:36 2016 +0100
+++ b/jaxp/src/java.xml/share/classes/com/sun/xml/internal/stream/dtd/DTDGrammarUtil.java	Thu Dec 15 13:57:04 2016 -0800
@@ -1,15 +1,16 @@
 /*
- * Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
  */
 
 /*
- * Copyright 2005 The Apache Software Foundation.
+ * 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
  *
- * Licensed 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
+ *     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,
@@ -24,8 +25,6 @@
 import com.sun.xml.internal.stream.dtd.nonvalidating.XMLElementDecl;
 import com.sun.xml.internal.stream.dtd.nonvalidating.XMLSimpleType;
 import com.sun.org.apache.xerces.internal.impl.Constants;
-import com.sun.org.apache.xerces.internal.impl.XMLEntityManager;
-import com.sun.org.apache.xerces.internal.impl.XMLErrorReporter;
 import com.sun.org.apache.xerces.internal.util.SymbolTable;
 import com.sun.org.apache.xerces.internal.util.XMLChar;
 import com.sun.org.apache.xerces.internal.util.XMLSymbols;
@@ -33,13 +32,10 @@
 import com.sun.org.apache.xerces.internal.xni.QName;
 import com.sun.org.apache.xerces.internal.xni.NamespaceContext;
 import com.sun.org.apache.xerces.internal.xni.XMLAttributes;
-import com.sun.org.apache.xerces.internal.xni.XMLDocumentHandler;
-import com.sun.org.apache.xerces.internal.xni.XMLLocator;
 import com.sun.org.apache.xerces.internal.xni.XMLString;
 import com.sun.org.apache.xerces.internal.xni.XNIException;
 import com.sun.org.apache.xerces.internal.xni.parser.XMLComponentManager;
 import com.sun.org.apache.xerces.internal.xni.parser.XMLConfigurationException;
-import com.sun.org.apache.xerces.internal.xni.parser.XMLDocumentSource;
 import javax.xml.XMLConstants;
 
  /*
@@ -96,7 +92,7 @@
     private QName fTempQName = new QName();
 
     /** Temporary string buffers. */
-    private StringBuffer fBuffer = new StringBuffer();
+    private StringBuilder fBuffer = new StringBuilder();
 
     private NamespaceContext fNamespaceContext = null;
 
@@ -396,7 +392,7 @@
                     XMLSymbols.fENTITYSymbol;
             }
             case XMLSimpleType.TYPE_ENUMERATION: {
-                StringBuffer buffer = new StringBuffer();
+                StringBuilder buffer = new StringBuilder();
                 buffer.append('(');
                 for (int i = 0; i < attrDecl.simpleType.enumeration.length; i++) {
                     if (i > 0) {
--- a/jaxp/src/java.xml/share/classes/com/sun/xml/internal/stream/dtd/nonvalidating/DTDGrammar.java	Thu Dec 15 09:03:36 2016 +0100
+++ b/jaxp/src/java.xml/share/classes/com/sun/xml/internal/stream/dtd/nonvalidating/DTDGrammar.java	Thu Dec 15 13:57:04 2016 -0800
@@ -1,15 +1,16 @@
 /*
- * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
  */
 
 /*
- * Copyright 2005 The Apache Software Foundation.
+ * 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
  *
- * Licensed 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
+ *     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,
@@ -34,7 +35,6 @@
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
-import java.util.Random;
 
 /**
  * A DTD grammar. This class implements the XNI handler interfaces
@@ -95,8 +95,8 @@
     protected boolean fReadingExternalDTD = false;
 
     /** Symbol table. */
-    private SymbolTable fSymbolTable;
-    private ArrayList notationDecls = new ArrayList();
+    private final SymbolTable fSymbolTable;
+    private final ArrayList<XMLNotationDecl> notationDecls = new ArrayList<>();
 
     // element declarations
 
@@ -334,18 +334,19 @@
         fSimpleType.clear();
         if ( defaultType != null ) {
             if ( defaultType.equals( "#FIXED") ) {
-                fSimpleType.defaultType = fSimpleType.DEFAULT_TYPE_FIXED;
+                fSimpleType.defaultType = XMLSimpleType.DEFAULT_TYPE_FIXED;
             } else if ( defaultType.equals( "#IMPLIED") ) {
-                fSimpleType.defaultType = fSimpleType.DEFAULT_TYPE_IMPLIED;
+                fSimpleType.defaultType = XMLSimpleType.DEFAULT_TYPE_IMPLIED;
             } else if ( defaultType.equals( "#REQUIRED") ) {
-                fSimpleType.defaultType = fSimpleType.DEFAULT_TYPE_REQUIRED;
+                fSimpleType.defaultType = XMLSimpleType.DEFAULT_TYPE_REQUIRED;
             }
         }
         if ( DEBUG ) {
             System.out.println("defaultvalue = " + defaultValue.toString() );
         }
-        fSimpleType.defaultValue      = defaultValue!=null ?  defaultValue.toString() : null;
-        fSimpleType.nonNormalizedDefaultValue      = nonNormalizedDefaultValue!=null ?  nonNormalizedDefaultValue.toString() : null;
+        fSimpleType.defaultValue = defaultValue!=null ? defaultValue.toString() : null;
+        fSimpleType.nonNormalizedDefaultValue = nonNormalizedDefaultValue!=null ?
+                nonNormalizedDefaultValue.toString() : null;
         fSimpleType.enumeration       = enumeration;
 
         if (type.equals("CDATA")) {
@@ -731,7 +732,7 @@
         notationDecls.add(notationDecl);
     }
 
-    public List getNotationDecls(){
+    public List<XMLNotationDecl> getNotationDecls() {
         return notationDecls;
     }
 
--- a/jaxp/src/java.xml/share/classes/com/sun/xml/internal/stream/dtd/nonvalidating/XMLAttributeDecl.java	Thu Dec 15 09:03:36 2016 +0100
+++ b/jaxp/src/java.xml/share/classes/com/sun/xml/internal/stream/dtd/nonvalidating/XMLAttributeDecl.java	Thu Dec 15 13:57:04 2016 -0800
@@ -3,13 +3,14 @@
  */
 
 /*
- * Copyright 2005 The Apache Software Foundation.
+ * 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
  *
- * Licensed 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
+ *     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,
--- a/jaxp/src/java.xml/share/classes/com/sun/xml/internal/stream/dtd/nonvalidating/XMLElementDecl.java	Thu Dec 15 09:03:36 2016 +0100
+++ b/jaxp/src/java.xml/share/classes/com/sun/xml/internal/stream/dtd/nonvalidating/XMLElementDecl.java	Thu Dec 15 13:57:04 2016 -0800
@@ -3,13 +3,14 @@
  */
 
 /*
- * Copyright 2005 The Apache Software Foundation.
+ * 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
  *
- * Licensed 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
+ *     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,
--- a/jaxp/src/java.xml/share/classes/com/sun/xml/internal/stream/dtd/nonvalidating/XMLNotationDecl.java	Thu Dec 15 09:03:36 2016 +0100
+++ b/jaxp/src/java.xml/share/classes/com/sun/xml/internal/stream/dtd/nonvalidating/XMLNotationDecl.java	Thu Dec 15 13:57:04 2016 -0800
@@ -3,13 +3,14 @@
  */
 
 /*
- * Copyright 2005 The Apache Software Foundation.
+ * 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
  *
- * Licensed 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
+ *     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,
--- a/jaxp/src/java.xml/share/classes/com/sun/xml/internal/stream/events/DTDEvent.java	Thu Dec 15 09:03:36 2016 +0100
+++ b/jaxp/src/java.xml/share/classes/com/sun/xml/internal/stream/events/DTDEvent.java	Thu Dec 15 13:57:04 2016 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,80 +25,88 @@
 
 package com.sun.xml.internal.stream.events;
 
+import java.util.List;
 import javax.xml.stream.events.DTD;
+import javax.xml.stream.events.EntityDeclaration;
+import javax.xml.stream.events.NotationDeclaration;
 import javax.xml.stream.events.XMLEvent;
 
 /**
  *
- * @author  Neeraj Bajaj, Sun Microsystesm.
+ * @author Neeraj Bajaj, Sun Microsystesm.
  *
  */
-public class DTDEvent extends DummyEvent implements DTD{
+public class DTDEvent extends DummyEvent implements DTD {
 
     private String fDoctypeDeclaration;
-    private java.util.List fNotations;
-    private java.util.List fEntities;
+    private List<NotationDeclaration> fNotations;
+    private List<EntityDeclaration> fEntities;
 
-    /** Creates a new instance of DTDEvent */
+    /**
+     * Creates a new instance of DTDEvent
+     */
     public DTDEvent() {
         init();
     }
 
-    public DTDEvent(String doctypeDeclaration){
+    public DTDEvent(String doctypeDeclaration) {
         init();
         fDoctypeDeclaration = doctypeDeclaration;
     }
 
-    public void setDocumentTypeDeclaration(String doctypeDeclaration){
+    public void setDocumentTypeDeclaration(String doctypeDeclaration) {
         fDoctypeDeclaration = doctypeDeclaration;
     }
 
+    @Override
     public String getDocumentTypeDeclaration() {
         return fDoctypeDeclaration;
     }
 
     //xxx: we can change the signature if the implementation doesn't store the entities in List Datatype.
     //and then convert that DT to list format here. That way callee dont need to bother about conversion
-
-    public void setEntities(java.util.List entites){
+    public void setEntities(List<EntityDeclaration> entites) {
         fEntities = entites;
     }
 
-    public java.util.List getEntities() {
+    @Override
+    public List<EntityDeclaration> getEntities() {
         return fEntities;
     }
 
     //xxx: we can change the signature if the implementation doesn't store the entities in List Datatype.
     //and then convert that DT to list format here. That way callee dont need to bother about conversion
-
-    public void setNotations(java.util.List notations){
+    public void setNotations(List<NotationDeclaration> notations) {
         fNotations = notations;
     }
 
-    public java.util.List getNotations() {
+    @Override
+    public List<NotationDeclaration> getNotations() {
         return fNotations;
     }
 
     /**
-     *Returns an implementation defined representation of the DTD.
-     * This method may return null if no representation is available.
+     * Returns an implementation defined representation of the DTD. This method
+     * may return null if no representation is available.
      *
      */
+    @Override
     public Object getProcessedDTD() {
         return null;
     }
 
-    protected void init(){
+    protected final void init() {
         setEventType(XMLEvent.DTD);
     }
 
-    public String toString(){
-        return fDoctypeDeclaration ;
+    @Override
+    public String toString() {
+        return fDoctypeDeclaration;
     }
 
+    @Override
     protected void writeAsEncodedUnicodeEx(java.io.Writer writer)
-    throws java.io.IOException
-    {
+            throws java.io.IOException {
         writer.write(fDoctypeDeclaration);
     }
 }
--- a/jaxp/src/java.xml/share/classes/com/sun/xml/internal/stream/events/EndElementEvent.java	Thu Dec 15 09:03:36 2016 +0100
+++ b/jaxp/src/java.xml/share/classes/com/sun/xml/internal/stream/events/EndElementEvent.java	Thu Dec 15 13:57:04 2016 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,8 +22,7 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
-
-package com.sun.xml.internal.stream.events ;
+package com.sun.xml.internal.stream.events;
 
 import java.util.List;
 import java.util.ArrayList;
@@ -31,35 +30,33 @@
 import javax.xml.namespace.QName;
 import javax.xml.stream.events.EndElement;
 import javax.xml.stream.events.Namespace;
-import java.io.Writer;
 import java.util.Iterator;
 import javax.xml.stream.events.XMLEvent;
 import com.sun.xml.internal.stream.util.ReadOnlyIterator;
 
-/** Implementation of EndElement event.
+/**
+ * Implementation of EndElement event.
  *
  * @author Neeraj Bajaj Sun Microsystems,Inc.
  * @author K.Venugopal Sun Microsystems,Inc.
  */
+public class EndElementEvent extends DummyEvent
+        implements EndElement {
 
-public class EndElementEvent extends DummyEvent
-implements EndElement {
-
-    List fNamespaces = null;
-    QName fQName ;
+    List<Namespace> fNamespaces = null;
+    QName fQName;
 
     public EndElementEvent() {
         init();
     }
 
-    protected void init() {
+    protected final void init() {
         setEventType(XMLEvent.END_ELEMENT);
-        fNamespaces = new ArrayList();
+        fNamespaces = new ArrayList<>();
     }
 
-
-    public EndElementEvent(String prefix,  String uri, String localpart) {
-        this(new QName(uri,localpart,prefix));
+    public EndElementEvent(String prefix, String uri, String localpart) {
+        this(new QName(uri, localpart, prefix));
     }
 
     public EndElementEvent(QName qname) {
@@ -67,6 +64,7 @@
         init();
     }
 
+    @Override
     public QName getName() {
         return fQName;
     }
@@ -75,34 +73,36 @@
         this.fQName = qname;
     }
 
+    @Override
     protected void writeAsEncodedUnicodeEx(java.io.Writer writer)
-    throws java.io.IOException
-    {
+            throws java.io.IOException {
         writer.write("</");
         String prefix = fQName.getPrefix();
         if (prefix != null && prefix.length() > 0) {
             writer.write(prefix);
             writer.write(':');
-     }
+        }
         writer.write(fQName.getLocalPart());
         writer.write('>');
     }
 
-    /** Returns an Iterator of namespaces that have gone out
-     * of scope.  Returns an empty iterator if no namespaces have gone
-     * out of scope.
-     * @return an Iterator over Namespace interfaces, or an
-     * empty iterator
+    /**
+     * Returns an Iterator of namespaces that have gone out of scope. Returns an
+     * empty iterator if no namespaces have gone out of scope.
+     *
+     * @return an Iterator over Namespace interfaces, or an empty iterator
      */
-    public Iterator getNamespaces() {
-        if(fNamespaces != null)
+    @Override
+    public Iterator<Namespace> getNamespaces() {
+        if (fNamespaces != null) {
             fNamespaces.iterator();
-        return new ReadOnlyIterator();
+        }
+        return new ReadOnlyIterator<>();
     }
 
-    void addNamespace(Namespace attr){
-        if(attr != null){
-            fNamespaces.add(attr);
+    void addNamespace(Namespace ns) {
+        if (ns != null) {
+            fNamespaces.add(ns);
         }
     }
 
@@ -113,12 +113,15 @@
     }
 
     public String nameAsString() {
-        if("".equals(fQName.getNamespaceURI()))
+        if ("".equals(fQName.getNamespaceURI())) {
             return fQName.getLocalPart();
-        if(fQName.getPrefix() != null)
+        }
+
+        if (fQName.getPrefix() != null) {
             return "['" + fQName.getNamespaceURI() + "']:" + fQName.getPrefix() + ":" + fQName.getLocalPart();
-        else
+        } else {
             return "['" + fQName.getNamespaceURI() + "']:" + fQName.getLocalPart();
+        }
     }
 
 }
--- a/jaxp/src/java.xml/share/classes/com/sun/xml/internal/stream/events/StartElementEvent.java	Thu Dec 15 09:03:36 2016 +0100
+++ b/jaxp/src/java.xml/share/classes/com/sun/xml/internal/stream/events/StartElementEvent.java	Thu Dec 15 13:57:04 2016 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,35 +23,33 @@
  * questions.
  */
 
-package com.sun.xml.internal.stream.events ;
+package com.sun.xml.internal.stream.events;
 
+import com.sun.xml.internal.stream.util.ReadOnlyIterator;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.ArrayList;
-import java.util.Collection;
+import javax.xml.namespace.NamespaceContext;
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamConstants;
+import javax.xml.stream.events.Attribute;
+import javax.xml.stream.events.Namespace;
+import javax.xml.stream.events.StartElement;
 
-import javax.xml.namespace.QName;
-import javax.xml.stream.events.StartElement;
-import javax.xml.stream.events.Attribute;
-import javax.xml.namespace.NamespaceContext;
-import java.io.Writer;
-import com.sun.xml.internal.stream.util.ReadOnlyIterator;
-import javax.xml.stream.XMLStreamConstants;
-import javax.xml.stream.events.Namespace;
-
-/** Implementation of StartElementEvent.
+/**
+ * Implementation of StartElementEvent.
  *
  * @author Neeraj Bajaj Sun Microsystems,Inc.
  * @author K.Venugopal Sun Microsystems,Inc.
  */
+public class StartElementEvent extends DummyEvent
+        implements StartElement {
 
-public class StartElementEvent extends DummyEvent
-implements StartElement {
-
-    private Map fAttributes;
-    private List fNamespaces;
+    private Map<QName, Attribute> fAttributes;
+    private List<Namespace> fNamespaces;
     private NamespaceContext fNamespaceContext = null;
     private QName fQName;
 
@@ -70,12 +68,13 @@
         addNamespaceAttributes(startelement.getNamespaces());
     }
 
-    protected void init() {
+    protected final void init() {
         setEventType(XMLStreamConstants.START_ELEMENT);
-        fAttributes = new HashMap();
-        fNamespaces = new ArrayList();
+        fAttributes = new HashMap<>();
+        fNamespaces = new ArrayList<>();
     }
 
+    @Override
     public QName getName() {
         return fQName;
     }
@@ -84,50 +83,60 @@
         this.fQName = qname;
     }
 
-    public Iterator getAttributes() {
-        if(fAttributes != null){
-            Collection coll = fAttributes.values();
-            return new ReadOnlyIterator(coll.iterator());
+    @Override
+    public Iterator<Attribute> getAttributes() {
+        if (fAttributes != null) {
+            Collection<Attribute> coll = fAttributes.values();
+            return new ReadOnlyIterator<>(coll.iterator());
         }
-        return new ReadOnlyIterator();
+        return new ReadOnlyIterator<>();
     }
 
-    public Iterator getNamespaces() {
-        if(fNamespaces != null){
-            return new ReadOnlyIterator(fNamespaces.iterator());
+    @Override
+    public Iterator<Namespace> getNamespaces() {
+        if (fNamespaces != null) {
+            return new ReadOnlyIterator<>(fNamespaces.iterator());
         }
-        return new ReadOnlyIterator();
+        return new ReadOnlyIterator<>();
     }
 
+    @Override
     public Attribute getAttributeByName(QName qname) {
-        if(qname == null)
+        if (qname == null) {
             return null;
-        return (Attribute)fAttributes.get(qname);
+        }
+        return fAttributes.get(qname);
     }
 
-    public String getNamespace(){
+    public String getNamespace() {
         return fQName.getNamespaceURI();
     }
 
+    @Override
     public String getNamespaceURI(String prefix) {
         //check that URI was supplied when creating this startElement event and prefix matches
-        if( getNamespace() != null && fQName.getPrefix().equals(prefix)) return getNamespace();
+        if (getNamespace() != null && fQName.getPrefix().equals(prefix)) {
+            return getNamespace();
+        }
         //else check the namespace context
-        if(fNamespaceContext != null)
+        if (fNamespaceContext != null) {
             return fNamespaceContext.getNamespaceURI(prefix);
+        }
         return null;
     }
 
     /**
-     * <p>Return a <code>String</code> representation of this
+     * <p>
+     * Return a <code>String</code> representation of this
      * <code>StartElement</code> formatted as XML.</p>
      *
      * @return <code>String</code> representation of this
-     *   <code>StartElement</code> formatted as XML.
+     * <code>StartElement</code> formatted as XML.
      */
+    @Override
     public String toString() {
 
-        StringBuffer startElement = new StringBuffer();
+        StringBuilder startElement = new StringBuilder();
 
         // open element
         startElement.append("<");
@@ -135,10 +144,10 @@
 
         // add any attributes
         if (fAttributes != null) {
-            Iterator it = this.getAttributes();
-            Attribute attr = null;
+            Iterator<Attribute> it = this.getAttributes();
+            Attribute attr;
             while (it.hasNext()) {
-                attr = (Attribute) it.next();
+                attr = it.next();
                 startElement.append(" ");
                 startElement.append(attr.toString());
             }
@@ -146,12 +155,12 @@
 
         // add any namespaces
         if (fNamespaces != null) {
-            Iterator it = fNamespaces.iterator();
-            Namespace attr = null;
+            Iterator<Namespace> it = fNamespaces.iterator();
+            Namespace ns;
             while (it.hasNext()) {
-                attr = (Namespace) it.next();
+                ns = it.next();
                 startElement.append(" ");
-                startElement.append(attr.toString());
+                startElement.append(ns.toString());
             }
         }
 
@@ -162,26 +171,31 @@
         return startElement.toString();
     }
 
-    /** Return this event as String
+    /**
+     * Return this event as String
+     *
      * @return String Event returned as string.
      */
     public String nameAsString() {
-        if("".equals(fQName.getNamespaceURI()))
+        if ("".equals(fQName.getNamespaceURI())) {
             return fQName.getLocalPart();
-        if(fQName.getPrefix() != null)
-            return "['" + fQName.getNamespaceURI() + "']:" + fQName.getPrefix() + ":" + fQName.getLocalPart();
-        else
+        }
+        if (fQName.getPrefix() != null) {
+            return "['" + fQName.getNamespaceURI() + "']:" + fQName.getPrefix()
+                    + ":" + fQName.getLocalPart();
+        } else {
             return "['" + fQName.getNamespaceURI() + "']:" + fQName.getLocalPart();
+        }
     }
 
-
-    /** Gets a read-only namespace context. If no context is
-     * available this method will return an empty namespace context.
-     * The NamespaceContext contains information about all namespaces
-     * in scope for this StartElement.
+    /**
+     * Gets a read-only namespace context. If no context is available this
+     * method will return an empty namespace context. The NamespaceContext
+     * contains information about all namespaces in scope for this StartElement.
      *
      * @return the current namespace context
      */
+    @Override
     public NamespaceContext getNamespaceContext() {
         return fNamespaceContext;
     }
@@ -190,40 +204,43 @@
         fNamespaceContext = nc;
     }
 
+    @Override
     protected void writeAsEncodedUnicodeEx(java.io.Writer writer)
-    throws java.io.IOException
-    {
+            throws java.io.IOException {
         writer.write(toString());
     }
 
-    void addAttribute(Attribute attr){
-        if(attr.isNamespace()){
-            fNamespaces.add(attr);
-        }else{
-            fAttributes.put(attr.getName(),attr);
+    void addAttribute(Attribute attr) {
+        if (attr.isNamespace()) {
+            fNamespaces.add((Namespace) attr);
+        } else {
+            fAttributes.put(attr.getName(), attr);
         }
     }
 
-    void addAttributes(Iterator attrs){
-        if(attrs == null)
+    final void addAttributes(Iterator<? extends Attribute> attrs) {
+        if (attrs == null) {
             return;
-        while(attrs.hasNext()){
-            Attribute attr = (Attribute)attrs.next();
-            fAttributes.put(attr.getName(),attr);
+        }
+        while (attrs.hasNext()) {
+            Attribute attr = attrs.next();
+            fAttributes.put(attr.getName(), attr);
         }
     }
 
-    void addNamespaceAttribute(Namespace attr){
-        if(attr == null)
+    void addNamespaceAttribute(Namespace attr) {
+        if (attr == null) {
             return;
+        }
         fNamespaces.add(attr);
     }
 
-    void addNamespaceAttributes(Iterator attrs){
-        if(attrs == null)
+    final void addNamespaceAttributes(Iterator<? extends Namespace> attrs) {
+        if (attrs == null) {
             return;
-        while(attrs.hasNext()){
-            Namespace attr = (Namespace)attrs.next();
+        }
+        while (attrs.hasNext()) {
+            Namespace attr = attrs.next();
             fNamespaces.add(attr);
         }
     }
--- a/jaxp/src/java.xml/share/classes/com/sun/xml/internal/stream/events/XMLEventAllocatorImpl.java	Thu Dec 15 09:03:36 2016 +0100
+++ b/jaxp/src/java.xml/share/classes/com/sun/xml/internal/stream/events/XMLEventAllocatorImpl.java	Thu Dec 15 13:57:04 2016 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,7 +22,6 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
-
 package com.sun.xml.internal.stream.events;
 
 import com.sun.org.apache.xerces.internal.impl.PropertyManager;
@@ -34,29 +33,36 @@
 import javax.xml.namespace.QName;
 import com.sun.org.apache.xerces.internal.util.NamespaceContextWrapper;
 import com.sun.org.apache.xerces.internal.util.NamespaceSupport;
+import javax.xml.stream.util.XMLEventConsumer;
 
 /**
  * Implementation of XMLEvent Allocator.
+ *
  * @author Neeraj.bajaj@sun.com, k.venugopal@sun.com
  */
 public class XMLEventAllocatorImpl implements XMLEventAllocator {
 
-    /** Creates a new instance of XMLEventAllocator */
+    /**
+     * Creates a new instance of XMLEventAllocator
+     */
     public XMLEventAllocatorImpl() {
     }
 
-    public javax.xml.stream.events.XMLEvent allocate(javax.xml.stream.XMLStreamReader xMLStreamReader) throws javax.xml.stream.XMLStreamException {
-        if(xMLStreamReader == null )
+    public XMLEvent allocate(XMLStreamReader xMLStreamReader) throws XMLStreamException {
+        if (xMLStreamReader == null) {
             throw new XMLStreamException("Reader cannot be null");
+        }
         //        allocate is not supposed to change the state of the reader so we shouldn't be calling next.
         //        return getNextEvent(xMLStreamReader);
         return getXMLEvent(xMLStreamReader);
     }
 
-    public void allocate(javax.xml.stream.XMLStreamReader xMLStreamReader, javax.xml.stream.util.XMLEventConsumer xMLEventConsumer) throws javax.xml.stream.XMLStreamException {
+    public void allocate(XMLStreamReader xMLStreamReader, XMLEventConsumer xMLEventConsumer)
+            throws XMLStreamException {
         XMLEvent currentEvent = getXMLEvent(xMLStreamReader);
-        if(currentEvent != null )
+        if (currentEvent != null) {
             xMLEventConsumer.add(currentEvent);
+        }
 
         return;
     }
@@ -66,141 +72,149 @@
     }
 
     //REVISIT: shouldn't we be using XMLEventFactory to create events.
-    XMLEvent getXMLEvent(XMLStreamReader streamReader){
+    XMLEvent getXMLEvent(XMLStreamReader streamReader) {
         XMLEvent event = null;
         //returns the current event
         int eventType = streamReader.getEventType();
-        switch(eventType){
+        switch (eventType) {
 
-            case XMLEvent.START_ELEMENT:{
+            case XMLEvent.START_ELEMENT: {
                 StartElementEvent startElementEvent = new StartElementEvent(getQName(streamReader));
-                fillAttributes(startElementEvent,streamReader);
-                //we might have different XMLStreamReader so check every time for the namespace aware property
-                //we should be setting namespace related values only when isNamespaceAware is 'true'
-                if( ((Boolean)streamReader.getProperty(XMLInputFactory.IS_NAMESPACE_AWARE)).booleanValue() ){
+                fillAttributes(startElementEvent, streamReader);
+                //we might have different XMLStreamReader so check every time for
+                //the namespace aware property. we should be setting namespace
+                //related values only when isNamespaceAware is 'true'
+                if (((Boolean) streamReader.getProperty(XMLInputFactory.IS_NAMESPACE_AWARE))) {
                     fillNamespaceAttributes(startElementEvent, streamReader);
-                    setNamespaceContext(startElementEvent,streamReader);
+                    setNamespaceContext(startElementEvent, streamReader);
                 }
 
                 startElementEvent.setLocation(streamReader.getLocation());
-                event = startElementEvent ;
+                event = startElementEvent;
                 break;
             }
-            case XMLEvent.END_ELEMENT:{
+            case XMLEvent.END_ELEMENT: {
                 EndElementEvent endElementEvent = new EndElementEvent(getQName(streamReader));
                 endElementEvent.setLocation(streamReader.getLocation());
 
-                if( ((Boolean)streamReader.getProperty(XMLInputFactory.IS_NAMESPACE_AWARE)).booleanValue() ){
-                    fillNamespaceAttributes(endElementEvent,streamReader);
+                if (((Boolean) streamReader.getProperty(XMLInputFactory.IS_NAMESPACE_AWARE))) {
+                    fillNamespaceAttributes(endElementEvent, streamReader);
                 }
-                event = endElementEvent ;
+                event = endElementEvent;
                 break;
             }
-            case XMLEvent.PROCESSING_INSTRUCTION:{
-                ProcessingInstructionEvent piEvent = new ProcessingInstructionEvent(streamReader.getPITarget(),streamReader.getPIData());
+            case XMLEvent.PROCESSING_INSTRUCTION: {
+                ProcessingInstructionEvent piEvent = new ProcessingInstructionEvent(
+                        streamReader.getPITarget(), streamReader.getPIData());
                 piEvent.setLocation(streamReader.getLocation());
-                event = piEvent ;
+                event = piEvent;
                 break;
             }
-            case XMLEvent.CHARACTERS:{
+            case XMLEvent.CHARACTERS: {
                 CharacterEvent cDataEvent = new CharacterEvent(streamReader.getText());
                 cDataEvent.setLocation(streamReader.getLocation());
-                event = cDataEvent ;
+                event = cDataEvent;
                 break;
             }
-            case XMLEvent.COMMENT:{
+            case XMLEvent.COMMENT: {
                 CommentEvent commentEvent = new CommentEvent(streamReader.getText());
                 commentEvent.setLocation(streamReader.getLocation());
-                event = commentEvent ;
+                event = commentEvent;
                 break;
             }
-            case XMLEvent.START_DOCUMENT:{
+            case XMLEvent.START_DOCUMENT: {
                 StartDocumentEvent sdEvent = new StartDocumentEvent();
                 sdEvent.setVersion(streamReader.getVersion());
                 sdEvent.setEncoding(streamReader.getEncoding());
-                if(streamReader.getCharacterEncodingScheme() != null){
+                if (streamReader.getCharacterEncodingScheme() != null) {
                     sdEvent.setDeclaredEncoding(true);
-                }else{
+                } else {
                     sdEvent.setDeclaredEncoding(false);
                 }
                 sdEvent.setStandalone(streamReader.isStandalone());
                 sdEvent.setLocation(streamReader.getLocation());
-                event = sdEvent ;
+                event = sdEvent;
                 break;
             }
-            case XMLEvent.END_DOCUMENT:{
-                EndDocumentEvent endDocumentEvent = new EndDocumentEvent() ;
+            case XMLEvent.END_DOCUMENT: {
+                EndDocumentEvent endDocumentEvent = new EndDocumentEvent();
                 endDocumentEvent.setLocation(streamReader.getLocation());
-                event = endDocumentEvent ;
+                event = endDocumentEvent;
                 break;
             }
-            case XMLEvent.ENTITY_REFERENCE:{
-                EntityReferenceEvent entityEvent =  new EntityReferenceEvent(streamReader.getLocalName(), new EntityDeclarationImpl(streamReader.getLocalName(),streamReader.getText()));
+            case XMLEvent.ENTITY_REFERENCE: {
+                EntityReferenceEvent entityEvent = new EntityReferenceEvent(streamReader.getLocalName(),
+                        new EntityDeclarationImpl(streamReader.getLocalName(), streamReader.getText()));
                 entityEvent.setLocation(streamReader.getLocation());
                 event = entityEvent;
                 break;
 
             }
-            case XMLEvent.ATTRIBUTE:{
-                event = null ;
+            case XMLEvent.ATTRIBUTE: {
+                event = null;
                 break;
             }
-            case XMLEvent.DTD:{
+            case XMLEvent.DTD: {
                 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);
+                @SuppressWarnings("unchecked")
+                List<EntityDeclaration> entities = (List<EntityDeclaration>)
+                        streamReader.getProperty(PropertyManager.STAX_ENTITIES);
+                if (entities != null && entities.size() != 0) {
+                    dtdEvent.setEntities(entities);
+                }
+                @SuppressWarnings("unchecked")
+                List<NotationDeclaration> notations = (List<NotationDeclaration>)
+                        streamReader.getProperty(PropertyManager.STAX_NOTATIONS);
+                if (notations != null && !notations.isEmpty()) {
+                    dtdEvent.setNotations(notations);
+                }
                 event = dtdEvent;
                 break;
             }
-            case XMLEvent.CDATA:{
-                CharacterEvent cDataEvent = new CharacterEvent(streamReader.getText(),true);
+            case XMLEvent.CDATA: {
+                CharacterEvent cDataEvent = new CharacterEvent(streamReader.getText(), true);
                 cDataEvent.setLocation(streamReader.getLocation());
-                event = cDataEvent ;
+                event = cDataEvent;
                 break;
             }
-            case XMLEvent.SPACE:{
-                CharacterEvent spaceEvent = new CharacterEvent(streamReader.getText(),false,true);
+            case XMLEvent.SPACE: {
+                CharacterEvent spaceEvent = new CharacterEvent(streamReader.getText(), false, true);
                 spaceEvent.setLocation(streamReader.getLocation());
-                event = spaceEvent ;
+                event = spaceEvent;
                 break;
             }
         }
-        return event ;
+        return event;
     }
 
     //this function is not used..
-    protected XMLEvent getNextEvent(XMLStreamReader streamReader) throws XMLStreamException{
+    protected XMLEvent getNextEvent(XMLStreamReader streamReader) throws XMLStreamException {
         //advance the reader to next event.
         streamReader.next();
         return getXMLEvent(streamReader);
     }
 
-    protected void fillAttributes(StartElementEvent event,XMLStreamReader xmlr){
+    protected void fillAttributes(StartElementEvent event, XMLStreamReader xmlr) {
 
         int len = xmlr.getAttributeCount();
         QName qname = null;
         AttributeImpl attr = null;
         NamespaceImpl nattr = null;
-        for(int i=0; i<len ;i++){
+        for (int i = 0; i < len; i++) {
             qname = xmlr.getAttributeName(i);
             //this method doesn't include namespace declarations
             //so we can be sure that there wont be any namespace declaration as part of this function call
             //we can avoid this check - nb.
             /**
-             * prefix = qname.getPrefix();
-             * localpart = qname.getLocalPart();
-             * if (prefix.equals(XMLConstants.XMLNS_ATTRIBUTE) ) {
-             * attr = new NamespaceImpl(localpart,xmlr.getAttributeValue(i));
-             * }else if (prefix.equals(XMLConstants.DEFAULT_NS_PREFIX)){
-             * attr = new NamespaceImpl(xmlr.getAttributeValue(i));
-             * }else{
-             * attr = new AttributeImpl();
-             * attr.setName(qname);
-             * }
-             **/
+             * prefix = qname.getPrefix(); localpart = qname.getLocalPart(); if
+             * (prefix.equals(XMLConstants.XMLNS_ATTRIBUTE) ) { attr = new
+             * NamespaceImpl(localpart,xmlr.getAttributeValue(i)); }else if
+             * (prefix.equals(XMLConstants.DEFAULT_NS_PREFIX)){ attr = new
+             * NamespaceImpl(xmlr.getAttributeValue(i)); }else{ attr = new
+             * AttributeImpl(); attr.setName(qname); }
+             *
+             */
             attr = new AttributeImpl();
             attr.setName(qname);
             attr.setAttributeType(xmlr.getAttributeType(i));
@@ -210,42 +224,42 @@
         }
     }
 
-    protected void fillNamespaceAttributes(StartElementEvent event,XMLStreamReader xmlr){
+    protected void fillNamespaceAttributes(StartElementEvent event, XMLStreamReader xmlr) {
         int count = xmlr.getNamespaceCount();
         String uri = null;
         String prefix = null;
         NamespaceImpl attr = null;
-        for(int i=0;i< count;i++){
+        for (int i = 0; i < count; i++) {
             uri = xmlr.getNamespaceURI(i);
             prefix = xmlr.getNamespacePrefix(i);
-            if(prefix == null){
+            if (prefix == null) {
                 prefix = XMLConstants.DEFAULT_NS_PREFIX;
             }
-            attr = new NamespaceImpl(prefix,uri);
+            attr = new NamespaceImpl(prefix, uri);
             event.addNamespaceAttribute(attr);
         }
     }
 
-    protected void fillNamespaceAttributes(EndElementEvent event,XMLStreamReader xmlr){
+    protected void fillNamespaceAttributes(EndElementEvent event, XMLStreamReader xmlr) {
         int count = xmlr.getNamespaceCount();
         String uri = null;
         String prefix = null;
         NamespaceImpl attr = null;
-        for(int i=0;i< count;i++){
+        for (int i = 0; i < count; i++) {
             uri = xmlr.getNamespaceURI(i);
             prefix = xmlr.getNamespacePrefix(i);
-            if(prefix == null){
+            if (prefix == null) {
                 prefix = XMLConstants.DEFAULT_NS_PREFIX;
             }
-            attr = new NamespaceImpl(prefix,uri);
+            attr = new NamespaceImpl(prefix, uri);
             event.addNamespace(attr);
         }
     }
 
     //Revisit : Creating a new Namespacecontext for now.
     //see if we can do better job.
-    private void setNamespaceContext(StartElementEvent event , XMLStreamReader xmlr){
-        NamespaceContextWrapper contextWrapper =(NamespaceContextWrapper) xmlr.getNamespaceContext();
+    private void setNamespaceContext(StartElementEvent event, XMLStreamReader xmlr) {
+        NamespaceContextWrapper contextWrapper = (NamespaceContextWrapper) xmlr.getNamespaceContext();
         NamespaceSupport ns = new NamespaceSupport(contextWrapper.getNamespaceContext());
         event.setNamespaceContext(new NamespaceContextWrapper(ns));
     }
--- a/jaxp/src/java.xml/share/classes/com/sun/xml/internal/stream/events/XMLEventFactoryImpl.java	Thu Dec 15 09:03:36 2016 +0100
+++ b/jaxp/src/java.xml/share/classes/com/sun/xml/internal/stream/events/XMLEventFactoryImpl.java	Thu Dec 15 13:57:04 2016 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,10 +25,19 @@
 
 package com.sun.xml.internal.stream.events;
 
+import java.util.Iterator;
+import javax.xml.namespace.NamespaceContext;
+import javax.xml.namespace.QName;
 import javax.xml.stream.XMLEventFactory;
 import javax.xml.stream.Location;
+import javax.xml.stream.events.Attribute;
+import javax.xml.stream.events.Characters;
+import javax.xml.stream.events.ProcessingInstruction;
 import javax.xml.stream.events.Namespace;
 import javax.xml.stream.events.EntityDeclaration;
+import javax.xml.stream.events.EntityReference;
+import javax.xml.stream.events.StartDocument;
+import javax.xml.stream.events.StartElement;
 
 
 /**
@@ -42,23 +51,27 @@
     public XMLEventFactoryImpl() {
     }
 
-    public javax.xml.stream.events.Attribute createAttribute(String localName, String value) {
+    @Override
+    public Attribute createAttribute(String localName, String value) {
         AttributeImpl attr =  new AttributeImpl(localName, value);
         if(location != null)attr.setLocation(location);
         return attr;
     }
 
-    public javax.xml.stream.events.Attribute createAttribute(javax.xml.namespace.QName name, String value) {
+    @Override
+    public Attribute createAttribute(QName name, String value) {
         return createAttribute(name.getPrefix(), name.getNamespaceURI(), name.getLocalPart(), value);
     }
 
-    public javax.xml.stream.events.Attribute createAttribute(String prefix, String namespaceURI, String localName, String value) {
+    @Override
+    public Attribute createAttribute(String prefix, String namespaceURI, String localName, String value) {
         AttributeImpl attr =  new AttributeImpl(prefix, namespaceURI, localName, value, null);
         if(location != null)attr.setLocation(location);
         return attr;
     }
 
-    public javax.xml.stream.events.Characters createCData(String content) {
+    @Override
+    public Characters createCData(String content) {
         //stax doesn't have separate CDATA event. This is taken care by
         //CHRACTERS event setting the cdata flag to true.
         CharacterEvent charEvent =  new CharacterEvent(content, true);
@@ -66,126 +79,156 @@
         return charEvent;
     }
 
-    public javax.xml.stream.events.Characters createCharacters(String content) {
+    @Override
+    public Characters createCharacters(String content) {
         CharacterEvent charEvent =  new CharacterEvent(content);
         if(location != null)charEvent.setLocation(location);
         return charEvent;
     }
 
+    @Override
     public javax.xml.stream.events.Comment createComment(String text) {
         CommentEvent charEvent =  new CommentEvent(text);
         if(location != null)charEvent.setLocation(location);
         return charEvent;
     }
 
+    @Override
     public javax.xml.stream.events.DTD createDTD(String dtd) {
         DTDEvent dtdEvent = new DTDEvent(dtd);
         if(location != null)dtdEvent.setLocation(location);
         return dtdEvent;
     }
 
+    @Override
     public javax.xml.stream.events.EndDocument createEndDocument() {
         EndDocumentEvent event =new EndDocumentEvent();
         if(location != null)event.setLocation(location);
         return event;
     }
 
-    public javax.xml.stream.events.EndElement createEndElement(javax.xml.namespace.QName name, java.util.Iterator namespaces) {
+    @Override
+    public javax.xml.stream.events.EndElement createEndElement(QName name,
+            Iterator<? extends Namespace> namespaces) {
         return createEndElement(name.getPrefix(), name.getNamespaceURI(), name.getLocalPart());
     }
 
-    public javax.xml.stream.events.EndElement createEndElement(String prefix, String namespaceUri, String localName) {
+    @Override
+    public javax.xml.stream.events.EndElement createEndElement(
+            String prefix, String namespaceUri, String localName) {
         EndElementEvent event =  new EndElementEvent(prefix, namespaceUri, localName);
         if(location != null)event.setLocation(location);
         return event;
     }
 
-    public javax.xml.stream.events.EndElement createEndElement(String prefix, String namespaceUri, String localName, java.util.Iterator namespaces) {
+    @Override
+    public javax.xml.stream.events.EndElement createEndElement(String prefix, String namespaceUri,
+            String localName, Iterator<? extends Namespace> namespaces) {
 
         EndElementEvent event =  new EndElementEvent(prefix, namespaceUri, localName);
         if(namespaces!=null){
             while(namespaces.hasNext())
-                event.addNamespace((Namespace)namespaces.next());
+                event.addNamespace(namespaces.next());
         }
         if(location != null)event.setLocation(location);
         return event;
     }
 
-    public javax.xml.stream.events.EntityReference createEntityReference(String name, EntityDeclaration entityDeclaration) {
+    @Override
+    public EntityReference createEntityReference(String name, EntityDeclaration entityDeclaration) {
         EntityReferenceEvent event =  new EntityReferenceEvent(name, entityDeclaration);
         if(location != null)event.setLocation(location);
         return event;
     }
 
-    public javax.xml.stream.events.Characters createIgnorableSpace(String content) {
+    @Override
+    public Characters createIgnorableSpace(String content) {
         CharacterEvent event =  new CharacterEvent(content, false, true);
         if(location != null)event.setLocation(location);
         return event;
     }
 
-    public javax.xml.stream.events.Namespace createNamespace(String namespaceURI) {
+    @Override
+    public Namespace createNamespace(String namespaceURI) {
         NamespaceImpl event =  new NamespaceImpl(namespaceURI);
         if(location != null)event.setLocation(location);
         return event;
     }
 
-    public javax.xml.stream.events.Namespace createNamespace(String prefix, String namespaceURI) {
+    @Override
+    public Namespace createNamespace(String prefix, String namespaceURI) {
         NamespaceImpl event =  new NamespaceImpl(prefix, namespaceURI);
         if(location != null)event.setLocation(location);
         return event;
     }
 
-    public javax.xml.stream.events.ProcessingInstruction createProcessingInstruction(String target, String data) {
+    @Override
+    public ProcessingInstruction createProcessingInstruction(String target, String data) {
         ProcessingInstructionEvent event =  new ProcessingInstructionEvent(target, data);
         if(location != null)event.setLocation(location);
         return event;
     }
 
-    public javax.xml.stream.events.Characters createSpace(String content) {
+    @Override
+    public Characters createSpace(String content) {
         CharacterEvent event =  new CharacterEvent(content);
         if(location != null)event.setLocation(location);
         return event;
     }
 
-    public javax.xml.stream.events.StartDocument createStartDocument() {
+    @Override
+    public StartDocument createStartDocument() {
         StartDocumentEvent event = new StartDocumentEvent();
         if(location != null)event.setLocation(location);
         return event;
     }
 
-    public javax.xml.stream.events.StartDocument createStartDocument(String encoding) {
+    @Override
+    public StartDocument createStartDocument(String encoding) {
         StartDocumentEvent event =  new StartDocumentEvent(encoding);
         if(location != null)event.setLocation(location);
         return event;
     }
 
-    public javax.xml.stream.events.StartDocument createStartDocument(String encoding, String version) {
+    @Override
+    public StartDocument createStartDocument(String encoding, String version) {
         StartDocumentEvent event =  new StartDocumentEvent(encoding, version);
         if(location != null)event.setLocation(location);
         return event;
     }
 
-    public javax.xml.stream.events.StartDocument createStartDocument(String encoding, String version, boolean standalone) {
+    @Override
+    public StartDocument createStartDocument(String encoding, String version, boolean standalone) {
         StartDocumentEvent event =  new StartDocumentEvent(encoding, version, standalone);
         if(location != null)event.setLocation(location);
         return event;
     }
 
-    public javax.xml.stream.events.StartElement createStartElement(javax.xml.namespace.QName name, java.util.Iterator attributes, java.util.Iterator namespaces) {
-        return createStartElement(name.getPrefix(), name.getNamespaceURI(), name.getLocalPart(), attributes, namespaces);
+    @Override
+    public StartElement createStartElement(QName name, Iterator<? extends Attribute> attributes,
+            Iterator<? extends Namespace> namespaces) {
+        return createStartElement(name.getPrefix(), name.getNamespaceURI(),
+                name.getLocalPart(), attributes, namespaces);
     }
 
-    public javax.xml.stream.events.StartElement createStartElement(String prefix, String namespaceUri, String localName) {
+    @Override
+    public StartElement createStartElement(String prefix, String namespaceUri, String localName) {
         StartElementEvent event =  new StartElementEvent(prefix, namespaceUri, localName);
         if(location != null)event.setLocation(location);
         return event;
     }
 
-    public javax.xml.stream.events.StartElement createStartElement(String prefix, String namespaceUri, String localName, java.util.Iterator attributes, java.util.Iterator namespaces) {
+    @Override
+    public StartElement createStartElement(String prefix, String namespaceUri,
+            String localName, Iterator<? extends Attribute> attributes,
+            Iterator<? extends Namespace> namespaces) {
         return createStartElement(prefix, namespaceUri, localName, attributes, namespaces, null);
     }
 
-    public javax.xml.stream.events.StartElement createStartElement(String prefix, String namespaceUri, String localName, java.util.Iterator attributes, java.util.Iterator namespaces, javax.xml.namespace.NamespaceContext context) {
+    @Override
+    public StartElement createStartElement(String prefix, String namespaceUri,
+            String localName, Iterator<? extends Attribute> attributes,
+            Iterator<? extends Namespace> namespaces, NamespaceContext context) {
         StartElementEvent elem =  new StartElementEvent(prefix, namespaceUri, localName);
         elem.addAttributes(attributes);
         elem.addNamespaceAttributes(namespaces);
@@ -194,6 +237,7 @@
         return elem;
     }
 
+    @Override
     public void setLocation(javax.xml.stream.Location location) {
         this.location = location;
     }
--- a/jaxp/src/java.xml/share/classes/com/sun/xml/internal/stream/util/ReadOnlyIterator.java	Thu Dec 15 09:03:36 2016 +0100
+++ b/jaxp/src/java.xml/share/classes/com/sun/xml/internal/stream/util/ReadOnlyIterator.java	Thu Dec 15 13:57:04 2016 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -31,35 +31,32 @@
 
 import java.util.Iterator;
 
-public class ReadOnlyIterator implements Iterator {
+public class ReadOnlyIterator<T> implements Iterator<T> {
 
-    Iterator iterator = null;
+    Iterator<T> iterator = null;
 
     public ReadOnlyIterator(){
     }
 
-    public ReadOnlyIterator(Iterator itr){
+    public ReadOnlyIterator(Iterator<T> itr){
         iterator = itr;
     }
 
-    /**
-     * @return
-     */
+    @Override
     public boolean hasNext() {
         if(iterator  != null)
             return iterator.hasNext();
         return false;
     }
 
-    /**
-     * @return
-     */
-    public Object next() {
+    @Override
+    public T next() {
         if(iterator  != null)
             return iterator.next();
         return null;
     }
 
+    @Override
     public void remove() {
         throw new  UnsupportedOperationException("Remove operation is not supported");
     }
--- a/jaxp/src/java.xml/share/classes/com/sun/xml/internal/stream/util/ThreadLocalBufferAllocator.java	Thu Dec 15 09:03:36 2016 +0100
+++ b/jaxp/src/java.xml/share/classes/com/sun/xml/internal/stream/util/ThreadLocalBufferAllocator.java	Thu Dec 15 13:57:04 2016 -0800
@@ -39,15 +39,15 @@
  * @author Santiago.PericasGeertsen@sun.com
  */
 public class ThreadLocalBufferAllocator {
-   private static ThreadLocal tlba = new ThreadLocal();
+   private static ThreadLocal<SoftReference> tlba = new ThreadLocal<>();
 
    public static BufferAllocator getBufferAllocator() {
-        SoftReference bAllocatorRef = (SoftReference) tlba.get();
+        SoftReference<BufferAllocator> bAllocatorRef = tlba.get();
         if (bAllocatorRef == null || bAllocatorRef.get() == null) {
             bAllocatorRef = new SoftReference(new BufferAllocator());
             tlba.set(bAllocatorRef);
         }
 
-        return (BufferAllocator) bAllocatorRef.get();
+        return bAllocatorRef.get();
    }
 }
--- a/jaxp/src/java.xml/share/classes/com/sun/xml/internal/stream/writers/UTF8OutputStreamWriter.java	Thu Dec 15 09:03:36 2016 +0100
+++ b/jaxp/src/java.xml/share/classes/com/sun/xml/internal/stream/writers/UTF8OutputStreamWriter.java	Thu Dec 15 13:57:04 2016 -0800
@@ -89,7 +89,7 @@
         // Otherwise, encode char as defined in UTF-8
         if (c < 0x80) {
             // 1 byte, 7 bits
-            out.write((int) c);
+            out.write(c);
         }
         else if (c < 0x800) {
             // 2 bytes, 11 bits
--- a/jaxp/src/java.xml/share/classes/com/sun/xml/internal/stream/writers/XMLEventWriterImpl.java	Thu Dec 15 09:03:36 2016 +0100
+++ b/jaxp/src/java.xml/share/classes/com/sun/xml/internal/stream/writers/XMLEventWriterImpl.java	Thu Dec 15 13:57:04 2016 -0800
@@ -26,9 +26,12 @@
 package com.sun.xml.internal.stream.writers;
 
 import java.util.Iterator;
+import javax.xml.namespace.NamespaceContext;
 import javax.xml.namespace.QName;
+import javax.xml.stream.XMLEventReader;
 import javax.xml.stream.XMLEventWriter;
 import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
 import javax.xml.stream.events.Attribute;
 import javax.xml.stream.events.Characters;
 import javax.xml.stream.events.Comment;
@@ -39,24 +42,24 @@
 import javax.xml.stream.events.StartDocument;
 import javax.xml.stream.events.StartElement;
 import javax.xml.stream.events.XMLEvent;
-import javax.xml.stream.XMLStreamWriter;
 
 /**
  *
- * @author  Neeraj Bajaj, Sun Microsystems.
+ * @author Neeraj Bajaj, Sun Microsystems.
  *
  */
-public class XMLEventWriterImpl implements XMLEventWriter{
+public class XMLEventWriterImpl implements XMLEventWriter {
 
     //delegate everything to XMLStreamWriter..
-    private final XMLStreamWriterBase fStreamWriter ;
+    private final XMLStreamWriterBase fStreamWriter;
     private static final boolean DEBUG = false;
+
     /**
      *
      * @param streamWriter
      */
-    public XMLEventWriterImpl(XMLStreamWriter streamWriter){
-        fStreamWriter = (XMLStreamWriterBase)streamWriter;
+    public XMLEventWriterImpl(XMLStreamWriter streamWriter) {
+        fStreamWriter = (XMLStreamWriterBase) streamWriter;
     }
 
     /**
@@ -64,9 +67,11 @@
      * @param xMLEventReader
      * @throws XMLStreamException
      */
-    public void add(javax.xml.stream.XMLEventReader xMLEventReader) throws javax.xml.stream.XMLStreamException {
-        if(xMLEventReader == null) throw new XMLStreamException("Event reader shouldn't be null");
-        while(xMLEventReader.hasNext()){
+    public void add(XMLEventReader xMLEventReader) throws XMLStreamException {
+        if (xMLEventReader == null) {
+            throw new XMLStreamException("Event reader shouldn't be null");
+        }
+        while (xMLEventReader.hasNext()) {
             add(xMLEventReader.nextEvent());
         }
     }
@@ -76,101 +81,127 @@
      * @param xMLEvent
      * @throws XMLStreamException
      */
-    public void add(javax.xml.stream.events.XMLEvent xMLEvent) throws javax.xml.stream.XMLStreamException {
+    public void add(XMLEvent xMLEvent) throws XMLStreamException {
         int type = xMLEvent.getEventType();
-        switch(type){
-            case XMLEvent.DTD:{
-                DTD dtd = (DTD)xMLEvent ;
-                if (DEBUG)System.out.println("Adding DTD = " + dtd.toString());
+        switch (type) {
+            case XMLEvent.DTD: {
+                DTD dtd = (DTD) xMLEvent;
+                if (DEBUG) {
+                    System.out.println("Adding DTD = " + dtd.toString());
+                }
                 fStreamWriter.writeDTD(dtd.getDocumentTypeDeclaration());
                 break;
             }
-            case XMLEvent.START_DOCUMENT :{
-                StartDocument startDocument = (StartDocument)xMLEvent ;
-                if (DEBUG)System.out.println("Adding StartDocument = " + startDocument.toString());
+            case XMLEvent.START_DOCUMENT: {
+                StartDocument startDocument = (StartDocument) xMLEvent;
+                if (DEBUG) {
+                    System.out.println("Adding StartDocument = " + startDocument.toString());
+                }
                 try {
-                   fStreamWriter.writeStartDocument(startDocument.getCharacterEncodingScheme(), startDocument.getVersion(),
-                           startDocument.isStandalone(), startDocument.standaloneSet());
-                }catch(XMLStreamException e) {
+                    fStreamWriter.writeStartDocument(startDocument.getCharacterEncodingScheme(),
+                            startDocument.getVersion(),
+                            startDocument.isStandalone(), startDocument.standaloneSet());
+                } catch (XMLStreamException e) {
                     fStreamWriter.writeStartDocument(startDocument.getVersion());
                 }
                 break;
             }
-            case XMLEvent.START_ELEMENT :{
-                StartElement startElement = xMLEvent.asStartElement() ;
-                if (DEBUG)System.out.println("Adding startelement = " + startElement.toString());
+            case XMLEvent.START_ELEMENT: {
+                StartElement startElement = xMLEvent.asStartElement();
+                if (DEBUG) {
+                    System.out.println("Adding startelement = " + startElement.toString());
+                }
                 QName qname = startElement.getName();
-                fStreamWriter.writeStartElement(qname.getPrefix(), qname.getLocalPart(), qname.getNamespaceURI());
+                fStreamWriter.writeStartElement(qname.getPrefix(), qname.getLocalPart(),
+                        qname.getNamespaceURI());
 
-                //getNamespaces() Returns an Iterator of namespaces declared on this element. This Iterator does not contain
-                //previously declared namespaces unless they appear on the current START_ELEMENT. Therefore
-                //this list may contain redeclared namespaces and duplicate namespace declarations. Use the
-                //getNamespaceContext() method to get the current context of namespace declarations.
-
-                //so we should be using getNamespaces() to write namespace declarations for this START_ELEMENT
-                Iterator iterator = startElement.getNamespaces();
-                while(iterator.hasNext()){
-                    Namespace namespace = (Namespace)iterator.next();
+                /*
+                  getNamespaces() Returns an Iterator of namespaces declared on this element.
+                This Iterator does not contain previously declared namespaces unless they
+                appear on the current START_ELEMENT. Therefore this list may contain redeclared
+                namespaces and duplicate namespace declarations. Use the getNamespaceContext()
+                method to get the current context of namespace declarations. We should be
+                using getNamespaces() to write namespace declarations for this START_ELEMENT
+                */
+                Iterator<? extends Namespace> iterator = startElement.getNamespaces();
+                while (iterator.hasNext()) {
+                    Namespace namespace = iterator.next();
                     fStreamWriter.writeNamespace(namespace.getPrefix(), namespace.getNamespaceURI());
                 }
                 //REVISIT: What about writing attributes ?
-                Iterator attributes = startElement.getAttributes();
-                while(attributes.hasNext()){
-                    Attribute attribute = (Attribute)attributes.next();
+                Iterator<? extends Attribute> attributes = startElement.getAttributes();
+                while (attributes.hasNext()) {
+                    Attribute attribute = attributes.next();
                     QName aqname = attribute.getName();
-                    fStreamWriter.writeAttribute(aqname.getPrefix(), aqname.getNamespaceURI(), aqname.getLocalPart(),attribute.getValue());
+                    fStreamWriter.writeAttribute(aqname.getPrefix(), aqname.getNamespaceURI(),
+                            aqname.getLocalPart(), attribute.getValue());
                 }
                 break;
             }
-            case XMLEvent.NAMESPACE:{
-                Namespace namespace = (Namespace)xMLEvent;
-                if (DEBUG)System.out.println("Adding namespace = " + namespace.toString());
+            case XMLEvent.NAMESPACE: {
+                Namespace namespace = (Namespace) xMLEvent;
+                if (DEBUG) {
+                    System.out.println("Adding namespace = " + namespace.toString());
+                }
                 fStreamWriter.writeNamespace(namespace.getPrefix(), namespace.getNamespaceURI());
-                break ;
+                break;
             }
             case XMLEvent.COMMENT: {
-                Comment comment = (Comment)xMLEvent ;
-                if (DEBUG)System.out.println("Adding comment = " + comment.toString());
+                Comment comment = (Comment) xMLEvent;
+                if (DEBUG) {
+                    System.out.println("Adding comment = " + comment.toString());
+                }
                 fStreamWriter.writeComment(comment.getText());
                 break;
             }
-            case XMLEvent.PROCESSING_INSTRUCTION:{
-                ProcessingInstruction processingInstruction = (ProcessingInstruction)xMLEvent ;
-                if (DEBUG)System.out.println("Adding processing instruction = " + processingInstruction.toString());
-                fStreamWriter.writeProcessingInstruction(processingInstruction.getTarget(), processingInstruction.getData());
+            case XMLEvent.PROCESSING_INSTRUCTION: {
+                ProcessingInstruction processingInstruction = (ProcessingInstruction) xMLEvent;
+                if (DEBUG) {
+                    System.out.println("Adding processing instruction = " + processingInstruction.toString());
+                }
+                fStreamWriter.writeProcessingInstruction(processingInstruction.getTarget(),
+                        processingInstruction.getData());
                 break;
             }
-            case XMLEvent.CHARACTERS:{
+            case XMLEvent.CHARACTERS: {
                 Characters characters = xMLEvent.asCharacters();
-                if (DEBUG)System.out.println("Adding characters = " + characters.toString());
+                if (DEBUG) {
+                    System.out.println("Adding characters = " + characters.toString());
+                }
                 //check if the CHARACTERS are CDATA
-                if(characters.isCData()){
+                if (characters.isCData()) {
                     fStreamWriter.writeCData(characters.getData());
-                }
-                else{
+                } else {
                     fStreamWriter.writeCharacters(characters.getData());
                 }
                 break;
             }
-            case XMLEvent.ENTITY_REFERENCE:{
-                EntityReference entityReference = (EntityReference)xMLEvent ;
-                if (DEBUG)System.out.println("Adding Entity Reference = "+ entityReference.toString());
+            case XMLEvent.ENTITY_REFERENCE: {
+                EntityReference entityReference = (EntityReference) xMLEvent;
+                if (DEBUG) {
+                    System.out.println("Adding Entity Reference = " + entityReference.toString());
+                }
                 fStreamWriter.writeEntityRef(entityReference.getName());
                 break;
             }
-            case XMLEvent.ATTRIBUTE:{
-                Attribute attribute = (Attribute)xMLEvent;
-                if (DEBUG)System.out.println("Adding Attribute = " + attribute.toString());
+            case XMLEvent.ATTRIBUTE: {
+                Attribute attribute = (Attribute) xMLEvent;
+                if (DEBUG) {
+                    System.out.println("Adding Attribute = " + attribute.toString());
+                }
                 QName qname = attribute.getName();
-                fStreamWriter.writeAttribute(qname.getPrefix(), qname.getNamespaceURI(), qname.getLocalPart(),attribute.getValue());
+                fStreamWriter.writeAttribute(qname.getPrefix(), qname.getNamespaceURI(),
+                        qname.getLocalPart(), attribute.getValue());
                 break;
             }
-            case XMLEvent.CDATA:{
+            case XMLEvent.CDATA: {
                 //there is no separate CDATA datatype but CDATA event can be reported
                 //by using vendor specific CDATA property.
-                Characters characters = (Characters)xMLEvent;
-                if (DEBUG)System.out.println("Adding characters = " + characters.toString());
-                if(characters.isCData()){
+                Characters characters = (Characters) xMLEvent;
+                if (DEBUG) {
+                    System.out.println("Adding characters = " + characters.toString());
+                }
+                if (characters.isCData()) {
                     fStreamWriter.writeCData(characters.getData());
                 }
                 break;
@@ -179,15 +210,11 @@
             //case XMLEvent.NOTATION_DECLARATION:{
             //}
 
-            case XMLEvent.END_ELEMENT:{
-                //we dont need to typecast it.. just call writeEndElement() and fStreamWriter will take care of it.
-                //EndElement endElement = (EndElement)xMLEvent;
+            case XMLEvent.END_ELEMENT: {
                 fStreamWriter.writeEndElement();
                 break;
             }
-            case XMLEvent.END_DOCUMENT:{
-                //we dont need to typecast just call writeEndDocument() and fStreamWriter will take care rest.
-                //EndDocument endDocument = (EndDocument)xMLEvent;
+            case XMLEvent.END_DOCUMENT: {
                 fStreamWriter.writeEndDocument();
                 break;
             }
@@ -200,16 +227,16 @@
      *
      * @throws XMLStreamException
      */
-    public void close() throws javax.xml.stream.XMLStreamException {
+    public void close() throws XMLStreamException {
         fStreamWriter.close();
     }
 
     /**
      *
-     * @throws XMLStreamException will inturn call flush on the stream to which data is being
-     * written.
+     * @throws XMLStreamException will inturn call flush on the stream to which
+     * data is being written.
      */
-    public void flush() throws javax.xml.stream.XMLStreamException {
+    public void flush() throws XMLStreamException {
         fStreamWriter.flush();
     }
 
@@ -217,7 +244,7 @@
      *
      * @return
      */
-    public javax.xml.namespace.NamespaceContext getNamespaceContext() {
+    public NamespaceContext getNamespaceContext() {
         return fStreamWriter.getNamespaceContext();
     }
 
@@ -227,7 +254,7 @@
      * @throws XMLStreamException
      * @return prefix associated with the URI.
      */
-    public String getPrefix(String namespaceURI) throws javax.xml.stream.XMLStreamException {
+    public String getPrefix(String namespaceURI) throws XMLStreamException {
         return fStreamWriter.getPrefix(namespaceURI);
     }
 
@@ -236,7 +263,7 @@
      * @param uri Namespace URI
      * @throws XMLStreamException
      */
-    public void setDefaultNamespace(String uri) throws javax.xml.stream.XMLStreamException {
+    public void setDefaultNamespace(String uri) throws XMLStreamException {
         fStreamWriter.setDefaultNamespace(uri);
     }
 
@@ -245,7 +272,8 @@
      * @param namespaceContext Namespace Context
      * @throws XMLStreamException
      */
-    public void setNamespaceContext(javax.xml.namespace.NamespaceContext namespaceContext) throws javax.xml.stream.XMLStreamException {
+    public void setNamespaceContext(NamespaceContext namespaceContext)
+            throws XMLStreamException {
         fStreamWriter.setNamespaceContext(namespaceContext);
     }
 
@@ -255,7 +283,7 @@
      * @param uri Namespace URI
      * @throws XMLStreamException
      */
-    public void setPrefix(String prefix, String uri) throws javax.xml.stream.XMLStreamException {
+    public void setPrefix(String prefix, String uri) throws XMLStreamException {
         fStreamWriter.setPrefix(prefix, uri);
     }
 
--- a/jaxp/src/java.xml/share/classes/com/sun/xml/internal/stream/writers/XMLStreamWriterImpl.java	Thu Dec 15 09:03:36 2016 +0100
+++ b/jaxp/src/java.xml/share/classes/com/sun/xml/internal/stream/writers/XMLStreamWriterImpl.java	Thu Dec 15 13:57:04 2016 -0800
@@ -35,7 +35,6 @@
 import java.util.AbstractMap;
 import java.util.ArrayList;
 import java.util.HashMap;
-import java.util.Iterator;
 import java.util.Random;
 import java.util.Vector;
 import java.util.Set;
@@ -46,7 +45,6 @@
 import javax.xml.stream.XMLOutputFactory;
 import javax.xml.stream.XMLStreamConstants;
 import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamWriter;
 import javax.xml.transform.stream.StreamResult;
 
 import com.sun.org.apache.xerces.internal.impl.Constants;
@@ -71,7 +69,8 @@
  * @author Santiago.Pericas-Geertsen@sun.com
  * @author Sunitha.Reddy@sun.com
  */
-public final class XMLStreamWriterImpl extends AbstractMap implements XMLStreamWriterBase {
+public final class XMLStreamWriterImpl extends AbstractMap<Object, Object>
+        implements XMLStreamWriterBase {
 
     public static final String START_COMMENT = "<!--";
     public static final String END_COMMENT = "-->";
@@ -115,12 +114,12 @@
     /**
      * Collects attributes when the writer is in reparing mode.
      */
-    private ArrayList fAttributeCache;
+    private ArrayList<Attribute> fAttributeCache;
 
     /**
      * Collects namespace declarations when the writer is in reparing mode.
      */
-    private ArrayList fNamespaceDecls;
+    private ArrayList<QName> fNamespaceDecls;
 
     /**
      * Namespace context encapsulating user specified context
@@ -153,7 +152,7 @@
 
     final private String DEFAULT_PREFIX = fSymbolTable.addSymbol("");
 
-    private final ReadOnlyIterator fReadOnlyIterator = new ReadOnlyIterator();
+    private final ReadOnlyIterator<String> fReadOnlyIterator = new ReadOnlyIterator<>();
 
     /**
      * In some cases, this charset encoder is used to determine if a char is
@@ -168,7 +167,7 @@
      * the same uri as the default namespace; It's added to avoid changing the
      * current impl. which has many redundant code for the repair mode
      */
-    HashMap fAttrNamespace = null;
+    HashMap<String, String> fAttrNamespace = null;
 
     /**
      * Creates a new instance of XMLStreamWriterImpl. Uses platform's default
@@ -230,9 +229,9 @@
      */
     private void init() {
         fReuse = false;
-        fNamespaceDecls = new ArrayList();
+        fNamespaceDecls = new ArrayList<>();
         fPrefixGen = new Random();
-        fAttributeCache = new ArrayList();
+        fAttributeCache = new ArrayList<>();
         fInternalNamespaceContext = new NamespaceSupport();
         fInternalNamespaceContext.reset();
         fNamespaceContext = new NamespaceContextImpl();
@@ -240,9 +239,9 @@
 
         // Set internal state based on property values
         Boolean ob = (Boolean) fPropertyManager.getProperty(XMLOutputFactory.IS_REPAIRING_NAMESPACES);
-        fIsRepairingNamespace = ob.booleanValue();
+        fIsRepairingNamespace = ob;
         ob = (Boolean) fPropertyManager.getProperty(Constants.ESCAPE_CHARACTERS);
-        setEscapeCharacters(ob.booleanValue());
+        setEscapeCharacters(ob);
     }
 
     /**
@@ -279,9 +278,9 @@
 
         if (resetProperties) {
             Boolean ob = (Boolean) fPropertyManager.getProperty(XMLOutputFactory.IS_REPAIRING_NAMESPACES);
-            fIsRepairingNamespace = ob.booleanValue();
+            fIsRepairingNamespace = ob;
             ob = (Boolean) fPropertyManager.getProperty(Constants.ESCAPE_CHARACTERS);
-            setEscapeCharacters(ob.booleanValue());
+            setEscapeCharacters(ob);
         }
     }
 
@@ -369,6 +368,7 @@
     /**
      * Close this XMLStreamWriter by closing underlying writer.
      */
+    @Override
     public void close() throws XMLStreamException {
         if (fWriter != null) {
             try {
@@ -392,6 +392,7 @@
     /**
      * Flush this XMLStreamWriter by flushin underlying writer.
      */
+    @Override
     public void flush() throws XMLStreamException {
         try {
             fWriter.flush();
@@ -405,6 +406,7 @@
      *
      * @return NamespaceContext
      */
+    @Override
     public NamespaceContext getNamespaceContext() {
         return fNamespaceContext;
     }
@@ -416,6 +418,7 @@
      * @param  uri The namespace uri
      * @throws XMLStreamException if uri specified is "" or null
      */
+    @Override
     public String getPrefix(String uri) throws XMLStreamException {
         return fNamespaceContext.getPrefix(uri);
     }
@@ -427,6 +430,7 @@
      * @throws IllegalArgumentException if the specified property is not supported
      * @return value associated with the specified property.
      */
+    @Override
     public Object getProperty(String str)
         throws IllegalArgumentException {
         if (str == null) {
@@ -446,6 +450,7 @@
      *
      * @param uri Namespace URI
      */
+    @Override
     public void setDefaultNamespace(String uri) throws XMLStreamException {
         if (uri != null) {
             uri = fSymbolTable.addSymbol(uri);
@@ -479,6 +484,7 @@
      * @param namespaceContext the namespace context to use for this writer, may not be null
      * @throws XMLStreamException
      */
+    @Override
     public void setNamespaceContext(NamespaceContext namespaceContext)
         throws XMLStreamException {
         fNamespaceContext.userContext = namespaceContext;
@@ -493,6 +499,7 @@
      * @param uri
      * @throws XMLStreamException
      */
+    @Override
     public void setPrefix(String prefix, String uri) throws XMLStreamException {
 
         if (prefix == null) {
@@ -525,6 +532,7 @@
         fInternalNamespaceContext.declarePrefix(prefix, uri);
     }
 
+    @Override
     public void writeAttribute(String localName, String value)
         throws XMLStreamException {
         try {
@@ -554,6 +562,7 @@
         }
     }
 
+    @Override
     public void writeAttribute(String namespaceURI, String localName,
         String value) throws XMLStreamException {
         try {
@@ -590,7 +599,7 @@
         String value) throws IOException {
         fWriter.write(SPACE);
 
-        if ((prefix != null) && (prefix != XMLConstants.DEFAULT_NS_PREFIX)) {
+        if ((prefix != null) && (!prefix.equals(XMLConstants.DEFAULT_NS_PREFIX))) {
             fWriter.write(prefix);
             fWriter.write(":");
         }
@@ -603,6 +612,7 @@
         fWriter.write("\"");
     }
 
+    @Override
     public void writeAttribute(String prefix, String namespaceURI,
         String localName, String value) throws XMLStreamException {
         try {
@@ -629,7 +639,8 @@
                     }
                 }
 
-                if (!prefix.equals(XMLConstants.XML_NS_PREFIX) || !namespaceURI.equals(XMLConstants.XML_NS_URI)) {
+                if (!prefix.equals(XMLConstants.XML_NS_PREFIX) ||
+                        !namespaceURI.equals(XMLConstants.XML_NS_URI)) {
 
                     prefix = fSymbolTable.addSymbol(prefix);
                     namespaceURI = fSymbolTable.addSymbol(namespaceURI);
@@ -663,6 +674,7 @@
         }
     }
 
+    @Override
     public void writeCData(String cdata) throws XMLStreamException {
         try {
             if (cdata == null) {
@@ -681,6 +693,7 @@
         }
     }
 
+    @Override
     public void writeCharacters(String data) throws XMLStreamException {
         try {
             if (fStartTagOpened) {
@@ -693,6 +706,7 @@
         }
     }
 
+    @Override
     public void writeCharacters(char[] data, int start, int len)
         throws XMLStreamException {
         try {
@@ -706,6 +720,7 @@
         }
     }
 
+    @Override
     public void writeComment(String comment) throws XMLStreamException {
         try {
             if (fStartTagOpened) {
@@ -724,6 +739,7 @@
         }
     }
 
+    @Override
     public void writeDTD(String dtd) throws XMLStreamException {
         try {
             if (fStartTagOpened) {
@@ -750,11 +766,12 @@
      * @see <a href="http://www.w3.org/TR/REC-xml-names/#defaulting">
      *   Namespaces in XML, 5.2 Namespace Defaulting</a>
      */
+    @Override
     public void writeDefaultNamespace(String namespaceURI)
         throws XMLStreamException {
 
         // normalize namespaceURI
-        String namespaceURINormalized = null;
+        String namespaceURINormalized;
         if (namespaceURI == null) {
             namespaceURINormalized = ""; // XMLConstants.NULL_NS_URI
         } else {
@@ -782,7 +799,7 @@
 
                 String tmp = fInternalNamespaceContext.getURI("");
 
-                if (tmp != null && tmp != namespaceURINormalized) {
+                if (tmp != null && !tmp.equals(namespaceURINormalized)) {
                         throw new XMLStreamException(
                                 "xmlns has been already bound to " +tmp +
                                 ". Rebinding it to "+ namespaceURINormalized +
@@ -798,6 +815,7 @@
         }
     }
 
+    @Override
     public void writeEmptyElement(String localName) throws XMLStreamException {
         try {
             if (fStartTagOpened) {
@@ -816,6 +834,7 @@
         }
     }
 
+    @Override
     public void writeEmptyElement(String namespaceURI, String localName)
         throws XMLStreamException {
         if (namespaceURI == null) {
@@ -828,6 +847,7 @@
         writeEmptyElement(prefix, localName, namespaceURI);
     }
 
+    @Override
     public void writeEmptyElement(String prefix, String localName,
         String namespaceURI) throws XMLStreamException {
         try {
@@ -863,7 +883,7 @@
                 return;
             }
 
-            if ((prefix != null) && (prefix != XMLConstants.DEFAULT_NS_PREFIX)) {
+            if ((prefix != null) && (!prefix.equals(XMLConstants.DEFAULT_NS_PREFIX))) {
                 fWriter.write(prefix);
                 fWriter.write(":");
             }
@@ -874,16 +894,15 @@
         }
     }
 
+    @Override
     public void writeEndDocument() throws XMLStreamException {
         try {
             if (fStartTagOpened) {
                 closeStartTag();
             }
 
-            ElementState elem = null;
-
             while (!fElementStack.empty()) {
-                elem = (ElementState) fElementStack.pop();
+                ElementState elem = fElementStack.pop();
                 fInternalNamespaceContext.popContext();
 
                 if (elem.isEmpty) {
@@ -907,13 +926,14 @@
         }
     }
 
+    @Override
     public void writeEndElement() throws XMLStreamException {
         try {
             if (fStartTagOpened) {
                 closeStartTag();
             }
 
-            ElementState currentElement = (ElementState) fElementStack.pop();
+            ElementState currentElement = fElementStack.pop();
 
             if (currentElement == null) {
                 throw new XMLStreamException("No element was found to write");
@@ -944,6 +964,7 @@
         }
     }
 
+    @Override
     public void writeEntityRef(String refName) throws XMLStreamException {
         try {
             if (fStartTagOpened) {
@@ -973,11 +994,12 @@
      * @see <a href="http://www.w3.org/TR/REC-xml-names/#defaulting">
      *   Namespaces in XML, 5.2 Namespace Defaulting</a>
      */
+    @Override
     public void writeNamespace(String prefix, String namespaceURI)
         throws XMLStreamException {
 
         // normalize namespaceURI
-        String namespaceURINormalized = null;
+        String namespaceURINormalized;
         if (namespaceURI == null) {
             namespaceURINormalized = ""; // XMLConstants.NULL_NS_URI
         } else {
@@ -985,7 +1007,7 @@
         }
 
         try {
-            QName qname = null;
+            QName qname;
 
             if (!fStartTagOpened) {
                 throw new IllegalStateException(
@@ -1013,7 +1035,7 @@
             if (fIsRepairingNamespace) {
                 String tmpURI = fInternalNamespaceContext.getURI(prefix);
 
-                if ((tmpURI != null) && (tmpURI == namespaceURINormalized)) {
+                if ((tmpURI != null) && (tmpURI.equals(namespaceURINormalized))) {
                     return;
                 }
 
@@ -1030,7 +1052,7 @@
 
                 String tmp = fInternalNamespaceContext.getURI(prefix);
 
-                if (tmp != null && tmp != namespaceURINormalized) {
+                if (tmp != null && !tmp.equals(namespaceURINormalized)) {
 
                        throw new XMLStreamException("prefix "+prefix+
                             " has been already bound to " +tmp +
@@ -1051,7 +1073,7 @@
         throws IOException {
         fWriter.write(" xmlns");
 
-        if ((prefix != null) && (prefix != XMLConstants.DEFAULT_NS_PREFIX)) {
+        if ((prefix != null) && (!prefix.equals(XMLConstants.DEFAULT_NS_PREFIX))) {
             fWriter.write(":");
             fWriter.write(prefix);
         }
@@ -1064,6 +1086,7 @@
         fWriter.write("\"");
     }
 
+    @Override
     public void writeProcessingInstruction(String target)
         throws XMLStreamException {
         try {
@@ -1090,6 +1113,7 @@
      * @param data
      * @throws XMLStreamException
      */
+    @Override
     public void writeProcessingInstruction(String target, String data)
         throws XMLStreamException {
         try {
@@ -1116,6 +1140,7 @@
      *
      * @throws XMLStreamException in case of an IOException
      */
+    @Override
     public void writeStartDocument() throws XMLStreamException {
         writeStartDocument(null, null, false, false);
     }
@@ -1126,6 +1151,7 @@
      * @param version the specified version
      * @throws XMLStreamException in case of an IOException
      */
+    @Override
     public void writeStartDocument(String version) throws XMLStreamException {
         writeStartDocument(null, version, false, false);
     }
@@ -1143,7 +1169,6 @@
         writeStartDocument(encoding, version, false, false);
     }
 
-    @Override
     public void writeStartDocument(String encoding, String version,
             boolean standalone, boolean standaloneSet)
         throws XMLStreamException {
@@ -1212,9 +1237,9 @@
         if (streamEncoding != null && !streamEncoding.equalsIgnoreCase(encoding)) {
             // If the equality check failed, check for charset encoding aliases
             boolean foundAlias = false;
-            Set aliases = Charset.forName(encoding).aliases();
-            for (Iterator it = aliases.iterator(); !foundAlias && it.hasNext(); ) {
-                if (streamEncoding.equalsIgnoreCase((String) it.next())) {
+            Set<String> aliases = Charset.forName(encoding).aliases();
+            for (Iterator<String> it = aliases.iterator(); !foundAlias && it.hasNext(); ) {
+                if (streamEncoding.equalsIgnoreCase(it.next())) {
                     foundAlias = true;
                 }
             }
@@ -1232,6 +1257,7 @@
      * @param localName
      * @throws XMLStreamException
      */
+    @Override
     public void writeStartElement(String localName) throws XMLStreamException {
         try {
             if (localName == null) {
@@ -1261,6 +1287,7 @@
      * @param localName
      * @throws XMLStreamException
      */
+    @Override
     public void writeStartElement(String namespaceURI, String localName)
         throws XMLStreamException {
         if (localName == null) {
@@ -1292,6 +1319,7 @@
      * @param namespaceURI
      * @throws XMLStreamException
      */
+    @Override
     public void writeStartElement(String prefix, String localName,
         String namespaceURI) throws XMLStreamException {
         try {
@@ -1537,10 +1565,10 @@
                 fWriter.write(currentElement.localpart);
 
                 int len = fNamespaceDecls.size();
-                QName qname = null;
+                QName qname;
 
                 for (int i = 0; i < len; i++) {
-                    qname = (QName) fNamespaceDecls.get(i);
+                    qname = fNamespaceDecls.get(i);
 
                     if (qname != null) {
                         if (fInternalNamespaceContext.declarePrefix(qname.prefix,
@@ -1552,16 +1580,16 @@
 
                 fNamespaceDecls.clear();
 
-                Attribute attr = null;
+                Attribute attr;
 
                 for (int j = 0; j < fAttributeCache.size(); j++) {
-                    attr = (Attribute) fAttributeCache.get(j);
+                    attr = fAttributeCache.get(j);
 
                     if ((attr.prefix != null) && (attr.uri != null)) {
                         if (!attr.prefix.equals("") && !attr.uri.equals("") ) {
                             String tmp = fInternalNamespaceContext.getPrefix(attr.uri);
 
-                            if ((tmp == null) || (tmp != attr.prefix)) {
+                            if ((tmp == null) || (!tmp.equals(attr.prefix))) {
                                 tmp = getAttrPrefix(attr.uri);
                                 if (tmp == null) {
                                     if (fInternalNamespaceContext.declarePrefix(attr.prefix,
@@ -1611,29 +1639,29 @@
      * @return
      */
     private void correctPrefix(QName attr, int type) {
-        String tmpPrefix = null;
+        String tmpPrefix;
         String prefix;
         String uri;
         prefix = attr.prefix;
         uri = attr.uri;
         boolean isSpecialCaseURI = false;
 
-        if (prefix == null || prefix.equals("")) {
+        if (prefix == null || prefix.equals(XMLConstants.DEFAULT_NS_PREFIX)) {
             if (uri == null) {
                 return;
             }
 
-            if (prefix == XMLConstants.DEFAULT_NS_PREFIX && uri == XMLConstants.DEFAULT_NS_PREFIX)
+            if (XMLConstants.DEFAULT_NS_PREFIX.equals(prefix) && uri.equals(XMLConstants.DEFAULT_NS_PREFIX))
                 return;
 
             uri = fSymbolTable.addSymbol(uri);
 
-            QName decl = null;
+            QName decl;
 
             for (int i = 0; i < fNamespaceDecls.size(); i++) {
-                decl = (QName) fNamespaceDecls.get(i);
+                decl = fNamespaceDecls.get(i);
 
-                if ((decl != null) && (decl.uri == attr.uri)) {
+                if ((decl != null) && (decl.uri.equals(attr.uri))) {
                     attr.prefix = decl.prefix;
 
                     return;
@@ -1642,7 +1670,7 @@
 
             tmpPrefix = fNamespaceContext.getPrefix(uri);
 
-            if (tmpPrefix == XMLConstants.DEFAULT_NS_PREFIX) {
+            if (XMLConstants.DEFAULT_NS_PREFIX.equals(tmpPrefix)) {
                 if (type == XMLStreamConstants.START_ELEMENT) {
                     return;
                 }
@@ -1654,7 +1682,7 @@
             }
 
             if (tmpPrefix == null) {
-                StringBuffer genPrefix = new StringBuffer("zdef");
+                StringBuilder genPrefix = new StringBuilder("zdef");
 
                 for (int i = 0; i < 1; i++) {
                     genPrefix.append(fPrefixGen.nextInt());
@@ -1687,13 +1715,13 @@
      */
     private String getAttrPrefix(String uri) {
         if (fAttrNamespace != null) {
-            return (String)fAttrNamespace.get(uri);
+            return fAttrNamespace.get(uri);
         }
         return null;
     }
     private void addAttrNamespace(String prefix, String uri) {
         if (fAttrNamespace == null) {
-            fAttrNamespace = new HashMap();
+            fAttrNamespace = new HashMap<>();
         }
         fAttrNamespace.put(prefix, uri);
     }
@@ -1704,7 +1732,7 @@
     private boolean isDefaultNamespace(String uri) {
         String defaultNamespace = fInternalNamespaceContext.getURI(DEFAULT_PREFIX);
 
-        if (uri == defaultNamespace) {
+        if (uri.equals(defaultNamespace)) {
             return true;
         }
 
@@ -1732,13 +1760,13 @@
      * Correct's namespaces  as per requirements of isReparisingNamespace property.
      */
     protected void repair() {
-        Attribute attr = null;
-        Attribute attr2 = null;
+        Attribute attr;
+        Attribute attr2;
         ElementState currentElement = fElementStack.peek();
         removeDuplicateDecls();
 
         for(int i=0 ; i< fAttributeCache.size();i++){
-            attr = (Attribute)fAttributeCache.get(i);
+            attr = fAttributeCache.get(i);
             if((attr.prefix != null && !attr.prefix.equals("")) || (attr.uri != null && !attr.uri.equals(""))) {
                 correctPrefix(currentElement,attr);
             }
@@ -1754,9 +1782,9 @@
         }
 
         for(int i=0 ; i< fAttributeCache.size();i++){
-            attr = (Attribute)fAttributeCache.get(i);
+            attr = fAttributeCache.get(i);
             for(int j=i+1;j<fAttributeCache.size();j++){
-                attr2 = (Attribute)fAttributeCache.get(j);
+                attr2 = fAttributeCache.get(j);
                 if(!"".equals(attr.prefix)&& !"".equals(attr2.prefix)){
                     correctPrefix(attr,attr2);
                 }
@@ -1765,10 +1793,10 @@
 
         repairNamespaceDecl(currentElement);
 
-        int i = 0;
+        int i;
 
         for (i = 0; i < fAttributeCache.size(); i++) {
-            attr = (Attribute) fAttributeCache.get(i);
+            attr = fAttributeCache.get(i);
             /* If 'attr' is an attribute and it is in no namespace(which means that prefix="", uri=""), attr's
                namespace should not be redinded. See [http://www.w3.org/TR/REC-xml-names/#defaulting].
              */
@@ -1780,7 +1808,7 @@
         QName qname = null;
 
         for (i = 0; i < fNamespaceDecls.size(); i++) {
-            qname = (QName) fNamespaceDecls.get(i);
+            qname = fNamespaceDecls.get(i);
 
             if (qname != null) {
                 fInternalNamespaceContext.declarePrefix(qname.prefix, qname.uri);
@@ -1788,7 +1816,7 @@
         }
 
         for (i = 0; i < fAttributeCache.size(); i++) {
-            attr = (Attribute) fAttributeCache.get(i);
+            attr = fAttributeCache.get(i);
             correctPrefix(attr, XMLStreamConstants.ATTRIBUTE);
         }
     }
@@ -1801,9 +1829,8 @@
      *that is bound to the namespace URIs of those attributes.
      */
     void correctPrefix(QName attr1, QName attr2) {
-        String tmpPrefix = null;
-        QName decl = null;
-        boolean done = false;
+        String tmpPrefix;
+        QName decl;
 
         checkForNull(attr1);
         checkForNull(attr2);
@@ -1815,10 +1842,9 @@
             if (tmpPrefix != null) {
                 attr2.prefix = fSymbolTable.addSymbol(tmpPrefix);
             } else {
-                decl = null;
-                for(int n=0;n<fNamespaceDecls.size();n++){
-                    decl = (QName)fNamespaceDecls.get(n);
-                    if(decl != null && (decl.uri == attr2.uri)){
+                for (int n=0; n<fNamespaceDecls.size(); n++) {
+                    decl = fNamespaceDecls.get(n);
+                    if(decl != null && (decl.uri.equals(attr2.uri))){
                         attr2.prefix = decl.prefix;
 
                         return;
@@ -1826,7 +1852,7 @@
                 }
 
                 //No namespace mapping found , so declare prefix.
-                StringBuffer genPrefix = new StringBuffer("zdef");
+                StringBuilder genPrefix = new StringBuilder("zdef");
 
                 for (int k = 0; k < 1; k++) {
                     genPrefix.append(fPrefixGen.nextInt());
@@ -1851,11 +1877,11 @@
 
     void removeDuplicateDecls(){
         QName decl1,decl2;
-        for(int i =0;i<fNamespaceDecls.size();i++){
-            decl1 = (QName)fNamespaceDecls.get(i);
+        for(int i =0; i<fNamespaceDecls.size(); i++) {
+            decl1 = fNamespaceDecls.get(i);
             if(decl1!=null) {
                 for(int j=i+1;j<fNamespaceDecls.size();j++){
-                    decl2 = (QName)fNamespaceDecls.get(j);
+                    decl2 = fNamespaceDecls.get(j);
                     // QName.equals relies on identity equality, so we can't use it,
                     // because prefixes aren't interned
                     if(decl2!=null && decl1.prefix.equals(decl2.prefix) && decl1.uri.equals(decl2.uri))
@@ -1873,12 +1899,12 @@
      *
      */
     void repairNamespaceDecl(QName attr) {
-        QName decl = null;
+        QName decl;
         String tmpURI;
 
         //check for null prefix.
         for (int j = 0; j < fNamespaceDecls.size(); j++) {
-            decl = (QName) fNamespaceDecls.get(j);
+            decl = fNamespaceDecls.get(j);
 
             if (decl != null) {
                 if ((attr.prefix != null) &&
@@ -1900,13 +1926,13 @@
     }
 
     boolean isDeclared(QName attr) {
-        QName decl = null;
+        QName decl;
 
         for (int n = 0; n < fNamespaceDecls.size(); n++) {
-            decl = (QName) fNamespaceDecls.get(n);
+            decl = fNamespaceDecls.get(n);
 
             if ((attr.prefix != null) &&
-                    ((attr.prefix == decl.prefix) && (decl.uri == attr.uri))) {
+                    ((attr.prefix.equals(decl.prefix)) && (decl.uri.equals(attr.uri)))) {
                 return true;
             }
         }
@@ -2121,9 +2147,10 @@
             return null;
         }
 
-        public java.util.Iterator getPrefixes(String uri) {
+        //Cleanup note: leaving these warnings to a xerces.internal.util cleanup
+        public Iterator<String> getPrefixes(String uri) {
             Vector prefixes = null;
-            Iterator itr = null;
+            Iterator<String> itr = null;
 
             if (uri != null) {
                 uri = fSymbolTable.addSymbol(uri);
@@ -2140,12 +2167,12 @@
             if ((prefixes == null) && (itr != null)) {
                 return itr;
             } else if ((prefixes != null) && (itr == null)) {
-                return new ReadOnlyIterator(prefixes.iterator());
+                return new ReadOnlyIterator<>(prefixes.iterator());
             } else if ((prefixes != null) && (itr != null)) {
                 String ob = null;
 
                 while (itr.hasNext()) {
-                    ob = (String) itr.next();
+                    ob = itr.next();
 
                     if (ob != null) {
                         ob = fSymbolTable.addSymbol(ob);
@@ -2156,7 +2183,7 @@
                     }
                 }
 
-                return new ReadOnlyIterator(prefixes.iterator());
+                return new ReadOnlyIterator<>(prefixes.iterator());
             }
 
             return fReadOnlyIterator;
@@ -2165,14 +2192,17 @@
 
     // -- Map Interface --------------------------------------------------
 
+    @Override
     public int size() {
         return 1;
     }
 
+    @Override
     public boolean isEmpty() {
         return false;
     }
 
+    @Override
     public boolean containsKey(Object key) {
         return key.equals(OUTPUTSTREAM_PROPERTY);
     }
@@ -2181,6 +2211,7 @@
      * Returns the value associated to an implementation-specific
      * property.
      */
+    @Override
     public Object get(Object key) {
         if (key.equals(OUTPUTSTREAM_PROPERTY)) {
             return fOutputStream;
@@ -2188,7 +2219,8 @@
         return null;
     }
 
-    public java.util.Set entrySet() {
+    @Override
+    public Set<Entry<Object,Object>> entrySet() {
         throw new UnsupportedOperationException();
     }
 
@@ -2198,6 +2230,7 @@
      * AbstractMap would cause an unsupported exection to
      * be thrown.
      */
+    @Override
     public String toString() {
         return getClass().getName() + "@" + Integer.toHexString(hashCode());
     }
@@ -2206,6 +2239,7 @@
      * Overrides the method defined in AbstractMap
      * This is required by the toString() method
      */
+    @Override
     public int hashCode() {
         return fElementStack.hashCode();
     }
@@ -2213,6 +2247,7 @@
      * Overrides the method defined in AbstractMap
      * This is required to satisfy the contract for hashCode.
      */
+    @Override
     public boolean equals(Object obj) {
         return (this == obj);
     }
--- a/jaxp/src/java.xml/share/classes/javax/xml/stream/EventFilter.java	Thu Dec 15 09:03:36 2016 +0100
+++ b/jaxp/src/java.xml/share/classes/javax/xml/stream/EventFilter.java	Thu Dec 15 13:57:04 2016 -0800
@@ -1,4 +1,5 @@
 /*
+ * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,10 +23,6 @@
  * questions.
  */
 
-/*
- * Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
- */
-
 package javax.xml.stream;
 
 import javax.xml.stream.events.XMLEvent;
--- a/jaxp/src/java.xml/share/classes/javax/xml/stream/FactoryConfigurationError.java	Thu Dec 15 09:03:36 2016 +0100
+++ b/jaxp/src/java.xml/share/classes/javax/xml/stream/FactoryConfigurationError.java	Thu Dec 15 13:57:04 2016 -0800
@@ -1,4 +1,5 @@
 /*
+ * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,9 +23,6 @@
  * questions.
  */
 
-/*
- * Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
- */
 
 package javax.xml.stream;
 
--- a/jaxp/src/java.xml/share/classes/javax/xml/stream/Location.java	Thu Dec 15 09:03:36 2016 +0100
+++ b/jaxp/src/java.xml/share/classes/javax/xml/stream/Location.java	Thu Dec 15 13:57:04 2016 -0800
@@ -1,4 +1,5 @@
 /*
+ * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,10 +23,6 @@
  * questions.
  */
 
-/*
- * Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
- */
-
 package javax.xml.stream;
 
 /**
--- a/jaxp/src/java.xml/share/classes/javax/xml/stream/SecuritySupport.java	Thu Dec 15 09:03:36 2016 +0100
+++ b/jaxp/src/java.xml/share/classes/javax/xml/stream/SecuritySupport.java	Thu Dec 15 13:57:04 2016 -0800
@@ -39,53 +39,34 @@
 
 
     ClassLoader getContextClassLoader() throws SecurityException{
-        return (ClassLoader)
-                AccessController.doPrivileged(new PrivilegedAction() {
-            public Object run() {
-                ClassLoader cl = null;
-                //try {
-                cl = Thread.currentThread().getContextClassLoader();
-                //} catch (SecurityException ex) { }
+        return AccessController.doPrivileged((PrivilegedAction<ClassLoader>) () -> {
+            ClassLoader cl = Thread.currentThread().getContextClassLoader();
 
-                if (cl == null)
-                    cl = ClassLoader.getSystemClassLoader();
+            if (cl == null)
+                cl = ClassLoader.getSystemClassLoader();
 
-                return cl;
-            }
+            return cl;
         });
     }
 
     String getSystemProperty(final String propName) {
-        return (String)
-            AccessController.doPrivileged(new PrivilegedAction() {
-                public Object run() {
-                    return System.getProperty(propName);
-                }
-            });
+        return AccessController.doPrivileged((PrivilegedAction<String>) () ->
+                System.getProperty(propName));
     }
 
     FileInputStream getFileInputStream(final File file)
         throws FileNotFoundException
     {
         try {
-            return (FileInputStream)
-                AccessController.doPrivileged(new PrivilegedExceptionAction() {
-                    public Object run() throws FileNotFoundException {
-                        return new FileInputStream(file);
-                    }
-                });
+            return AccessController.doPrivileged((PrivilegedExceptionAction<FileInputStream>) ()
+                    -> new FileInputStream(file));
         } catch (PrivilegedActionException e) {
             throw (FileNotFoundException)e.getException();
         }
     }
 
     boolean doesFileExist(final File f) {
-    return ((Boolean)
-            AccessController.doPrivileged(new PrivilegedAction() {
-                public Object run() {
-                    return new Boolean(f.exists());
-                }
-            })).booleanValue();
+        return AccessController.doPrivileged((PrivilegedAction<Boolean>) () -> f.exists());
     }
 
 }
--- a/jaxp/src/java.xml/share/classes/javax/xml/stream/StreamFilter.java	Thu Dec 15 09:03:36 2016 +0100
+++ b/jaxp/src/java.xml/share/classes/javax/xml/stream/StreamFilter.java	Thu Dec 15 13:57:04 2016 -0800
@@ -1,4 +1,5 @@
 /*
+ * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,10 +23,6 @@
  * questions.
  */
 
-/*
- * Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
- */
-
 package javax.xml.stream;
 
 /**
--- a/jaxp/src/java.xml/share/classes/javax/xml/stream/XMLEventFactory.java	Thu Dec 15 09:03:36 2016 +0100
+++ b/jaxp/src/java.xml/share/classes/javax/xml/stream/XMLEventFactory.java	Thu Dec 15 13:57:04 2016 -0800
@@ -1,4 +1,5 @@
 /*
+ * Copyright (c) 2009, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,10 +23,6 @@
  * questions.
  */
 
-/*
- * Copyright (c) 2009, 2015, by Oracle Corporation. All Rights Reserved.
- */
-
 package javax.xml.stream;
 import com.sun.xml.internal.stream.events.XMLEventFactoryImpl;
 import java.util.Iterator;
@@ -53,8 +50,7 @@
     static final String JAXPFACTORYID = "javax.xml.stream.XMLEventFactory";
     static final String DEFAULIMPL = "com.sun.xml.internal.stream.events.XMLEventFactoryImpl";
 
-
-  /**
+   /**
    * Creates a new instance of the {@code XMLEventFactory} builtin
    * system-default implementation.
    *
@@ -159,6 +155,7 @@
    *              #newFactory(java.lang.String, java.lang.ClassLoader)}
    *              method defines no changes in behavior.
    */
+  @Deprecated(since="7")
   public static XMLEventFactory newInstance(String factoryId,
           ClassLoader classLoader)
           throws FactoryConfigurationError {
@@ -307,8 +304,8 @@
    * @return an instance of the requested StartElement
    */
   public abstract StartElement createStartElement(QName name,
-                                                  Iterator attributes,
-                                                  Iterator namespaces);
+                                                  Iterator<? extends Attribute> attributes,
+                                                  Iterator<? extends Namespace> namespaces);
 
   /**
    * Create a new StartElement.  This defaults the NamespaceContext to
@@ -341,8 +338,8 @@
   public abstract StartElement createStartElement(String prefix,
                                                   String namespaceUri,
                                                   String localName,
-                                                  Iterator attributes,
-                                                  Iterator namespaces
+                                                  Iterator<? extends Attribute> attributes,
+                                                  Iterator<? extends Namespace> namespaces
                                                   );
   /**
    * Create a new StartElement.  Namespaces can be added to this StartElement
@@ -363,8 +360,8 @@
   public abstract StartElement createStartElement(String prefix,
                                                   String namespaceUri,
                                                   String localName,
-                                                  Iterator attributes,
-                                                  Iterator namespaces,
+                                                  Iterator<? extends Attribute> attributes,
+                                                  Iterator<? extends Namespace> namespaces,
                                                   NamespaceContext context
                                                   );
 
@@ -376,7 +373,7 @@
    * @return an instance of the requested EndElement
    */
   public abstract EndElement createEndElement(QName name,
-                                              Iterator namespaces);
+                                              Iterator<? extends Namespace> namespaces);
 
   /**
    * Create a new EndElement
@@ -400,7 +397,7 @@
   public abstract EndElement createEndElement(String prefix,
                                               String namespaceUri,
                                               String localName,
-                                              Iterator namespaces);
+                                              Iterator<? extends Namespace> namespaces);
 
   /**
    * Create a Characters event, this method does not check if the content
--- a/jaxp/src/java.xml/share/classes/javax/xml/stream/XMLEventReader.java	Thu Dec 15 09:03:36 2016 +0100
+++ b/jaxp/src/java.xml/share/classes/javax/xml/stream/XMLEventReader.java	Thu Dec 15 13:57:04 2016 -0800
@@ -1,4 +1,5 @@
 /*
+ * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,10 +23,6 @@
  * questions.
  */
 
-/*
- * Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
- */
-
 package javax.xml.stream;
 
 import javax.xml.stream.events.XMLEvent;
@@ -44,7 +41,7 @@
  * @see XMLEventWriter
  * @since 1.6
  */
-public interface XMLEventReader extends Iterator {
+public interface XMLEventReader extends Iterator<Object> {
   /**
    * Gets the next XMLEvent. The initial event is
    * {@link javax.xml.stream.events.StartDocument StartDocument}.
--- a/jaxp/src/java.xml/share/classes/javax/xml/stream/XMLEventWriter.java	Thu Dec 15 09:03:36 2016 +0100
+++ b/jaxp/src/java.xml/share/classes/javax/xml/stream/XMLEventWriter.java	Thu Dec 15 13:57:04 2016 -0800
@@ -1,4 +1,5 @@
 /*
+ * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,10 +23,6 @@
  * questions.
  */
 
-/*
- * Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
- */
-
 package javax.xml.stream;
 
 import javax.xml.stream.events.*;
--- a/jaxp/src/java.xml/share/classes/javax/xml/stream/XMLInputFactory.java	Thu Dec 15 09:03:36 2016 +0100
+++ b/jaxp/src/java.xml/share/classes/javax/xml/stream/XMLInputFactory.java	Thu Dec 15 13:57:04 2016 -0800
@@ -1,4 +1,5 @@
 /*
+ * Copyright (c) 2009, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,10 +23,6 @@
  * questions.
  */
 
-/*
- * Copyright (c) 2009, 2013, by Oracle Corporation. All Rights Reserved.
- */
-
 package javax.xml.stream;
 
 import com.sun.xml.internal.stream.XMLInputFactoryImpl;
@@ -225,6 +222,7 @@
    *   java.util.ServiceConfigurationError service configuration error} or if
    *   the implementation is not available or cannot be instantiated.
    */
+  @Deprecated(since="7")
   public static XMLInputFactory newFactory()
     throws FactoryConfigurationError
   {
@@ -246,6 +244,7 @@
    *              #newFactory(java.lang.String, java.lang.ClassLoader)} method
    *              defines no changes in behavior.
    */
+  @Deprecated(since="7")
   public static XMLInputFactory newInstance(String factoryId,
           ClassLoader classLoader)
           throws FactoryConfigurationError {
--- a/jaxp/src/java.xml/share/classes/javax/xml/stream/XMLOutputFactory.java	Thu Dec 15 09:03:36 2016 +0100
+++ b/jaxp/src/java.xml/share/classes/javax/xml/stream/XMLOutputFactory.java	Thu Dec 15 13:57:04 2016 -0800
@@ -1,4 +1,5 @@
 /*
+ * Copyright (c) 2009, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,10 +23,6 @@
  * questions.
  */
 
-/*
- * Copyright (c) 2009, 2013, by Oracle Corporation. All Rights Reserved.
- */
-
 package javax.xml.stream;
 
 import com.sun.xml.internal.stream.XMLOutputFactoryImpl;
@@ -121,7 +118,7 @@
 
   protected XMLOutputFactory(){}
 
-  /**
+   /**
    * Creates a new instance of the {@code XMLOutputFactory} builtin
    * system-default implementation.
    *
@@ -225,6 +222,7 @@
    *              Use the new method {@link #newFactory(java.lang.String,
    *              java.lang.ClassLoader)} instead.
    */
+  @Deprecated(since="7")
   public static XMLInputFactory newInstance(String factoryId,
           ClassLoader classLoader)
           throws FactoryConfigurationError {
--- a/jaxp/src/java.xml/share/classes/javax/xml/stream/XMLReporter.java	Thu Dec 15 09:03:36 2016 +0100
+++ b/jaxp/src/java.xml/share/classes/javax/xml/stream/XMLReporter.java	Thu Dec 15 13:57:04 2016 -0800
@@ -1,4 +1,5 @@
 /*
+ * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,10 +23,6 @@
  * questions.
  */
 
-/*
- * Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
- */
-
 package javax.xml.stream;
 
 /**
--- a/jaxp/src/java.xml/share/classes/javax/xml/stream/XMLResolver.java	Thu Dec 15 09:03:36 2016 +0100
+++ b/jaxp/src/java.xml/share/classes/javax/xml/stream/XMLResolver.java	Thu Dec 15 13:57:04 2016 -0800
@@ -1,4 +1,5 @@
 /*
+ * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,10 +23,6 @@
  * questions.
  */
 
-/*
- * Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
- */
-
 package javax.xml.stream;
 
 /**
--- a/jaxp/src/java.xml/share/classes/javax/xml/stream/XMLStreamConstants.java	Thu Dec 15 09:03:36 2016 +0100
+++ b/jaxp/src/java.xml/share/classes/javax/xml/stream/XMLStreamConstants.java	Thu Dec 15 13:57:04 2016 -0800
@@ -1,4 +1,5 @@
 /*
+ * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/jaxp/src/java.xml/share/classes/javax/xml/stream/XMLStreamException.java	Thu Dec 15 09:03:36 2016 +0100
+++ b/jaxp/src/java.xml/share/classes/javax/xml/stream/XMLStreamException.java	Thu Dec 15 13:57:04 2016 -0800
@@ -1,4 +1,5 @@
 /*
+ * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,10 +23,6 @@
  * questions.
  */
 
-/*
- * Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
- */
-
 package javax.xml.stream;
 
 /**
--- a/jaxp/src/java.xml/share/classes/javax/xml/stream/XMLStreamReader.java	Thu Dec 15 09:03:36 2016 +0100
+++ b/jaxp/src/java.xml/share/classes/javax/xml/stream/XMLStreamReader.java	Thu Dec 15 13:57:04 2016 -0800
@@ -1,4 +1,5 @@
 /*
+ * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,10 +23,6 @@
  * questions.
  */
 
-/*
- * Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
- */
-
 package javax.xml.stream;
 
 import javax.xml.namespace.NamespaceContext;
--- a/jaxp/src/java.xml/share/classes/javax/xml/stream/XMLStreamWriter.java	Thu Dec 15 09:03:36 2016 +0100
+++ b/jaxp/src/java.xml/share/classes/javax/xml/stream/XMLStreamWriter.java	Thu Dec 15 13:57:04 2016 -0800
@@ -1,4 +1,5 @@
 /*
+ * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,10 +23,6 @@
  * questions.
  */
 
-/*
- * Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
- */
-
 package javax.xml.stream;
 
 import javax.xml.namespace.NamespaceContext;
--- a/jaxp/src/java.xml/share/classes/javax/xml/stream/events/Attribute.java	Thu Dec 15 09:03:36 2016 +0100
+++ b/jaxp/src/java.xml/share/classes/javax/xml/stream/events/Attribute.java	Thu Dec 15 13:57:04 2016 -0800
@@ -1,4 +1,5 @@
 /*
+ * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,10 +23,6 @@
  * questions.
  */
 
-/*
- * Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
- */
-
 package javax.xml.stream.events;
 
 import javax.xml.namespace.QName;
--- a/jaxp/src/java.xml/share/classes/javax/xml/stream/events/Characters.java	Thu Dec 15 09:03:36 2016 +0100
+++ b/jaxp/src/java.xml/share/classes/javax/xml/stream/events/Characters.java	Thu Dec 15 13:57:04 2016 -0800
@@ -1,4 +1,5 @@
 /*
+ * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,10 +23,6 @@
  * questions.
  */
 
-/*
- * Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
- */
-
 package javax.xml.stream.events;
 
 /**
--- a/jaxp/src/java.xml/share/classes/javax/xml/stream/events/Comment.java	Thu Dec 15 09:03:36 2016 +0100
+++ b/jaxp/src/java.xml/share/classes/javax/xml/stream/events/Comment.java	Thu Dec 15 13:57:04 2016 -0800
@@ -1,4 +1,5 @@
 /*
+ * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,10 +23,6 @@
  * questions.
  */
 
-/*
- * Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
- */
-
 package javax.xml.stream.events;
 
 /**
--- a/jaxp/src/java.xml/share/classes/javax/xml/stream/events/DTD.java	Thu Dec 15 09:03:36 2016 +0100
+++ b/jaxp/src/java.xml/share/classes/javax/xml/stream/events/DTD.java	Thu Dec 15 13:57:04 2016 -0800
@@ -1,4 +1,5 @@
 /*
+ * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,10 +23,6 @@
  * questions.
  */
 
-/*
- * Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
- */
-
 package javax.xml.stream.events;
 
 import java.util.List;
@@ -39,36 +36,40 @@
  */
 public interface DTD extends XMLEvent {
 
-  /**
-   * Returns the entire Document Type Declaration as a string, including
-   * the internal DTD subset.
-   * This may be null if there is not an internal subset.
-   * If it is not null it must return the entire
-   * Document Type Declaration which matches the doctypedecl
-   * production in the XML 1.0 specification
-   */
-  String getDocumentTypeDeclaration();
+    /**
+     * Returns the entire Document Type Declaration as a string, including the
+     * internal DTD subset. This may be null if there is not an internal subset.
+     * If it is not null it must return the entire Document Type Declaration
+     * which matches the doctypedecl production in the XML 1.0 specification
+     *
+     * @return the Document Type Declaration
+     */
+    String getDocumentTypeDeclaration();
 
-  /**
-   * Returns an implementation defined representation of the DTD.
-   * This method may return null if no representation is available.
-   */
-  Object getProcessedDTD();
+    /**
+     * Returns an implementation defined representation of the DTD. This method
+     * may return null if no representation is available.
+     *
+     * @return the representation of the DTD
+     */
+    Object getProcessedDTD();
 
-  /**
-   * Return a List containing the notations declared in the DTD.
-   * This list must contain NotationDeclaration events.
-   * @see NotationDeclaration
-   * @return an unordered list of NotationDeclaration events
-   */
-  List getNotations();
+    /**
+     * Return a List containing the notations declared in the DTD. This list
+     * must contain NotationDeclaration events.
+     *
+     * @see NotationDeclaration
+     * @return an unordered list of NotationDeclaration events
+     */
+    List<NotationDeclaration> getNotations();
 
-  /**
-   * Return a List containing the general entities,
-   * both external and internal, declared in the DTD.
-   * This list must contain EntityDeclaration events.
-   * @see EntityDeclaration
-   * @return an unordered list of EntityDeclaration events
-   */
-  List getEntities();
+    /**
+     * Return a List containing the general entities, both external and
+     * internal, declared in the DTD. This list must contain EntityDeclaration
+     * events.
+     *
+     * @see EntityDeclaration
+     * @return an unordered list of EntityDeclaration events
+     */
+    List<EntityDeclaration> getEntities();
 }
--- a/jaxp/src/java.xml/share/classes/javax/xml/stream/events/EndDocument.java	Thu Dec 15 09:03:36 2016 +0100
+++ b/jaxp/src/java.xml/share/classes/javax/xml/stream/events/EndDocument.java	Thu Dec 15 13:57:04 2016 -0800
@@ -1,4 +1,5 @@
 /*
+ * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,10 +23,6 @@
  * questions.
  */
 
-/*
- * Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
- */
-
 package javax.xml.stream.events;
 
 /**
--- a/jaxp/src/java.xml/share/classes/javax/xml/stream/events/EndElement.java	Thu Dec 15 09:03:36 2016 +0100
+++ b/jaxp/src/java.xml/share/classes/javax/xml/stream/events/EndElement.java	Thu Dec 15 13:57:04 2016 -0800
@@ -1,4 +1,5 @@
 /*
+ * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,10 +23,6 @@
  * questions.
  */
 
-/*
- * Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
- */
-
 package javax.xml.stream.events;
 
 import java.util.Iterator;
@@ -54,6 +51,6 @@
    * @return an Iterator over Namespace interfaces, or an
    * empty iterator
    */
-  public Iterator getNamespaces();
+  public Iterator<Namespace> getNamespaces();
 
 }
--- a/jaxp/src/java.xml/share/classes/javax/xml/stream/events/EntityDeclaration.java	Thu Dec 15 09:03:36 2016 +0100
+++ b/jaxp/src/java.xml/share/classes/javax/xml/stream/events/EntityDeclaration.java	Thu Dec 15 13:57:04 2016 -0800
@@ -1,4 +1,5 @@
 /*
+ * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,10 +23,6 @@
  * questions.
  */
 
-/*
- * Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
- */
-
 package javax.xml.stream.events;
 /**
  * An interface for handling Entity Declarations
--- a/jaxp/src/java.xml/share/classes/javax/xml/stream/events/EntityReference.java	Thu Dec 15 09:03:36 2016 +0100
+++ b/jaxp/src/java.xml/share/classes/javax/xml/stream/events/EntityReference.java	Thu Dec 15 13:57:04 2016 -0800
@@ -1,4 +1,5 @@
 /*
+ * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,10 +23,6 @@
  * questions.
  */
 
-/*
- * Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
- */
-
 package javax.xml.stream.events;
 /**
  * An interface for handling Entity events.
--- a/jaxp/src/java.xml/share/classes/javax/xml/stream/events/Namespace.java	Thu Dec 15 09:03:36 2016 +0100
+++ b/jaxp/src/java.xml/share/classes/javax/xml/stream/events/Namespace.java	Thu Dec 15 13:57:04 2016 -0800
@@ -1,4 +1,5 @@
 /*
+ * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,10 +23,6 @@
  * questions.
  */
 
-/*
- * Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
- */
-
 package javax.xml.stream.events;
 
 import javax.xml.namespace.QName;
--- a/jaxp/src/java.xml/share/classes/javax/xml/stream/events/NotationDeclaration.java	Thu Dec 15 09:03:36 2016 +0100
+++ b/jaxp/src/java.xml/share/classes/javax/xml/stream/events/NotationDeclaration.java	Thu Dec 15 13:57:04 2016 -0800
@@ -1,4 +1,5 @@
 /*
+ * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,10 +23,6 @@
  * questions.
  */
 
-/*
- * Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
- */
-
 package javax.xml.stream.events;
 /**
  * An interface for handling Notation Declarations
--- a/jaxp/src/java.xml/share/classes/javax/xml/stream/events/ProcessingInstruction.java	Thu Dec 15 09:03:36 2016 +0100
+++ b/jaxp/src/java.xml/share/classes/javax/xml/stream/events/ProcessingInstruction.java	Thu Dec 15 13:57:04 2016 -0800
@@ -1,4 +1,5 @@
 /*
+ * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,10 +23,6 @@
  * questions.
  */
 
-/*
- * Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
- */
-
 package javax.xml.stream.events;
 /**
  * An interface that describes the data found in processing instructions
--- a/jaxp/src/java.xml/share/classes/javax/xml/stream/events/StartDocument.java	Thu Dec 15 09:03:36 2016 +0100
+++ b/jaxp/src/java.xml/share/classes/javax/xml/stream/events/StartDocument.java	Thu Dec 15 13:57:04 2016 -0800
@@ -1,4 +1,5 @@
 /*
+ * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,10 +23,6 @@
  * questions.
  */
 
-/*
- * Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
- */
-
 package javax.xml.stream.events;
 /**
  * An interface for the start document event
--- a/jaxp/src/java.xml/share/classes/javax/xml/stream/events/StartElement.java	Thu Dec 15 09:03:36 2016 +0100
+++ b/jaxp/src/java.xml/share/classes/javax/xml/stream/events/StartElement.java	Thu Dec 15 13:57:04 2016 -0800
@@ -1,4 +1,5 @@
 /*
+ * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,16 +23,10 @@
  * questions.
  */
 
-/*
- * Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
- */
-
 package javax.xml.stream.events;
 
 import javax.xml.namespace.QName;
 import javax.xml.namespace.NamespaceContext;
-
-import java.util.Map;
 import java.util.Iterator;
 
 /**
@@ -62,7 +57,7 @@
    * @return a readonly Iterator over Attribute interfaces, or an
    * empty iterator
    */
-  public Iterator getAttributes();
+  public Iterator<Attribute> getAttributes();
 
   /**
    * Returns an Iterator of namespaces declared on this element.
@@ -87,7 +82,7 @@
    * empty iterator
    *
    */
-  public Iterator getNamespaces();
+  public Iterator<Namespace> getNamespaces();
 
   /**
    * Returns the attribute referred to by this name
--- a/jaxp/src/java.xml/share/classes/javax/xml/stream/events/XMLEvent.java	Thu Dec 15 09:03:36 2016 +0100
+++ b/jaxp/src/java.xml/share/classes/javax/xml/stream/events/XMLEvent.java	Thu Dec 15 13:57:04 2016 -0800
@@ -1,4 +1,5 @@
 /*
+ * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,10 +23,6 @@
  * questions.
  */
 
-/*
- * Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
- */
-
 package javax.xml.stream.events;
 
 import java.io.Writer;
--- a/jaxp/src/java.xml/share/classes/javax/xml/stream/util/EventReaderDelegate.java	Thu Dec 15 09:03:36 2016 +0100
+++ b/jaxp/src/java.xml/share/classes/javax/xml/stream/util/EventReaderDelegate.java	Thu Dec 15 13:57:04 2016 -0800
@@ -1,4 +1,5 @@
 /*
+ * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,17 +23,10 @@
  * questions.
  */
 
-/*
- * Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
- */
-
 package javax.xml.stream.util;
 
-import javax.xml.namespace.QName;
-import javax.xml.namespace.NamespaceContext;
 import javax.xml.stream.XMLEventReader;
 import javax.xml.stream.events.XMLEvent;
-import javax.xml.stream.Location;
 import javax.xml.stream.XMLStreamException;
 
 /**
--- a/jaxp/src/java.xml/share/classes/javax/xml/stream/util/StreamReaderDelegate.java	Thu Dec 15 09:03:36 2016 +0100
+++ b/jaxp/src/java.xml/share/classes/javax/xml/stream/util/StreamReaderDelegate.java	Thu Dec 15 13:57:04 2016 -0800
@@ -1,4 +1,5 @@
 /*
+ * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,13 +23,8 @@
  * questions.
  */
 
-/*
- * Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
- */
-
 package javax.xml.stream.util;
 
-import java.io.Reader;
 import javax.xml.namespace.QName;
 import javax.xml.namespace.NamespaceContext;
 import javax.xml.stream.XMLStreamReader;
--- a/jaxp/src/java.xml/share/classes/javax/xml/stream/util/XMLEventAllocator.java	Thu Dec 15 09:03:36 2016 +0100
+++ b/jaxp/src/java.xml/share/classes/javax/xml/stream/util/XMLEventAllocator.java	Thu Dec 15 13:57:04 2016 -0800
@@ -1,4 +1,5 @@
 /*
+ * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,10 +23,6 @@
  * questions.
  */
 
-/*
- * Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
- */
-
 package javax.xml.stream.util;
 
 import javax.xml.stream.events.XMLEvent;
--- a/jaxp/src/java.xml/share/classes/javax/xml/stream/util/XMLEventConsumer.java	Thu Dec 15 09:03:36 2016 +0100
+++ b/jaxp/src/java.xml/share/classes/javax/xml/stream/util/XMLEventConsumer.java	Thu Dec 15 13:57:04 2016 -0800
@@ -1,4 +1,5 @@
 /*
+ * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,10 +23,6 @@
  * questions.
  */
 
-/*
- * Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
- */
-
 package javax.xml.stream.util;
 
 import javax.xml.stream.events.XMLEvent;