Upgrade some deps to their major/minor versions
* Manage `com.google.protobuf` to generate classes from Protos on the fly * Fix Jackson API usage after its upgrade
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2022 the original author or authors.
|
||||
* Copyright 2002-2024 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -33,7 +33,7 @@ import org.springframework.util.Assert;
|
||||
/**
|
||||
* {@link JsonInboundMessageMapper.JsonMessageParser} implementation that parses JSON messages
|
||||
* and builds a {@link Message} with the specified payload type from provided {@link JsonInboundMessageMapper}.
|
||||
* Uses Jackson 2 JSON-processor (@link https://github.com/FasterXML).
|
||||
* Uses <a href="https://github.com/FasterXML">Jackson JSON Processor</a>.
|
||||
*
|
||||
* @author Artem Bilan
|
||||
* @author Gary Russell
|
||||
@@ -71,16 +71,17 @@ public class Jackson2JsonMessageParser extends AbstractJacksonJsonMessageParser<
|
||||
Object payload = null;
|
||||
while (JsonToken.END_OBJECT != parser.nextToken()) {
|
||||
Assert.isTrue(JsonToken.FIELD_NAME == parser.getCurrentToken(), error);
|
||||
boolean isHeadersToken = "headers".equals(parser.getCurrentName());
|
||||
boolean isPayloadToken = "payload".equals(parser.getCurrentName());
|
||||
String currentName = parser.currentName();
|
||||
boolean isHeadersToken = "headers".equals(currentName);
|
||||
boolean isPayloadToken = "payload".equals(currentName);
|
||||
Assert.isTrue(isHeadersToken || isPayloadToken, error);
|
||||
if (isHeadersToken) {
|
||||
Assert.isTrue(parser.nextToken() == JsonToken.START_OBJECT, error);
|
||||
headers = readHeaders(parser, jsonMessage);
|
||||
}
|
||||
else if (isPayloadToken) {
|
||||
else {
|
||||
parser.nextToken();
|
||||
payload = this.readPayload(parser, jsonMessage);
|
||||
payload = readPayload(parser, jsonMessage);
|
||||
}
|
||||
}
|
||||
Assert.notNull(headers, error);
|
||||
@@ -99,9 +100,9 @@ public class Jackson2JsonMessageParser extends AbstractJacksonJsonMessageParser<
|
||||
private Map<String, Object> readHeaders(JsonParser parser, String jsonMessage) throws IOException {
|
||||
Map<String, Object> headers = new LinkedHashMap<>();
|
||||
while (JsonToken.END_OBJECT != parser.nextToken()) {
|
||||
String headerName = parser.getCurrentName();
|
||||
String headerName = parser.currentName();
|
||||
parser.nextToken();
|
||||
Object headerValue = this.readHeader(parser, headerName, jsonMessage);
|
||||
Object headerValue = readHeader(parser, headerName, jsonMessage);
|
||||
headers.put(headerName, headerValue);
|
||||
}
|
||||
return headers;
|
||||
|
||||
Reference in New Issue
Block a user