Skip to content

Bump spring-webmvc from 4.3.7.RELEASE to 5.2.20.RELEASE in /fastjson-to-easyjson #63

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,24 +17,29 @@

public class JsonNodeNavigator implements Navigator<JsonTreeNode> {
private static final Logger logger = Loggers.getLogger(ObjectNavigator.class);
private String separator;
private String prefix;
private String suffix;

public JsonNodeNavigator() {
this("/");
}

public JsonNodeNavigator(String separator) {
this.separator = Strings.isEmpty(separator) ? "/" : separator;
this(null, separator);
}

public JsonNodeNavigator(String prefix, String suffix) {
this.prefix = prefix;
this.suffix = Strings.isEmpty(suffix) ? "/" : suffix;
}

@Override
public JsonTreeNode get(JsonTreeNode context, String pathExpression) {
if (context == null) {
return null;
}

String[] segments = Strings.split(pathExpression, separator);
String[] segments = Navigators.getPathSegments(pathExpression, this.prefix, this.suffix);
return navigate(context, Collects.asList(segments));
}

Expand All @@ -56,7 +61,7 @@ private JsonTreeNode navigate(JsonTreeNode context, List<String> segments) {
int index = Numbers.createInteger(property);
node = arrayNode.get(index);
} else {
logger.warn("the node which at the path {} is not a object node or array node", Strings.join(this.separator, segments.subList(0, i + 1)));
logger.warn("the node which at the path {} is not a object node or array node", Strings.iterateJoin("", this.prefix, this.suffix, segments.subList(0, i + 1)));
node = null;
break;
}
Expand All @@ -69,7 +74,7 @@ private JsonTreeNode navigate(JsonTreeNode context, List<String> segments) {

@Override
public <E> void set(JsonTreeNode context, String expression, E value) {
String[] segments = Strings.split(expression, separator);
String[] segments = Navigators.getPathSegments(expression, this.prefix, this.suffix);
if (Objs.isEmpty(segments)) {
return;
}
Expand All @@ -87,7 +92,7 @@ public <E> void set(JsonTreeNode context, String expression, E value) {
int index = Numbers.createInteger(property);
arrayNode.set(index, JsonTreeNodes.toJsonTreeNode(value));
} else {
logger.warn("the node which at the path {} is not a object node or array node", Strings.join(this.separator, parentExprSegments));
logger.warn("the node which at the path {} is not a object node or array node", Strings.iterateJoin("", this.prefix, this.suffix, parentExprSegments));
}
} catch (Throwable ex) {
throw Throwables.wrapAsRuntimeException(ex);
Expand Down Expand Up @@ -132,12 +137,12 @@ public <E> Class<E> getType(JsonTreeNode context, String expression) {

@Override
public String getParentPath(String s) {
return Navigators.getParentPath(s, separator);
return Navigators.getParentPath(s, this.prefix, this.suffix);
}

@Override
public String getLeaf(String s) {
return Navigators.getLeaf(s, separator);
return Navigators.getLeaf(s, this.prefix, this.suffix);
}

public static <E extends JsonTreeNode> E getTreeNode(JsonTreeNode tree, String path) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ public static String toJson(Object obj) {
* @since 3.2.27
*/
public static String toJson(Object obj, boolean pretty) {
return prettyJson.toJson(obj);
return pretty ? prettyJson.toJson(obj) : toJson(obj);
}

}
2 changes: 1 addition & 1 deletion fastjson-to-easyjson/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>4.3.7.RELEASE</version>
<version>5.2.20.RELEASE</version>
<scope>provided</scope>
<optional>true</optional>
</dependency>
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
</license>
</licenses>
<properties>
<langx.version>5.0.0</langx.version>
<langx.version>5.1.0</langx.version>
<slf4j.version>1.7.0</slf4j.version>
</properties>

Expand Down