src/java.xml/share/classes/com/sun/org/apache/xml/internal/serialize/BaseMarkupSerializer.java
--- a/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serialize/BaseMarkupSerializer.java Tue Sep 05 13:40:14 2017 +0200
+++ b/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serialize/BaseMarkupSerializer.java Wed Oct 18 13:25:49 2017 -0700
@@ -1,5 +1,6 @@
/*
- * Copyright (c) 2015, 2017 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
+ * @LastModified: Oct 2017
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@@ -53,9 +54,10 @@
import java.io.IOException;
import java.io.OutputStream;
import java.io.Writer;
+import java.util.ArrayList;
import java.util.HashMap;
+import java.util.List;
import java.util.Map;
-import java.util.Vector;
import org.w3c.dom.DOMError;
import org.w3c.dom.DOMErrorHandler;
import org.w3c.dom.Document;
@@ -161,10 +163,10 @@
/**
- * Vector holding comments and PIs that come before the root
+ * List holding comments and PIs that come before the root
* element (even after it), see {@link #serializePreRoot}.
*/
- private Vector _preRoot;
+ private List<String> _preRoot;
/**
@@ -641,8 +643,8 @@
// the PI directly but place it in the pre-root vector.
if ( isDocumentState() ) {
if ( _preRoot == null )
- _preRoot = new Vector();
- _preRoot.addElement( fStrBuffer.toString() );
+ _preRoot = new ArrayList<>();
+ _preRoot.add( fStrBuffer.toString() );
} else {
_printer.indent();
printText( fStrBuffer.toString(), true, true );
@@ -688,8 +690,8 @@
// the comment directly but place it in the pre-root vector.
if ( isDocumentState() ) {
if ( _preRoot == null )
- _preRoot = new Vector();
- _preRoot.addElement( fStrBuffer.toString() );
+ _preRoot = new ArrayList<>();
+ _preRoot.add( fStrBuffer.toString() );
} else {
// Indent this element on a new line if the first
// content of the parent element or immediately
@@ -1479,11 +1481,11 @@
if ( _preRoot != null ) {
for ( i = 0 ; i < _preRoot.size() ; ++i ) {
- printText( (String) _preRoot.elementAt( i ), true, true );
+ printText(_preRoot.get( i ), true, true );
if ( _indenting )
_printer.breakLine();
}
- _preRoot.removeAllElements();
+ _preRoot.clear();
}
}