< prev index next >

src/java.base/share/classes/jdk/internal/util/xml/impl/Parser.java

Print this page
rev 51919 : 8215281: Use String.isEmpty() when applicable in java.base
Reviewed-by: dfuchs, alanb


1572         char ch;
1573         String str = null;
1574         mBuffIdx = -1;
1575         for (short st = 0; st >= 0;) {
1576             ch = getch();
1577             if (ch == EOS) {
1578                 panic(FAULT);
1579             }
1580             switch (st) {
1581                 case 0:     // read the PI target name
1582                     switch (chtyp(ch)) {
1583                         case 'a':
1584                         case 'A':
1585                         case '_':
1586                         case ':':
1587                         case 'X':
1588                             bkch();
1589                             str = name(false);
1590                             //          PI target name may not be empty string [#2.6]
1591                             //          PI target name 'XML' is reserved [#2.6]
1592                             if ((str.length() == 0)
1593                                     || (mXml.name.equals(str.toLowerCase()) == true)) {
1594                                 panic(FAULT);
1595                             }
1596                             //          This is processing instruction
1597                             if (mPh == PH_DOC_START) // the begining of the document
1598                             {
1599                                 mPh = PH_MISC_DTD;    // misc before DTD
1600                             }
1601                             wsskip();  // skip spaces after the PI target name
1602                             st = 1;    // accumulate the PI body
1603                             mBuffIdx = -1;
1604                             break;
1605 
1606                         default:
1607                             panic(FAULT);
1608                     }
1609                     break;
1610 
1611                 case 1:     // accumulate the PI body
1612                     switch (ch) {




1572         char ch;
1573         String str = null;
1574         mBuffIdx = -1;
1575         for (short st = 0; st >= 0;) {
1576             ch = getch();
1577             if (ch == EOS) {
1578                 panic(FAULT);
1579             }
1580             switch (st) {
1581                 case 0:     // read the PI target name
1582                     switch (chtyp(ch)) {
1583                         case 'a':
1584                         case 'A':
1585                         case '_':
1586                         case ':':
1587                         case 'X':
1588                             bkch();
1589                             str = name(false);
1590                             //          PI target name may not be empty string [#2.6]
1591                             //          PI target name 'XML' is reserved [#2.6]
1592                             if ((str.isEmpty())
1593                                     || (mXml.name.equals(str.toLowerCase()) == true)) {
1594                                 panic(FAULT);
1595                             }
1596                             //          This is processing instruction
1597                             if (mPh == PH_DOC_START) // the begining of the document
1598                             {
1599                                 mPh = PH_MISC_DTD;    // misc before DTD
1600                             }
1601                             wsskip();  // skip spaces after the PI target name
1602                             st = 1;    // accumulate the PI body
1603                             mBuffIdx = -1;
1604                             break;
1605 
1606                         default:
1607                             panic(FAULT);
1608                     }
1609                     break;
1610 
1611                 case 1:     // accumulate the PI body
1612                     switch (ch) {


< prev index next >