@@ -48,15 +48,15 @@ public final class ByteSourceBootstrapper
4848 /**
4949 * Underlying InputStream to use for reading content.
5050 */
51- final InputStream _in ;
51+ protected final InputStream _in ;
5252
5353 /*
5454 /**********************************************************************
5555 /* Input buffering
5656 /**********************************************************************
5757 */
5858
59- final byte [] _inputBuffer ;
59+ protected final byte [] _inputBuffer ;
6060
6161 private int _inputPtr ;
6262
@@ -68,11 +68,11 @@ public final class ByteSourceBootstrapper
6868 /**********************************************************************
6969 */
7070
71- boolean mBigEndian = true ;
72- int mBytesPerChar = 0 ; // 0 means "dunno yet"
71+ protected boolean mBigEndian = true ;
72+ protected int mBytesPerChar = 0 ; // 0 means "dunno yet"
7373
74- boolean mHadBOM = false ;
75- boolean mByteSizeFound = false ;
74+ protected boolean mHadBOM = false ;
75+ protected boolean mByteSizeFound = false ;
7676
7777 /*
7878 /**********************************************************************
@@ -164,9 +164,9 @@ public XmlScanner doBootstrap() throws IOException, XMLStreamException
164164 return new Utf8Scanner (_config ,
165165 _in , _inputBuffer , _inputPtr , _inputLen );
166166 } else if (normEnc .startsWith (CharsetNames .CS_UTF32 )) {
167- /* Since this is such a rare encoding, we'll just create
168- * a Reader, and dispatch it to reader scanner?
169- */
167+ // Since this is such a rare encoding, we'll just create
168+ // a Reader, and dispatch it to reader scanner?
169+
170170 // let's augment with actual endianness info
171171 if (normEnc == CharsetNames .CS_UTF32 ) {
172172 normEnc = mBigEndian ? CharsetNames .CS_UTF32BE : CharsetNames .CS_UTF32LE ;
@@ -176,19 +176,17 @@ public XmlScanner doBootstrap() throws IOException, XMLStreamException
176176 return new ReaderScanner (_config , r );
177177 }
178178
179- /* And finally, if all else fails, we'll also fall back to
180- * using JDK-provided decoders and ReaderScanner:
181- */
179+ // And finally, if all else fails, we'll also fall back to
180+ // using JDK-provided decoders and ReaderScanner:
182181 InputStream in = _in ;
183182 if (_inputPtr < _inputLen ) {
184- in = new MergedStream (_config , in , _inputBuffer , _inputPtr , _inputLen );
183+ in = new MergedStream (_config , in , _inputBuffer , _inputPtr , _inputLen ); // lgtm [java/input-resource-leak]
185184 }
186185 if (normEnc == CharsetNames .CS_UTF16 ) {
187186 normEnc = mBigEndian ? CharsetNames .CS_UTF16BE : CharsetNames .CS_UTF16LE ;
188187 }
189188 try {
190- Reader r = new InputStreamReader (in , normEnc );
191- return new ReaderScanner (_config , r );
189+ return new ReaderScanner (_config , new InputStreamReader (in , normEnc ));
192190 } catch (UnsupportedEncodingException usex ) {
193191 throw new IoStreamException ("Unsupported encoding: " +usex .getMessage ());
194192 }
@@ -221,9 +219,8 @@ private void determineStreamEncoding()
221219 | ((_inputBuffer [_inputPtr +2 ] & 0xFF ) << 8 )
222220 | (_inputBuffer [_inputPtr +3 ] & 0xFF );
223221
224- /* Handling of (usually) optional BOM (required for
225- * multi-byte formats); first 32-bit charsets:
226- */
222+ // Handling of (usually) optional BOM (required for
223+ // multi-byte formats); first 32-bit charsets:
227224 switch (quartet ) {
228225 case 0x0000FEFF :
229226 mBigEndian = true ;
@@ -760,9 +757,8 @@ private void verifyEncoding(String id, int bpc)
760757 throws XMLStreamException
761758 {
762759 if (mByteSizeFound ) {
763- /* Let's verify that if we matched an encoding, it's the same
764- * as what was declared...
765- */
760+ // Let's verify that if we matched an encoding, it's the same
761+ // as what was declared...
766762 if (bpc != mBytesPerChar ) {
767763 reportXmlProblem ("Declared encoding '" +id +"' uses " +bpc
768764 +" bytes per character; but physical encoding appeared to use " +mBytesPerChar +"; cannot decode" );
0 commit comments