src/java.xml/share/classes/com/sun/org/apache/xerces/internal/parsers/XML11DTDConfiguration.java
--- a/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/parsers/XML11DTDConfiguration.java Tue Sep 05 13:40:14 2017 +0200
+++ b/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/parsers/XML11DTDConfiguration.java Wed Oct 18 13:25:49 2017 -0700
@@ -1,6 +1,6 @@
/*
- * reserved comment block
- * DO NOT REMOVE OR ALTER!
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * @LastModified: Oct 2017
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@@ -21,11 +21,6 @@
package com.sun.org.apache.xerces.internal.parsers;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Locale;
-
import com.sun.org.apache.xerces.internal.impl.Constants;
import com.sun.org.apache.xerces.internal.impl.XML11DTDScannerImpl;
import com.sun.org.apache.xerces.internal.impl.XML11DocumentScannerImpl;
@@ -67,6 +62,11 @@
import com.sun.org.apache.xerces.internal.xni.parser.XMLErrorHandler;
import com.sun.org.apache.xerces.internal.xni.parser.XMLInputSource;
import com.sun.org.apache.xerces.internal.xni.parser.XMLPullParserConfiguration;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Locale;
/**
* This class is the DTD-only parser configuration
@@ -221,13 +221,13 @@
protected Locale fLocale;
/** XML 1.0 Components. */
- protected ArrayList fComponents;
+ protected List<XMLComponent> fComponents;
/** XML 1.1. Components. */
- protected ArrayList fXML11Components = null;
+ protected List<XMLComponent> fXML11Components = null;
/** Common components: XMLEntityManager, XMLErrorReporter */
- protected ArrayList fCommonComponents = null;
+ protected List<XMLComponent> fCommonComponents = null;
/** The document handler. */
protected XMLDocumentHandler fDocumentHandler;
@@ -383,15 +383,15 @@
// create a vector to hold all the components in use
// XML 1.0 specialized components
- fComponents = new ArrayList();
+ fComponents = new ArrayList<>();
// XML 1.1 specialized components
- fXML11Components = new ArrayList();
+ fXML11Components = new ArrayList<>();
// Common components for XML 1.1. and XML 1.0
- fCommonComponents = new ArrayList();
+ fCommonComponents = new ArrayList<>();
// create table for features and properties
- fFeatures = new HashMap();
- fProperties = new HashMap();
+ fFeatures = new HashMap<>();
+ fProperties = new HashMap<>();
// add default recognized features
final String[] recognizedFeatures =
@@ -799,28 +799,21 @@
throws XMLConfigurationException {
fConfigUpdated = true;
// forward to every XML 1.0 component
- int count = fComponents.size();
- for (int i = 0; i < count; i++) {
- XMLComponent c = (XMLComponent) fComponents.get(i);
- c.setFeature(featureId, state);
+ for (XMLComponent c : fComponents) {
+ c.setFeature(featureId, state);
}
// forward it to common components
- count = fCommonComponents.size();
- for (int i = 0; i < count; i++) {
- XMLComponent c = (XMLComponent) fCommonComponents.get(i);
- c.setFeature(featureId, state);
+ for (XMLComponent c : fCommonComponents) {
+ c.setFeature(featureId, state);
}
-
// forward to every XML 1.1 component
- count = fXML11Components.size();
- for (int i = 0; i < count; i++) {
- XMLComponent c = (XMLComponent) fXML11Components.get(i);
- try{
- c.setFeature(featureId, state);
- }
- catch (Exception e){
- // no op
- }
+ for (XMLComponent c : fXML11Components) {
+ try {
+ c.setFeature(featureId, state);
+ }
+ catch (Exception e){
+ // no op
+ }
}
// save state if noone "objects"
super.setFeature(featureId, state);
@@ -837,27 +830,21 @@
throws XMLConfigurationException {
fConfigUpdated = true;
// forward to every XML 1.0 component
- int count = fComponents.size();
- for (int i = 0; i < count; i++) {
- XMLComponent c = (XMLComponent) fComponents.get(i);
- c.setProperty(propertyId, value);
+ for (XMLComponent c : fComponents) {
+ c.setProperty(propertyId, value);
}
// forward it to every common Component
- count = fCommonComponents.size();
- for (int i = 0; i < count; i++) {
- XMLComponent c = (XMLComponent) fCommonComponents.get(i);
- c.setProperty(propertyId, value);
+ for (XMLComponent c : fCommonComponents) {
+ c.setProperty(propertyId, value);
}
// forward it to every XML 1.1 component
- count = fXML11Components.size();
- for (int i = 0; i < count; i++) {
- XMLComponent c = (XMLComponent) fXML11Components.get(i);
- try{
- c.setProperty(propertyId, value);
- }
- catch (Exception e){
+ for (XMLComponent c : fXML11Components) {
+ try {
+ c.setProperty(propertyId, value);
+ }
+ catch (Exception e){
// ignore it
- }
+ }
}
// store value if noone "objects"
@@ -875,38 +862,29 @@
* reset all XML 1.0 components before parsing and namespace context
*/
protected void reset() throws XNIException {
- int count = fComponents.size();
- for (int i = 0; i < count; i++) {
- XMLComponent c = (XMLComponent) fComponents.get(i);
- c.reset(this);
- }
-
+ for (XMLComponent c : fComponents) {
+ c.reset(this);
+ }
} // reset()
/**
* reset all common components before parsing
*/
protected void resetCommon() throws XNIException {
- // reset common components
- int count = fCommonComponents.size();
- for (int i = 0; i < count; i++) {
- XMLComponent c = (XMLComponent) fCommonComponents.get(i);
- c.reset(this);
- }
-
+ // reset common components
+ for (XMLComponent c : fCommonComponents) {
+ c.reset(this);
+ }
} // resetCommon()
/**
* reset all components before parsing and namespace context
*/
protected void resetXML11() throws XNIException {
- // reset every component
- int count = fXML11Components.size();
- for (int i = 0; i < count; i++) {
- XMLComponent c = (XMLComponent) fXML11Components.get(i);
- c.reset(this);
- }
-
+ // reset every component
+ for (XMLComponent c : fXML11Components) {
+ c.reset(this);
+ }
} // resetXML11()
/**