< prev index next >

src/java.base/share/classes/com/sun/java/util/jar/pack/Attribute.java

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


 979                     else
 980                         i = skipBody(layout, body = i);
 981                     Layout.Element[] cbody
 982                         = tokenizeLayout(self, curCble,
 983                                          layout.substring(body, i++));
 984                     if (cstrlen == 0) {
 985                         Layout.Element ce = self.new Element();
 986                         ce.body = cbody;
 987                         ce.kind = EK_CASE;
 988                         ce.removeBand();
 989                         cases.add(ce);
 990                         break;  // done with the whole union
 991                     } else {
 992                         // Parse a case string.
 993                         boolean firstCaseNum = true;
 994                         for (int cp = 0, endp;; cp = endp+1) {
 995                             // Look for multiple case tags:
 996                             endp = cstr.indexOf(',', cp);
 997                             if (endp < 0)  endp = cstrlen;
 998                             String cstr1 = cstr.substring(cp, endp);
 999                             if (cstr1.length() == 0)
1000                                 cstr1 = "empty";  // will fail parse
1001                             int value0, value1;
1002                             // Check for a case range (new in 1.6).
1003                             int dash = findCaseDash(cstr1, 0);
1004                             if (dash >= 0) {
1005                                 value0 = parseIntBefore(cstr1, dash);
1006                                 value1 = parseIntAfter(cstr1, dash);
1007                                 if (value0 >= value1)
1008                                     { i = -i; break; } // fail
1009                             } else {
1010                                 value0 = value1 = Integer.parseInt(cstr1);
1011                             }
1012                             // Add a case for each value in value0..value1
1013                             for (;; value0++) {
1014                                 Layout.Element ce = self.new Element();
1015                                 ce.body = cbody;  // all cases share one body
1016                                 ce.kind = EK_CASE;
1017                                 ce.removeBand();
1018                                 if (!firstCaseNum)
1019                                     // "backward case" repeats a body




 979                     else
 980                         i = skipBody(layout, body = i);
 981                     Layout.Element[] cbody
 982                         = tokenizeLayout(self, curCble,
 983                                          layout.substring(body, i++));
 984                     if (cstrlen == 0) {
 985                         Layout.Element ce = self.new Element();
 986                         ce.body = cbody;
 987                         ce.kind = EK_CASE;
 988                         ce.removeBand();
 989                         cases.add(ce);
 990                         break;  // done with the whole union
 991                     } else {
 992                         // Parse a case string.
 993                         boolean firstCaseNum = true;
 994                         for (int cp = 0, endp;; cp = endp+1) {
 995                             // Look for multiple case tags:
 996                             endp = cstr.indexOf(',', cp);
 997                             if (endp < 0)  endp = cstrlen;
 998                             String cstr1 = cstr.substring(cp, endp);
 999                             if (cstr1.isEmpty())
1000                                 cstr1 = "empty";  // will fail parse
1001                             int value0, value1;
1002                             // Check for a case range (new in 1.6).
1003                             int dash = findCaseDash(cstr1, 0);
1004                             if (dash >= 0) {
1005                                 value0 = parseIntBefore(cstr1, dash);
1006                                 value1 = parseIntAfter(cstr1, dash);
1007                                 if (value0 >= value1)
1008                                     { i = -i; break; } // fail
1009                             } else {
1010                                 value0 = value1 = Integer.parseInt(cstr1);
1011                             }
1012                             // Add a case for each value in value0..value1
1013                             for (;; value0++) {
1014                                 Layout.Element ce = self.new Element();
1015                                 ce.body = cbody;  // all cases share one body
1016                                 ce.kind = EK_CASE;
1017                                 ce.removeBand();
1018                                 if (!firstCaseNum)
1019                                     // "backward case" repeats a body


< prev index next >