@@ -62,10 +62,7 @@ private long[] getBits() {
62
62
63
63
// handle double colon, fill pieces with 0
64
64
if (this .doubleColonSeen ) {
65
- while (true ) {
66
- if (p16 .size () >= 8 ) {
67
- break ;
68
- }
65
+ while (p16 .size () < 8 ) {
69
66
p16 .add (this .doubleColonAt , 0x00000000 );
70
67
}
71
68
}
@@ -128,10 +125,7 @@ boolean addressPrefix() {
128
125
private boolean prefixLength () {
129
126
int start = this .index ;
130
127
131
- while (true ) {
132
- if (this .index >= this .str .length () || !this .digit ()) {
133
- break ;
134
- }
128
+ while (this .index < this .str .length () && this .digit ()) {
135
129
if (this .index - start > 3 ) {
136
130
return false ;
137
131
}
@@ -167,10 +161,7 @@ private boolean prefixLength() {
167
161
168
162
// Stores dotted notation for right-most 32 bits in `dottedRaw` / `dottedAddr` if found.
169
163
private boolean addressPart () {
170
- while (true ) {
171
- if (this .index >= this .str .length ()) {
172
- break ;
173
- }
164
+ while (this .index < this .str .length ()) {
174
165
// dotted notation for right-most 32 bits, e.g. 0:0:0:0:0:ffff:192.1.56.10
175
166
if ((this .doubleColonSeen || this .pieces .size () == 6 ) && this .dotted ()) {
176
167
Ipv4 dotted = new Ipv4 (this .dottedRaw );
@@ -249,12 +240,7 @@ private boolean dotted() {
249
240
250
241
this .dottedRaw = "" ;
251
242
252
- while (true ) {
253
- if (this .index < this .str .length () && (this .digit () || this .take ('.' ))) {
254
- continue ;
255
- }
256
- break ;
257
- }
243
+ while (this .index < this .str .length () && (this .digit () || this .take ('.' ))) {}
258
244
259
245
if (this .index - start >= 7 ) {
260
246
this .dottedRaw = this .str .substring (start , this .index );
@@ -279,11 +265,7 @@ private boolean dotted() {
279
265
private boolean h16 () {
280
266
int start = this .index ;
281
267
282
- while (true ) {
283
- if (this .index >= this .str .length () || !this .hexDig ()) {
284
- break ;
285
- }
286
- }
268
+ while (this .index < this .str .length () && this .hexDig ()) {}
287
269
288
270
String str = this .str .substring (start , this .index );
289
271
0 commit comments