Skip to content

Commit

Permalink
Warnings clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
cowtowncoder committed Feb 10, 2024
1 parent 25f512b commit 85ed0e2
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@

import java.util.Arrays;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonValue;
import com.fasterxml.jackson.jr.ob.JSON;

import junit.framework.TestCase;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,14 +160,14 @@ public JSONObjectException(String msg, JsonLocation loc, Throwable rootCause) {
}

public static JSONObjectException from(JsonParser p, String msg) {
return new JSONObjectException(msg, ((p == null) ? null : p.getTokenLocation()));
return new JSONObjectException(msg, ((p == null) ? null : p.currentTokenLocation()));
}

public static JSONObjectException from(JsonParser p, String msg, Object... args) {
if (args.length > 0) {
msg = String.format(msg, args);
}
return new JSONObjectException(msg, ((p == null) ? null : p.getTokenLocation()));
return new JSONObjectException(msg, ((p == null) ? null : p.currentTokenLocation()));
}

public static JSONObjectException from(JsonParser p, Throwable problem,
Expand All @@ -176,7 +176,7 @@ public static JSONObjectException from(JsonParser p, Throwable problem,
if (args.length > 0) {
msg = String.format(msg, args);
}
return new JSONObjectException(msg, ((p == null) ? null : p.getTokenLocation()), problem);
return new JSONObjectException(msg, ((p == null) ? null : p.currentTokenLocation()), problem);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -366,9 +366,19 @@ public JsonParser getParser() {
*</code>
*
* @return Location of the input stream of the underlying parser
*
* @since 2.17
*/
public JsonLocation currentLocation() {
return _parser.currentLocation();
}

/**
* @deprecated Since 2.17 use {@link #currentLocation()} instead
*/
@Deprecated
public JsonLocation getCurrentLocation() {
return _parser.getCurrentLocation();
return currentLocation();
}

/*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ public static String _tokenDesc(JsonParser p, JsonToken t) throws IOException {
}
switch (t) {
case FIELD_NAME:
return "JSON Field name '"+p.getCurrentName()+"'";
return "JSON Field name '"+p.currentName()+"'";
case START_ARRAY:
return "JSON Array";
case START_OBJECT:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public Map<String, Object> readFromObject(JSONReader r, JsonParser p, MapBuilder
return b.emptyMap();
}
// and another for singletons...
String key = fromKey(p.getCurrentName());
String key = fromKey(p.currentName());
Object value = read(r, p);

if (p.nextValue() == JsonToken.END_OBJECT) {
Expand All @@ -106,7 +106,7 @@ public Map<String, Object> readFromObject(JSONReader r, JsonParser p, MapBuilder
try {
b = b.start().put(key, value);
do {
b = b.put(fromKey(p.getCurrentName()), read(r, p));
b = b.put(fromKey(p.currentName()), read(r, p));
} while (p.nextValue() != JsonToken.END_OBJECT);
} catch (IllegalArgumentException e) {
throw JSONObjectException.from(p, e.getMessage());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public void testAnySequence() throws Exception
// First, managed
ValueIterator<Object> it = JSON.std.anySequenceFrom(INPUT);
assertNotNull(it.getParser());
assertNotNull(it.getCurrentLocation());
assertNotNull(it.currentLocation());

_verifyAnySequence(it);
it.close();
Expand Down

0 comments on commit 85ed0e2

Please sign in to comment.