@@ -60,7 +60,7 @@ public class PrettyPrintXMLWriter
6060
6161 /**
6262 * @param writer not null
63- * @param lineIndent could be null, but the normal way is some spaces.
63+ * @param lineIndent can be null, but the normal way is some spaces
6464 */
6565 public PrettyPrintXMLWriter ( PrintWriter writer , String lineIndent )
6666 {
@@ -69,7 +69,7 @@ public PrettyPrintXMLWriter( PrintWriter writer, String lineIndent )
6969
7070 /**
7171 * @param writer not null
72- * @param lineIndent could be null, but the normal way is some spaces.
72+ * @param lineIndent can be null, but the normal way is some spaces.
7373 */
7474 public PrettyPrintXMLWriter ( Writer writer , String lineIndent )
7575 {
@@ -94,9 +94,9 @@ public PrettyPrintXMLWriter( Writer writer )
9494
9595 /**
9696 * @param writer not null
97- * @param lineIndent could be null, but the normal way is some spaces.
98- * @param encoding could be null or invalid.
99- * @param doctype could be null.
97+ * @param lineIndent can be null, but the normal way is some spaces
98+ * @param encoding can be null or invalid
99+ * @param doctype can be null
100100 */
101101 public PrettyPrintXMLWriter ( PrintWriter writer , String lineIndent , String encoding , String doctype )
102102 {
@@ -105,9 +105,9 @@ public PrettyPrintXMLWriter( PrintWriter writer, String lineIndent, String encod
105105
106106 /**
107107 * @param writer not null
108- * @param lineIndent could be null, but the normal way is some spaces.
109- * @param encoding could be null or invalid.
110- * @param doctype could be null.
108+ * @param lineIndent can be null, but the normal way is some spaces
109+ * @param encoding can be null or invalid
110+ * @param doctype can be null
111111 */
112112 public PrettyPrintXMLWriter ( Writer writer , String lineIndent , String encoding , String doctype )
113113 {
@@ -116,8 +116,8 @@ public PrettyPrintXMLWriter( Writer writer, String lineIndent, String encoding,
116116
117117 /**
118118 * @param writer not null
119- * @param encoding could be null or invalid.
120- * @param doctype could be null.
119+ * @param encoding can be null or invalid
120+ * @param doctype can be null
121121 */
122122 public PrettyPrintXMLWriter ( PrintWriter writer , String encoding , String doctype )
123123 {
@@ -126,8 +126,8 @@ public PrettyPrintXMLWriter( PrintWriter writer, String encoding, String doctype
126126
127127 /**
128128 * @param writer not null
129- * @param encoding could be null or invalid.
130- * @param doctype could be null.
129+ * @param encoding can be null or invalid
130+ * @param doctype can be null
131131 */
132132 public PrettyPrintXMLWriter ( Writer writer , String encoding , String doctype )
133133 {
@@ -136,10 +136,10 @@ public PrettyPrintXMLWriter( Writer writer, String encoding, String doctype )
136136
137137 /**
138138 * @param writer not null
139- * @param lineIndent could be null, but the normal way is some spaces.
140- * @param lineSeparator could be null, but the normal way is valid line separator
141- * @param encoding could be null or the encoding to use.
142- * @param doctype could be null.
139+ * @param lineIndent can be null, but the normal way is some spaces.
140+ * @param lineSeparator can be null, but the normal way is valid line separator
141+ * @param encoding can be null or the encoding to use.
142+ * @param doctype can be null
143143 */
144144 public PrettyPrintXMLWriter ( PrintWriter writer , String lineIndent , String lineSeparator , String encoding ,
145145 String doctype )
@@ -149,10 +149,10 @@ public PrettyPrintXMLWriter( PrintWriter writer, String lineIndent, String lineS
149149
150150 /**
151151 * @param writer not null
152- * @param lineIndent could be null, but the normal way is some spaces.
153- * @param lineSeparator could be null, but the normal way is valid line separator
154- * @param encoding could be null or the encoding to use.
155- * @param doctype could be null.
152+ * @param lineIndent can be null, but the normal way is some spaces
153+ * @param lineSeparator can be null, but the normal way is valid line separator
154+ * @param encoding can be null or the encoding to use
155+ * @param doctype can be null
156156 */
157157 private PrettyPrintXMLWriter ( PrintWriter writer , char [] lineIndent , char [] lineSeparator , String encoding ,
158158 String doctype )
@@ -211,7 +211,7 @@ public void setDocType( String docType )
211211 }
212212
213213 /**
214- * @param lineSeparator The line separator to be used.
214+ * @param lineSeparator the line separator to be output
215215 */
216216 public void setLineSeparator ( String lineSeparator )
217217 {
@@ -224,7 +224,7 @@ public void setLineSeparator( String lineSeparator )
224224 }
225225
226226 /**
227- * @param lineIndentParameter The line indent parameter.
227+ * @param lineIndentParameter the line indent parameter
228228 */
229229 public void setLineIndenter ( String lineIndentParameter )
230230 {
@@ -239,6 +239,12 @@ public void setLineIndenter( String lineIndentParameter )
239239 /** {@inheritDoc} */
240240 public void startElement ( String elementName ) throws IOException
241241 {
242+
243+ if ( elementName .isEmpty () )
244+ {
245+ throw new IllegalArgumentException ( "Element name cannot be empty" );
246+ }
247+
242248 boolean firstLine = ensureDocumentStarted ();
243249
244250 completePreviouslyOpenedElement ();
@@ -325,7 +331,7 @@ public void endElement() throws IOException
325331 }
326332
327333 /**
328- * Write the documents if not already done.
334+ * Write the document if not already done.
329335 *
330336 * @return <code>true</code> if the document headers have freshly been written.
331337 */
0 commit comments