@@ -246,66 +246,69 @@ private void inflate() {
246
246
this .contentHash = hash ;
247
247
charLen = rawLen ;
248
248
state = State .BYTE ;
249
+ } else {
250
+ inflateNonAscii (singleBytes , hash );
249
251
}
250
- else {
251
- char [] chararr = new char [rawLen ];
252
- int chararr_count = singleBytes ;
253
- // Inflate prefix of bytes to characters
254
- JLA .inflateBytesToChars (rawBytes , offset , chararr , 0 , singleBytes );
255
-
256
- int px = offset + singleBytes ;
257
- int utfend = offset + rawLen ;
258
- while (px < utfend ) {
259
- int c = (int ) rawBytes [px ] & 0xff ;
260
- switch (c >> 4 ) {
261
- case 0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 : {
262
- // 0xxx xxxx
263
- px ++;
264
- chararr [chararr_count ++] = (char ) c ;
265
- hash = 31 * hash + c ;
266
- break ;
252
+ }
253
+
254
+ private void inflateNonAscii (int singleBytes , int hash ) {
255
+ char [] chararr = new char [rawLen ];
256
+ int chararr_count = singleBytes ;
257
+ // Inflate prefix of bytes to characters
258
+ JLA .inflateBytesToChars (rawBytes , offset , chararr , 0 , singleBytes );
259
+
260
+ int px = offset + singleBytes ;
261
+ int utfend = offset + rawLen ;
262
+ while (px < utfend ) {
263
+ int c = (int ) rawBytes [px ] & 0xff ;
264
+ switch (c >> 4 ) {
265
+ case 0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 : {
266
+ // 0xxx xxxx
267
+ px ++;
268
+ chararr [chararr_count ++] = (char ) c ;
269
+ hash = 31 * hash + c ;
270
+ break ;
271
+ }
272
+ case 12 , 13 : {
273
+ // 110x xxxx 10xx xxxx
274
+ px += 2 ;
275
+ if (px > utfend ) {
276
+ throw malformedInput (utfend );
267
277
}
268
- case 12 , 13 : {
269
- // 110x xxxx 10xx xxxx
270
- px += 2 ;
271
- if (px > utfend ) {
272
- throw malformedInput (utfend );
273
- }
274
- int char2 = rawBytes [px - 1 ];
275
- if ((char2 & 0xC0 ) != 0x80 ) {
276
- throw malformedInput (px );
277
- }
278
- char v = (char ) (((c & 0x1F ) << 6 ) | (char2 & 0x3F ));
279
- chararr [chararr_count ++] = v ;
280
- hash = 31 * hash + v ;
281
- break ;
278
+ int char2 = rawBytes [px - 1 ];
279
+ if ((char2 & 0xC0 ) != 0x80 ) {
280
+ throw malformedInput (px );
282
281
}
283
- case 14 : {
284
- // 1110 xxxx 10xx xxxx 10xx xxxx
285
- px += 3 ;
286
- if (px > utfend ) {
287
- throw malformedInput (utfend );
288
- }
289
- int char2 = rawBytes [px - 2 ];
290
- int char3 = rawBytes [px - 1 ];
291
- if (((char2 & 0xC0 ) != 0x80 ) || ((char3 & 0xC0 ) != 0x80 )) {
292
- throw malformedInput (px - 1 );
293
- }
294
- char v = (char ) (((c & 0x0F ) << 12 ) | ((char2 & 0x3F ) << 6 ) | (char3 & 0x3F ));
295
- chararr [chararr_count ++] = v ;
296
- hash = 31 * hash + v ;
297
- break ;
282
+ char v = (char ) (((c & 0x1F ) << 6 ) | (char2 & 0x3F ));
283
+ chararr [chararr_count ++] = v ;
284
+ hash = 31 * hash + v ;
285
+ break ;
286
+ }
287
+ case 14 : {
288
+ // 1110 xxxx 10xx xxxx 10xx xxxx
289
+ px += 3 ;
290
+ if (px > utfend ) {
291
+ throw malformedInput (utfend );
298
292
}
299
- default :
300
- // 10xx xxxx, 1111 xxxx
301
- throw malformedInput (px );
293
+ int char2 = rawBytes [px - 2 ];
294
+ int char3 = rawBytes [px - 1 ];
295
+ if (((char2 & 0xC0 ) != 0x80 ) || ((char3 & 0xC0 ) != 0x80 )) {
296
+ throw malformedInput (px - 1 );
297
+ }
298
+ char v = (char ) (((c & 0x0F ) << 12 ) | ((char2 & 0x3F ) << 6 ) | (char3 & 0x3F ));
299
+ chararr [chararr_count ++] = v ;
300
+ hash = 31 * hash + v ;
301
+ break ;
302
302
}
303
+ default :
304
+ // 10xx xxxx, 1111 xxxx
305
+ throw malformedInput (px );
303
306
}
304
- this .contentHash = hash ;
305
- charLen = chararr_count ;
306
- this .chars = chararr ;
307
- state = State .CHAR ;
308
307
}
308
+ this .contentHash = hash ;
309
+ charLen = chararr_count ;
310
+ this .chars = chararr ;
311
+ state = State .CHAR ;
309
312
}
310
313
311
314
private ConstantPoolException malformedInput (int px ) {
0 commit comments