Skip to content

Commit aa61c56

Browse files
committed
Minor warnings removal
1 parent 854db7c commit aa61c56

File tree

2 files changed

+22
-8
lines changed

2 files changed

+22
-8
lines changed

src/main/java/com/fasterxml/jackson/databind/util/TokenBufferReadContext.java

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package com.fasterxml.jackson.databind.util;
22

33
import com.fasterxml.jackson.core.*;
4+
import com.fasterxml.jackson.core.io.InputSourceReference;
45
import com.fasterxml.jackson.core.json.JsonReadContext;
56

67
/**
@@ -30,19 +31,30 @@ public class TokenBufferReadContext extends JsonStreamContext
3031

3132
protected Object _currentValue;
3233

33-
protected TokenBufferReadContext(JsonStreamContext base, Object srcRef) {
34+
/**
35+
* @since 2.13
36+
*/
37+
protected TokenBufferReadContext(JsonStreamContext base, InputSourceReference srcRef)
38+
{
3439
super(base);
3540
_parent = base.getParent();
3641
_currentName = base.getCurrentName();
3742
_currentValue = base.getCurrentValue();
3843
if (base instanceof JsonReadContext) {
3944
JsonReadContext rc = (JsonReadContext) base;
40-
_startLocation = rc.getStartLocation(srcRef);
45+
_startLocation = rc.startLocation(srcRef);
4146
} else {
4247
_startLocation = JsonLocation.NA;
4348
}
4449
}
4550

51+
@Deprecated // @since 2.13
52+
protected TokenBufferReadContext(JsonStreamContext base, Object srcRef) {
53+
this(base, (srcRef instanceof InputSourceReference) ?
54+
(InputSourceReference) srcRef :
55+
InputSourceReference.rawSource(srcRef));
56+
}
57+
4658
protected TokenBufferReadContext(JsonStreamContext base, JsonLocation startLoc) {
4759
super(base);
4860
_parent = base.getParent();

src/test/java/com/fasterxml/jackson/databind/ser/TestJacksonTypes.java

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
import java.util.*;
55

66
import com.fasterxml.jackson.core.*;
7+
import com.fasterxml.jackson.core.io.InputSourceReference;
8+
79
import com.fasterxml.jackson.databind.*;
810
import com.fasterxml.jackson.databind.util.TokenBuffer;
911

@@ -16,7 +18,8 @@ public class TestJacksonTypes
1618
public void testLocation() throws IOException
1719
{
1820
File f = new File("/tmp/test.json");
19-
JsonLocation loc = new JsonLocation(f, -1, 100, 13);
21+
JsonLocation loc = new JsonLocation(InputSourceReference.rawSource(f),
22+
-1, 100, 13);
2023
ObjectMapper mapper = new ObjectMapper();
2124
Map<String,Object> result = writeAndMap(mapper, loc);
2225
assertEquals(5, result.size());
@@ -25,7 +28,6 @@ public void testLocation() throws IOException
2528
assertEquals(Integer.valueOf(-1), result.get("byteOffset"));
2629
assertEquals(Integer.valueOf(100), result.get("lineNr"));
2730
assertEquals(Integer.valueOf(13), result.get("columnNr"));
28-
2931
}
3032

3133
/**
@@ -35,12 +37,12 @@ public void testLocation() throws IOException
3537
public void testTokenBuffer() throws Exception
3638
{
3739
// First, copy events from known good source (StringReader)
38-
JsonParser jp = createParserUsingReader(SAMPLE_DOC_JSON_SPEC);
40+
JsonParser p = createParserUsingReader(SAMPLE_DOC_JSON_SPEC);
3941
TokenBuffer tb = new TokenBuffer(null, false);
40-
while (jp.nextToken() != null) {
41-
tb.copyCurrentEvent(jp);
42+
while (p.nextToken() != null) {
43+
tb.copyCurrentEvent(p);
4244
}
43-
jp.close();
45+
p.close();
4446
// Then serialize as String
4547
String str = serializeAsString(tb);
4648
tb.close();

0 commit comments

Comments
 (0)