88import com .fasterxml .jackson .core .io .*;
99import com .fasterxml .jackson .core .sym .ByteQuadsCanonicalizer ;
1010import com .fasterxml .jackson .core .sym .CharsToNameCanonicalizer ;
11+ import com .fasterxml .jackson .core .util .VersionUtil ;
1112
1213/**
1314 * This class is used to determine the encoding of byte stream
@@ -22,7 +23,7 @@ public final class ByteSourceJsonBootstrapper
2223 public final static byte UTF8_BOM_2 = (byte ) 0xBB ;
2324 public final static byte UTF8_BOM_3 = (byte ) 0xBF ;
2425
25- // [jackson-core#488 ] Limit in bytes for input byte array length to use StringReader instead of InputStreamReader
26+ // [jackson-core#1081 ] Limit in bytes for input byte array length to use StringReader instead of InputStreamReader
2627 private static final int STRING_READER_BYTE_ARRAY_LENGTH_LIMIT = 8192 ;
2728
2829 /*
@@ -175,7 +176,8 @@ public JsonEncoding detectEncoding() throws IOException
175176 break ;
176177 case 4 : enc = _bigEndian ? JsonEncoding .UTF32_BE : JsonEncoding .UTF32_LE ;
177178 break ;
178- default : throw new RuntimeException ("Internal error" ); // should never get here
179+ default :
180+ return VersionUtil .throwInternalReturnAny ();
179181 }
180182 }
181183 _context .setEncoding (enc );
@@ -235,15 +237,14 @@ public Reader constructReader() throws IOException
235237 if (in == null ) {
236238 int length = _inputEnd - _inputPtr ;
237239 if (length <= STRING_READER_BYTE_ARRAY_LENGTH_LIMIT ) {
238- // [jackson-core#488 ] Avoid overhead of heap ByteBuffer allocated by InputStreamReader
240+ // [jackson-core#1081 ] Avoid overhead of heap ByteBuffer allocated by InputStreamReader
239241 // when processing small inputs up to 8KiB.
240242 return new StringReader (new String (_inputBuffer , _inputPtr , length , enc .getJavaName ()));
241243 }
242244 in = new ByteArrayInputStream (_inputBuffer , _inputPtr , _inputEnd );
243245 } else {
244- /* Also, if we have any read but unused input (usually true),
245- * need to merge that input in:
246- */
246+ // Also, if we have any read but unused input (usually true),
247+ // need to merge that input in:
247248 if (_inputPtr < _inputEnd ) {
248249 in = new MergedStream (_context , in , _inputBuffer , _inputPtr , _inputEnd );
249250 }
@@ -254,7 +255,7 @@ public Reader constructReader() throws IOException
254255 return new UTF32Reader (_context , _in , _inputBuffer , _inputPtr , _inputEnd ,
255256 _context .getEncoding ().isBigEndian ());
256257 }
257- throw new RuntimeException ( "Internal error" ); // should never get here
258+ return VersionUtil . throwInternalReturnAny ();
258259 }
259260
260261 public JsonParser constructParser (int parserFeatures , ObjectCodec codec ,
@@ -266,9 +267,8 @@ public JsonParser constructParser(int parserFeatures, ObjectCodec codec,
266267 int bytesProcessed = _inputPtr - prevInputPtr ;
267268
268269 if (enc == JsonEncoding .UTF8 ) {
269- /* and without canonicalization, byte-based approach is not performant; just use std UTF-8 reader
270- * (which is ok for larger input; not so hot for smaller; but this is not a common case)
271- */
270+ // and without canonicalization, byte-based approach is not performant; just use std UTF-8 reader
271+ // (which is ok for larger input; not so hot for smaller; but this is not a common case)
272272 if (JsonFactory .Feature .CANONICALIZE_FIELD_NAMES .enabledIn (factoryFeatures )) {
273273 ByteQuadsCanonicalizer can = rootByteSymbols .makeChild (factoryFeatures );
274274 return new UTF8StreamJsonParser (_context , parserFeatures , _in , codec , can ,
@@ -535,9 +535,8 @@ private void reportWeirdUCS4(String type) throws IOException {
535535 */
536536
537537 protected boolean ensureLoaded (int minimum ) throws IOException {
538- /* Let's assume here buffer has enough room -- this will always
539- * be true for the limited used this method gets
540- */
538+ // Let's assume here buffer has enough room -- this will always
539+ // be true for the limited used this method gets
541540 int gotten = (_inputEnd - _inputPtr );
542541 while (gotten < minimum ) {
543542 int count ;
0 commit comments