< prev index next >

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

Print this page
rev 52979 : 8215281: Use String.isEmpty() when applicable in java.base
Reviewed-by: TBD


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




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


< prev index next >