11using J2N ;
22using J2N . Text ;
33using Lucene . Net . Diagnostics ;
4- using Lucene . Net . Support ;
54using System ;
65using System . Diagnostics . CodeAnalysis ;
76using System . Runtime . CompilerServices ;
@@ -887,7 +886,7 @@ public static string ToHexString(string s)
887886 /// it doesn't provide enough space to hold the worst case of each byte becoming a UTF-16 codepoint.
888887 /// <para/>
889888 /// NOTE: Full characters are read, even if this reads past the length passed (and
890- /// can result in an <see cref="IndexOutOfRangeException "/> if invalid UTF-8 is passed).
889+ /// can result in an <see cref="FormatException "/> if invalid UTF-8 is passed).
891890 /// Explicit checks for valid UTF-8 are not performed.
892891 /// </summary>
893892 /// <seealso cref="UTF8toUTF16(ReadOnlySpan{byte}, CharsRef)"/>
@@ -902,7 +901,7 @@ public static void UTF8toUTF16(byte[] utf8, int offset, int length, CharsRef cha
902901 /// it doesn't provide enough space to hold the worst case of each byte becoming a UTF-16 codepoint.
903902 /// <para/>
904903 /// NOTE: Full characters are read, even if this reads past the length passed (and
905- /// can result in an <see cref="IndexOutOfRangeException "/> if invalid UTF-8 is passed).
904+ /// can result in an <see cref="FormatException "/> if invalid UTF-8 is passed).
906905 /// Explicit checks for valid UTF-8 are not performed.
907906 /// </summary>
908907 /// <remarks>
@@ -927,15 +926,15 @@ public static void UTF8toUTF16(ReadOnlySpan<byte> utf8, CharsRef chars)
927926 {
928927 if ( utf8 . Length <= i )
929928 {
930- throw new ParseException ( $ "Invalid UTF-8 starting at [{ b : x2} ] at offset { i - 1 } ", i - 1 ) ;
929+ throw new FormatException ( $ "Invalid UTF-8 starting at [{ b : x2} ] at offset { i - 1 } ") ;
931930 }
932931 @out [ out_offset ++ ] = ( char ) ( ( ( b & 0x1f ) << 6 ) + ( utf8 [ i ++ ] & 0x3f ) ) ;
933932 }
934933 else if ( b < 0xf0 )
935934 {
936935 if ( utf8 . Length <= i + 1 )
937936 {
938- throw new ParseException ( $ "Invalid UTF-8 starting at [{ b : x2} ] at offset { i - 1 } ", i - 1 ) ;
937+ throw new FormatException ( $ "Invalid UTF-8 starting at [{ b : x2} ] at offset { i - 1 } ") ;
939938 }
940939 @out [ out_offset ++ ] = ( char ) ( ( ( b & 0xf ) << 12 ) + ( ( utf8 [ i ] & 0x3f ) << 6 ) + ( utf8 [ i + 1 ] & 0x3f ) ) ;
941940 i += 2 ;
@@ -944,7 +943,7 @@ public static void UTF8toUTF16(ReadOnlySpan<byte> utf8, CharsRef chars)
944943 {
945944 if ( utf8 . Length <= i + 2 )
946945 {
947- throw new ParseException ( $ "Invalid UTF-8 starting at [{ b : x2} ] at offset { i - 1 } ", i - 1 ) ;
946+ throw new FormatException ( $ "Invalid UTF-8 starting at [{ b : x2} ] at offset { i - 1 } ") ;
948947 }
949948 if ( Debugging . AssertsEnabled ) Debugging . Assert ( b < 0xf8 , "b = 0x{0:x}" , b ) ;
950949 int ch = ( ( b & 0x7 ) << 18 ) + ( ( utf8 [ i ] & 0x3f ) << 12 ) + ( ( utf8 [ i + 1 ] & 0x3f ) << 6 ) + ( utf8 [ i + 2 ] & 0x3f ) ;
0 commit comments