< prev index next >
src/java.base/share/classes/jdk/internal/util/xml/impl/XMLStreamWriterImpl.java
Print this page
rev 51919 : 8215281: Use String.isEmpty() when applicable in java.base
Reviewed-by: dfuchs, alanb
@@ -203,11 +203,11 @@
* Writes a start tag to the output.
* @param localName local name of the tag, may not be null
* @throws XMLStreamException
*/
public void writeStartElement(String localName) throws XMLStreamException {
- if (localName == null || localName.length() == 0) {
+ if (localName == null || localName.isEmpty()) {
throw new XMLStreamException("Local Name cannot be null or empty");
}
_state = STATE_ELEMENT;
if (_currentEle != null && _currentEle.getState() == ELEMENT_STARTTAG_OPEN) {
@@ -418,11 +418,11 @@
// Write any pending data
_writer.write(content, startWritePos, end - startWritePos);
}
private void writeXMLContent(String content) throws XMLStreamException {
- if ((content != null) && (content.length() > 0)) {
+ if (content != null && !content.isEmpty()) {
writeXMLContent(content,
_escapeCharacters, // boolean = escapeChars
false); // false = escapeDoubleQuotes
}
}
< prev index next >