@@ -619,20 +619,20 @@ public final JsonToken nextToken() throws IOException
619
619
if (_parsingContext .expectComma ()) {
620
620
i = _skipComma (i );
621
621
}
622
- _updateLocation ();
623
622
624
- /* And should we now have a name? Always true for
625
- * Object contexts, since the intermediate 'expect-value'
626
- * state is never retained.
623
+ /* And should we now have a name? Always true for Object contexts, since
624
+ * the intermediate 'expect-value' state is never retained.
627
625
*/
628
626
boolean inObject = _parsingContext .inObject ();
629
627
if (inObject ) {
630
- // First, field name itself:
628
+ // First, field name itself:
629
+ _updateNameLocation ();
631
630
String name = (i == INT_QUOTE ) ? _parseName () : _handleOddName (i );
632
631
_parsingContext .setCurrentName (name );
633
632
_currToken = JsonToken .FIELD_NAME ;
634
633
i = _skipColon ();
635
634
}
635
+ _updateLocation ();
636
636
637
637
// Ok: we must have a value... what is it?
638
638
@@ -771,13 +771,14 @@ public boolean nextFieldName(SerializableString sstr) throws IOException
771
771
if (_parsingContext .expectComma ()) {
772
772
i = _skipComma (i );
773
773
}
774
- _updateLocation ();
775
774
776
775
if (!_parsingContext .inObject ()) {
776
+ _updateLocation ();
777
777
_nextTokenNotInObject (i );
778
778
return false ;
779
779
}
780
780
781
+ _updateNameLocation ();
781
782
if (i == INT_QUOTE ) {
782
783
// when doing literal match, must consider escaping:
783
784
char [] nameChars = sstr .asQuotedChars ();
@@ -849,18 +850,19 @@ public String nextFieldName() throws IOException
849
850
if (_parsingContext .expectComma ()) {
850
851
i = _skipComma (i );
851
852
}
852
-
853
- _updateLocation ();
854
853
if (!_parsingContext .inObject ()) {
854
+ _updateLocation ();
855
855
_nextTokenNotInObject (i );
856
856
return null ;
857
857
}
858
858
859
+ _updateNameLocation ();
859
860
String name = (i == INT_QUOTE ) ? _parseName () : _handleOddName (i );
860
861
_parsingContext .setCurrentName (name );
861
862
_currToken = JsonToken .FIELD_NAME ;
862
863
i = _skipColon ();
863
864
865
+ _updateLocation ();
864
866
if (i == INT_QUOTE ) {
865
867
_tokenIncomplete = true ;
866
868
_nextToken = JsonToken .VALUE_STRING ;
@@ -916,6 +918,7 @@ public String nextFieldName() throws IOException
916
918
private final void _isNextTokenNameYes (int i ) throws IOException
917
919
{
918
920
_currToken = JsonToken .FIELD_NAME ;
921
+ _updateLocation ();
919
922
920
923
switch (i ) {
921
924
case '"' :
@@ -966,6 +969,7 @@ protected boolean _isNextTokenNameMaybe(int i, String nameToMatch) throws IOExce
966
969
_parsingContext .setCurrentName (name );
967
970
_currToken = JsonToken .FIELD_NAME ;
968
971
i = _skipColon ();
972
+ _updateLocation ();
969
973
if (i == INT_QUOTE ) {
970
974
_tokenIncomplete = true ;
971
975
_nextToken = JsonToken .VALUE_STRING ;
@@ -2670,9 +2674,12 @@ protected byte[] _decodeBase64(Base64Variant b64variant) throws IOException
2670
2674
public JsonLocation getTokenLocation ()
2671
2675
{
2672
2676
final Object src = _ioContext .getSourceReference ();
2677
+ if (_currToken == JsonToken .FIELD_NAME ) {
2678
+ return new JsonLocation (src ,
2679
+ -1L , _nameInputTotal , _nameInputRow , _tokenInputCol );
2680
+ }
2673
2681
return new JsonLocation (src ,
2674
- -1L , getTokenCharacterOffset (),
2675
- getTokenLineNr (),
2682
+ -1L , _tokenInputTotal , _tokenInputRow ,
2676
2683
getTokenColumnNr ());
2677
2684
}
2678
2685
0 commit comments