src/java.base/share/classes/jdk/internal/util/xml/impl/XMLStreamWriterImpl.java
changeset 53018 8bf9268df0e2
parent 48944 25aa8b9f1dae
equal deleted inserted replaced
53017:e10a1f7aaa13 53018:8bf9268df0e2
   203      * Writes a start tag to the output.
   203      * Writes a start tag to the output.
   204      * @param localName local name of the tag, may not be null
   204      * @param localName local name of the tag, may not be null
   205      * @throws XMLStreamException
   205      * @throws XMLStreamException
   206      */
   206      */
   207     public void writeStartElement(String localName) throws XMLStreamException {
   207     public void writeStartElement(String localName) throws XMLStreamException {
   208         if (localName == null || localName.length() == 0) {
   208         if (localName == null || localName.isEmpty()) {
   209             throw new XMLStreamException("Local Name cannot be null or empty");
   209             throw new XMLStreamException("Local Name cannot be null or empty");
   210         }
   210         }
   211 
   211 
   212         _state = STATE_ELEMENT;
   212         _state = STATE_ELEMENT;
   213         if (_currentEle != null && _currentEle.getState() == ELEMENT_STARTTAG_OPEN) {
   213         if (_currentEle != null && _currentEle.getState() == ELEMENT_STARTTAG_OPEN) {
   418         // Write any pending data
   418         // Write any pending data
   419         _writer.write(content, startWritePos, end - startWritePos);
   419         _writer.write(content, startWritePos, end - startWritePos);
   420     }
   420     }
   421 
   421 
   422     private void writeXMLContent(String content) throws XMLStreamException {
   422     private void writeXMLContent(String content) throws XMLStreamException {
   423         if ((content != null) && (content.length() > 0)) {
   423         if (content != null && !content.isEmpty()) {
   424             writeXMLContent(content,
   424             writeXMLContent(content,
   425                     _escapeCharacters, // boolean = escapeChars
   425                     _escapeCharacters, // boolean = escapeChars
   426                     false);             // false = escapeDoubleQuotes
   426                     false);             // false = escapeDoubleQuotes
   427         }
   427         }
   428     }
   428     }