diff --git a/libraries/bot-ai-luis-v3/pom.xml b/libraries/bot-ai-luis-v3/pom.xml
index 6ecfe0ba0..943354b84 100644
--- a/libraries/bot-ai-luis-v3/pom.xml
+++ b/libraries/bot-ai-luis-v3/pom.xml
@@ -86,6 +86,18 @@
json
20190722
+
+ org.apache.httpcomponents
+ httpcore
+ 4.4.13
+ compile
+
+
+ org.apache.httpcomponents
+ httpclient
+ 4.5.13
+ compile
+
diff --git a/libraries/bot-ai-luis-v3/src/main/java/com/microsoft/bot/ai/luis/LuisRecognizerOptionsV3.java b/libraries/bot-ai-luis-v3/src/main/java/com/microsoft/bot/ai/luis/LuisRecognizerOptionsV3.java
index 68becc62d..bf520db6c 100644
--- a/libraries/bot-ai-luis-v3/src/main/java/com/microsoft/bot/ai/luis/LuisRecognizerOptionsV3.java
+++ b/libraries/bot-ai-luis-v3/src/main/java/com/microsoft/bot/ai/luis/LuisRecognizerOptionsV3.java
@@ -452,7 +452,7 @@ private Request buildRequest(RequestBody body) {
private RequestBody buildRequestBody(String utterance) throws JsonProcessingException {
- ObjectMapper mapper = new ObjectMapper();
+ ObjectMapper mapper = new ObjectMapper().findAndRegisterModules();
ObjectNode content = JsonNodeFactory.instance.objectNode().put("query", utterance);
ObjectNode queryOptions =
JsonNodeFactory.instance.objectNode().put("preferExternalEntities", preferExternalEntities);
@@ -482,7 +482,7 @@ private CompletableFuture recognizeInternal(TurnContext turnCo
RecognizerResult recognizerResult;
JsonNode luisResponse = null;
- ObjectMapper mapper = new ObjectMapper();
+ ObjectMapper mapper = new ObjectMapper().findAndRegisterModules();
if (utterance == null || utterance.isEmpty()) {
recognizerResult = new RecognizerResult() {
@@ -691,7 +691,7 @@ private CompletableFuture sendTraceActivity(
JsonNode luisResponse,
TurnContext turnContext
) {
- ObjectMapper mapper = new ObjectMapper();
+ ObjectMapper mapper = new ObjectMapper().findAndRegisterModules();
try {
ObjectNode traceInfo = JsonNodeFactory.instance.objectNode();
traceInfo
diff --git a/libraries/bot-ai-luis-v3/src/test/java/com/microsoft/bot/ai/luis/LuisRecognizerOptionsV3Tests.java b/libraries/bot-ai-luis-v3/src/test/java/com/microsoft/bot/ai/luis/LuisRecognizerOptionsV3Tests.java
index 60289649e..6e4c2cf04 100644
--- a/libraries/bot-ai-luis-v3/src/test/java/com/microsoft/bot/ai/luis/LuisRecognizerOptionsV3Tests.java
+++ b/libraries/bot-ai-luis-v3/src/test/java/com/microsoft/bot/ai/luis/LuisRecognizerOptionsV3Tests.java
@@ -99,7 +99,7 @@ private void shouldParseLuisResponsesCorrectly_TurnContextPassed(String fileName
String content = readFileContent("/src/test/java/com/microsoft/bot/ai/luis/testdata/" + fileName);
//Extract V3 response
- ObjectMapper mapper = new ObjectMapper();
+ ObjectMapper mapper = new ObjectMapper().findAndRegisterModules();
JsonNode testData = mapper.readTree(content);
JsonNode v3SettingsAndResponse = testData.get("v3");
JsonNode v3Response = v3SettingsAndResponse.get("response");
@@ -176,7 +176,7 @@ public void shouldBuildExternalEntities_DialogContextPassed_ExternalRecognizer()
String content = readFileContent("/src/test/java/com/microsoft/bot/ai/luis/testdata/ExternalRecognizer.json");
//Extract V3 response
- ObjectMapper mapper = new ObjectMapper();
+ ObjectMapper mapper = new ObjectMapper().findAndRegisterModules();
JsonNode testData = mapper.readTree(content);
JsonNode v3SettingsAndResponse = testData.get("v3");
JsonNode v3Response = v3SettingsAndResponse.get("response");
@@ -308,7 +308,7 @@ private String buildUrl(StringBuilder pathToMock, JsonNode testSettings) {
}
private HttpUrl initializeMockServer(MockWebServer mockWebServer, JsonNode v3Response, String url) throws IOException {
- ObjectMapper mapper = new ObjectMapper();
+ ObjectMapper mapper = new ObjectMapper().findAndRegisterModules();
String mockResponse = mapper.writeValueAsString(v3Response);
mockWebServer.enqueue(new MockResponse()
.addHeader("Content-Type", "application/json; charset=utf-8")
@@ -320,7 +320,7 @@ private HttpUrl initializeMockServer(MockWebServer mockWebServer, JsonNode v3Res
}
private LuisRecognizerOptionsV3 buildTestRecognizer (String endpoint, JsonNode testSettings) throws IOException {
- ObjectMapper mapper = new ObjectMapper();
+ ObjectMapper mapper = new ObjectMapper().findAndRegisterModules();
ObjectReader readerDynamicList = mapper.readerFor(new TypeReference>() {});
ObjectReader readerExternalentities = mapper.readerFor(new TypeReference>() {});
return new LuisRecognizerOptionsV3(
diff --git a/libraries/bot-ai-luis-v3/src/test/java/com/microsoft/bot/ai/luis/LuisRecognizerTests.java b/libraries/bot-ai-luis-v3/src/test/java/com/microsoft/bot/ai/luis/LuisRecognizerTests.java
index 307390cf8..6d07c20fc 100644
--- a/libraries/bot-ai-luis-v3/src/test/java/com/microsoft/bot/ai/luis/LuisRecognizerTests.java
+++ b/libraries/bot-ai-luis-v3/src/test/java/com/microsoft/bot/ai/luis/LuisRecognizerTests.java
@@ -142,7 +142,7 @@ public void recognizerResult() {
RecognizerResult actual = null;
try {
actual = recognizer.recognize(turnContext).get();
- ObjectMapper mapper = new ObjectMapper();
+ ObjectMapper mapper = new ObjectMapper().findAndRegisterModules();
assertEquals(mapper.writeValueAsString(expected), mapper.writeValueAsString(actual));
} catch (InterruptedException | ExecutionException | JsonProcessingException e) {
e.printStackTrace();
@@ -197,7 +197,7 @@ public void recognizerResult_nullTelemetryClient() {
RecognizerResult actual = null;
try {
actual = recognizer.recognize(turnContext).get();
- ObjectMapper mapper = new ObjectMapper();
+ ObjectMapper mapper = new ObjectMapper().findAndRegisterModules();
assertEquals(mapper.writeValueAsString(expected), mapper.writeValueAsString(actual));
} catch (InterruptedException | ExecutionException | JsonProcessingException e) {
e.printStackTrace();
@@ -256,7 +256,7 @@ public void recognizerResultDialogContext() {
LuisRecognizer recognizer = new LuisRecognizer(options);
try {
actual = recognizer.recognize(dialogContext, turnContext.getActivity()).get();
- ObjectMapper mapper = new ObjectMapper();
+ ObjectMapper mapper = new ObjectMapper().findAndRegisterModules();
assertEquals(mapper.writeValueAsString(expected), mapper.writeValueAsString(actual));
} catch (InterruptedException | ExecutionException | JsonProcessingException e) {
e.printStackTrace();
diff --git a/libraries/bot-ai-qna/src/main/java/com/microsoft/bot/ai/qna/QnAMakerRecognizer.java b/libraries/bot-ai-qna/src/main/java/com/microsoft/bot/ai/qna/QnAMakerRecognizer.java
index 6c1ddc55c..1867d8b11 100644
--- a/libraries/bot-ai-qna/src/main/java/com/microsoft/bot/ai/qna/QnAMakerRecognizer.java
+++ b/libraries/bot-ai-qna/src/main/java/com/microsoft/bot/ai/qna/QnAMakerRecognizer.java
@@ -417,7 +417,7 @@ public CompletableFuture recognize(
}
});
}
- ObjectMapper mapper = new ObjectMapper();
+ ObjectMapper mapper = new ObjectMapper().findAndRegisterModules();
ObjectNode entitiesNode = mapper.createObjectNode();
List answerArray = new ArrayList();
answerArray.add(topAnswer.getAnswer());
diff --git a/libraries/bot-ai-qna/src/main/java/com/microsoft/bot/ai/qna/utils/HttpRequestUtils.java b/libraries/bot-ai-qna/src/main/java/com/microsoft/bot/ai/qna/utils/HttpRequestUtils.java
index 5e60838c4..b76a6d8cd 100644
--- a/libraries/bot-ai-qna/src/main/java/com/microsoft/bot/ai/qna/utils/HttpRequestUtils.java
+++ b/libraries/bot-ai-qna/src/main/java/com/microsoft/bot/ai/qna/utils/HttpRequestUtils.java
@@ -53,7 +53,7 @@ public CompletableFuture executeHttpRequest(
return Async.completeExceptionally(new IllegalArgumentException("endpoint"));
}
- ObjectMapper mapper = new ObjectMapper();
+ ObjectMapper mapper = new ObjectMapper().findAndRegisterModules();
String endpointKey = endpoint.getEndpointKey();
Response response;
JsonNode qnaResponse = null;
diff --git a/libraries/bot-ai-qna/src/test/java/com/microsoft/bot/ai/qna/QnAMakerRecognizerTests.java b/libraries/bot-ai-qna/src/test/java/com/microsoft/bot/ai/qna/QnAMakerRecognizerTests.java
index 7443b01f2..4e03a4b1d 100644
--- a/libraries/bot-ai-qna/src/test/java/com/microsoft/bot/ai/qna/QnAMakerRecognizerTests.java
+++ b/libraries/bot-ai-qna/src/test/java/com/microsoft/bot/ai/qna/QnAMakerRecognizerTests.java
@@ -72,7 +72,7 @@ public void noAnswer() {
MockWebServer mockWebServer = new MockWebServer();
try {
String content = readFileContent("QnaMaker_ReturnsNoAnswer.json");
- ObjectMapper mapper = new ObjectMapper();
+ ObjectMapper mapper = new ObjectMapper().findAndRegisterModules();
JsonNode response = mapper.readTree(content);
// Set mock response in MockWebServer
String url = "/qnamaker/knowledgebases/";
@@ -114,7 +114,7 @@ public void returnAnswers() {
MockWebServer mockWebServer = new MockWebServer();
try {
String content = readFileContent("QnaMaker_ReturnsAnswer.json");
- ObjectMapper mapper = new ObjectMapper();
+ ObjectMapper mapper = new ObjectMapper().findAndRegisterModules();
JsonNode response = mapper.readTree(content);
// Set mock response in MockWebServer
String url = "/qnamaker/knowledgebases/";
@@ -154,7 +154,7 @@ public void topNAnswers() {
MockWebServer mockWebServer = new MockWebServer();
try {
String content = readFileContent("QnaMaker_TopNAnswer.json");
- ObjectMapper mapper = new ObjectMapper();
+ ObjectMapper mapper = new ObjectMapper().findAndRegisterModules();
JsonNode response = mapper.readTree(content);
// Set mock response in MockWebServer
String url = "/qnamaker/knowledgebases/";
@@ -194,7 +194,7 @@ public void returnAnswersWithIntents() {
MockWebServer mockWebServer = new MockWebServer();
try {
String content = readFileContent("QnaMaker_ReturnsAnswerWithIntent.json");
- ObjectMapper mapper = new ObjectMapper();
+ ObjectMapper mapper = new ObjectMapper().findAndRegisterModules();
JsonNode response = mapper.readTree(content);
// Set mock response in MockWebServer
String url = "/qnamaker/knowledgebases/";
@@ -237,7 +237,7 @@ private String readFileContent (String fileName) throws IOException {
}
private HttpUrl initializeMockServer(MockWebServer mockWebServer, JsonNode response, String url) throws IOException {
- ObjectMapper mapper = new ObjectMapper();
+ ObjectMapper mapper = new ObjectMapper().findAndRegisterModules();
String mockResponse = mapper.writeValueAsString(response);
mockWebServer.enqueue(new MockResponse()
.addHeader("Content-Type", "application/json; charset=utf-8")
diff --git a/libraries/bot-ai-qna/src/test/java/com/microsoft/bot/ai/qna/QnAMakerTests.java b/libraries/bot-ai-qna/src/test/java/com/microsoft/bot/ai/qna/QnAMakerTests.java
index 253908994..133c4db45 100644
--- a/libraries/bot-ai-qna/src/test/java/com/microsoft/bot/ai/qna/QnAMakerTests.java
+++ b/libraries/bot-ai-qna/src/test/java/com/microsoft/bot/ai/qna/QnAMakerTests.java
@@ -368,7 +368,7 @@ public void qnaMakerLowScoreVariation() {
MockWebServer mockWebServer = new MockWebServer();
try {
String content = readFileContent("QnaMaker_TopNAnswer.json");
- ObjectMapper mapper = new ObjectMapper();
+ ObjectMapper mapper = new ObjectMapper().findAndRegisterModules();
JsonNode response = mapper.readTree(content);
String url = this.getRequestUrl();
String endpoint = "";
@@ -421,7 +421,7 @@ public void qnaMakerLowScoreVariation() {
@Test
public void qnaMakerCallTrain() {
MockWebServer mockWebServer = new MockWebServer();
- ObjectMapper objectMapper = new ObjectMapper();
+ ObjectMapper objectMapper = new ObjectMapper().findAndRegisterModules();
String url = this.getTrainRequestUrl();
String endpoint = "";
try {
@@ -499,7 +499,7 @@ public void qnaMakerReturnsAnswerWithFiltering() {
MockWebServer mockWebServer = new MockWebServer();
try {
String content = readFileContent("QnaMaker_UsesStrictFilters_ToReturnAnswer.json");
- ObjectMapper mapper = new ObjectMapper();
+ ObjectMapper mapper = new ObjectMapper().findAndRegisterModules();
JsonNode response = mapper.readTree(content);
String url = this.getRequestUrl();
String endpoint = "";
@@ -526,7 +526,7 @@ public void qnaMakerReturnsAnswerWithFiltering() {
}
};
QnAMaker qna = new QnAMaker(qnaMakerEndpoint, qnaMakerOptions);
- ObjectMapper objectMapper = new ObjectMapper();
+ ObjectMapper objectMapper = new ObjectMapper().findAndRegisterModules();
QueryResult[] results = qna.getAnswers(getContext("how do I clean the stove?"), qnaMakerOptions).join();
Assert.assertNotNull(results);
@@ -563,7 +563,7 @@ public void qnaMakerSetScoreThresholdWhenThresholdIsZero() {
MockWebServer mockWebServer = new MockWebServer();
try {
String content = readFileContent("QnaMaker_ReturnsAnswer.json");
- ObjectMapper mapper = new ObjectMapper();
+ ObjectMapper mapper = new ObjectMapper().findAndRegisterModules();
JsonNode response = mapper.readTree(content);
String url = this.getRequestUrl();
String endpoint = "";
@@ -608,7 +608,7 @@ public void qnaMakerTestThreshold() {
MockWebServer mockWebServer = new MockWebServer();
try {
String content = readFileContent("QnaMaker_TestThreshold.json");
- ObjectMapper mapper = new ObjectMapper();
+ ObjectMapper mapper = new ObjectMapper().findAndRegisterModules();
JsonNode response = mapper.readTree(content);
String url = this.getRequestUrl();
String endpoint = "";
@@ -686,7 +686,7 @@ public void qnaMakerReturnsAnswerWithContext() {
MockWebServer mockWebServer = new MockWebServer();
try {
String content = readFileContent("QnaMaker_ReturnsAnswerWithContext.json");
- ObjectMapper mapper = new ObjectMapper();
+ ObjectMapper mapper = new ObjectMapper().findAndRegisterModules();
JsonNode response = mapper.readTree(content);
String url = this.getRequestUrl();
String endpoint = "";
@@ -737,7 +737,7 @@ public void qnaMakerReturnAnswersWithoutContext() {
MockWebServer mockWebServer = new MockWebServer();
try {
String content = readFileContent("QnaMaker_ReturnsAnswerWithoutContext.json");
- ObjectMapper mapper = new ObjectMapper();
+ ObjectMapper mapper = new ObjectMapper().findAndRegisterModules();
JsonNode response = mapper.readTree(content);
String url = this.getRequestUrl();
String endpoint = "";
@@ -780,7 +780,7 @@ public void qnaMakerReturnsHighScoreWhenIdPassed() {
MockWebServer mockWebServer = new MockWebServer();
try {
String content = readFileContent("QnaMaker_ReturnsAnswerWithContext.json");
- ObjectMapper mapper = new ObjectMapper();
+ ObjectMapper mapper = new ObjectMapper().findAndRegisterModules();
JsonNode response = mapper.readTree(content);
String url = this.getRequestUrl();
String endpoint = "";
@@ -904,7 +904,7 @@ public void qnaMakerV2LegacyEndpointShouldThrow() {
MockWebServer mockWebServer = new MockWebServer();
try {
String content = readFileContent("QnaMaker_LegacyEndpointAnswer.json");
- ObjectMapper mapper = new ObjectMapper();
+ ObjectMapper mapper = new ObjectMapper().findAndRegisterModules();
JsonNode response = mapper.readTree(content);
String url = this.getV2LegacyRequestUrl();
String endpoint = "";
@@ -938,7 +938,7 @@ public void qnaMakerV3LeagacyEndpointShouldThrow() {
MockWebServer mockWebServer = new MockWebServer();
try {
String content = readFileContent("QnaMaker_LegacyEndpointAnswer.json");
- ObjectMapper mapper = new ObjectMapper();
+ ObjectMapper mapper = new ObjectMapper().findAndRegisterModules();
JsonNode response = mapper.readTree(content);
String url = this.getV3LegacyRequestUrl();
String endpoint = "";
@@ -972,7 +972,7 @@ public void qnaMakerReturnsAnswerWithMetadataBoost() {
MockWebServer mockWebServer = new MockWebServer();
try {
String content = readFileContent("QnaMaker_ReturnsAnswersWithMetadataBoost.json");
- ObjectMapper mapper = new ObjectMapper();
+ ObjectMapper mapper = new ObjectMapper().findAndRegisterModules();
JsonNode response = mapper.readTree(content);
String url = this.getRequestUrl();
String endpoint = "";
@@ -1015,7 +1015,7 @@ public void qnaMakerTestThresholdInQueryOption() {
MockWebServer mockWebServer = new MockWebServer();
try {
String content = readFileContent("QnaMaker_ReturnsAnswer_GivenScoreThresholdQueryOption.json");
- ObjectMapper mapper = new ObjectMapper();
+ ObjectMapper mapper = new ObjectMapper().findAndRegisterModules();
JsonNode response = mapper.readTree(content);
String url = this.getRequestUrl();
String endpoint = "";
@@ -1039,7 +1039,7 @@ public void qnaMakerTestThresholdInQueryOption() {
QnAMaker qna = new QnAMaker(qnAMakerEndpoint, queryOptionsWithScoreThreshold);
- ObjectMapper objectMapper = new ObjectMapper();
+ ObjectMapper objectMapper = new ObjectMapper().findAndRegisterModules();
QueryResult[] results = qna.getAnswers(getContext("What happens when you hug a porcupine?"), queryOptionsWithScoreThreshold).join();
RecordedRequest request = mockWebServer.takeRequest();
@@ -1093,7 +1093,7 @@ public void qnaMakerIsTestTrue() {
MockWebServer mockWebServer = new MockWebServer();
try {
String content = readFileContent("QnaMaker_IsTest_True.json");
- ObjectMapper mapper = new ObjectMapper();
+ ObjectMapper mapper = new ObjectMapper().findAndRegisterModules();
JsonNode response = mapper.readTree(content);
String url = this.getRequestUrl();
String endpoint = "";
@@ -1136,7 +1136,7 @@ public void qnaMakerRankerTypeQuestionOnly() {
MockWebServer mockWebServer = new MockWebServer();
try {
String content = readFileContent("QnaMaker_RankerType_QuestionOnly.json");
- ObjectMapper mapper = new ObjectMapper();
+ ObjectMapper mapper = new ObjectMapper().findAndRegisterModules();
JsonNode response = mapper.readTree(content);
String url = this.getRequestUrl();
String endpoint = "";
@@ -1181,7 +1181,7 @@ public void qnaMakerTestOptionsHydration() {
String url = this.getRequestUrl();
String endpoint = "";
String content = readFileContent("QnaMaker_ReturnsAnswer.json");
- ObjectMapper mapper = new ObjectMapper();
+ ObjectMapper mapper = new ObjectMapper().findAndRegisterModules();
JsonNode response = mapper.readTree(content);
if (this.mockQnAResponse) {
endpoint = String.format("%s:%s", hostname, initializeMockServer(mockWebServer, response, url).port());
@@ -1248,7 +1248,7 @@ public void qnaMakerTestOptionsHydration() {
// Ensure that options from previous requests do not bleed over to the next,
// And that the options set in the constructor are not overwritten improperly by options passed into .GetAnswersAsync()
CapturedRequest[] requestContent = new CapturedRequest[6];
- ObjectMapper objectMapper = new ObjectMapper();
+ ObjectMapper objectMapper = new ObjectMapper().findAndRegisterModules();
RecordedRequest request;
qna.getAnswers(context, noFiltersOptions).join();
@@ -1315,7 +1315,7 @@ public void qnaMakerStrictFiltersCompoundOperationType() {
MockWebServer mockWebServer = new MockWebServer();
try {
String content = readFileContent("QnaMaker_ReturnsAnswer.json");
- ObjectMapper mapper = new ObjectMapper();
+ ObjectMapper mapper = new ObjectMapper().findAndRegisterModules();
JsonNode response = mapper.readTree(content);
String url = this.getRequestUrl();
String endpoint = "";
@@ -1354,7 +1354,7 @@ public void qnaMakerStrictFiltersCompoundOperationType() {
QnAMaker qna = new QnAMaker(qnAMakerEndpoint, oneFilteredOption);
TurnContext context = getContext("up");
- ObjectMapper objectMapper = new ObjectMapper();
+ ObjectMapper objectMapper = new ObjectMapper().findAndRegisterModules();
QueryResult[] noFilterResults1 = qna.getAnswers(context, oneFilteredOption).join();
RecordedRequest request = mockWebServer.takeRequest();
@@ -1378,7 +1378,7 @@ public void telemetryNullTelemetryClient() {
MockWebServer mockWebServer = new MockWebServer();
try {
String content = readFileContent("QnaMaker_ReturnsAnswer.json");
- ObjectMapper mapper = new ObjectMapper();
+ ObjectMapper mapper = new ObjectMapper().findAndRegisterModules();
JsonNode response = mapper.readTree(content);
String url = this.getRequestUrl();
String endpoint = "";
@@ -1426,7 +1426,7 @@ public void telemetryReturnsAnswer() {
MockWebServer mockWebServer = new MockWebServer();
try {
String content = readFileContent("QnaMaker_ReturnsAnswer.json");
- ObjectMapper mapper = new ObjectMapper();
+ ObjectMapper mapper = new ObjectMapper().findAndRegisterModules();
JsonNode response = mapper.readTree(content);
String url = this.getRequestUrl();
String endpoint = "";
@@ -1494,7 +1494,7 @@ public void telemetryReturnsAnswerWhenNoAnswerFoundInKB() {
MockWebServer mockWebServer = new MockWebServer();
try {
String content = readFileContent("QnaMaker_ReturnsAnswer_WhenNoAnswerFoundInKb.json");
- ObjectMapper mapper = new ObjectMapper();
+ ObjectMapper mapper = new ObjectMapper().findAndRegisterModules();
JsonNode response = mapper.readTree(content);
String url = this.getRequestUrl();
String endpoint = "";
@@ -1562,7 +1562,7 @@ public void telemetryPii() {
MockWebServer mockWebServer = new MockWebServer();
try {
String content = readFileContent("QnaMaker_ReturnsAnswer.json");
- ObjectMapper mapper = new ObjectMapper();
+ ObjectMapper mapper = new ObjectMapper().findAndRegisterModules();
JsonNode response = mapper.readTree(content);
String url = this.getRequestUrl();
String endpoint = "";
@@ -1632,7 +1632,7 @@ public void telemetryOverride() {
MockWebServer mockWebServer = new MockWebServer();
try {
String content = readFileContent("QnaMaker_ReturnsAnswer.json");
- ObjectMapper mapper = new ObjectMapper();
+ ObjectMapper mapper = new ObjectMapper().findAndRegisterModules();
JsonNode response = mapper.readTree(content);
String url = this.getRequestUrl();
String endpoint = "";
@@ -1706,7 +1706,7 @@ public void telemetryAdditionalPropsMetrics() {
MockWebServer mockWebServer = new MockWebServer();
try {
String content = readFileContent("QnaMaker_ReturnsAnswer.json");
- ObjectMapper mapper = new ObjectMapper();
+ ObjectMapper mapper = new ObjectMapper().findAndRegisterModules();
JsonNode response = mapper.readTree(content);
String url = this.getRequestUrl();
String endpoint = "";
@@ -1793,7 +1793,7 @@ public void telemetryAdditionalPropsOverride() {
MockWebServer mockWebServer = new MockWebServer();
try {
String content = readFileContent("QnaMaker_ReturnsAnswer.json");
- ObjectMapper mapper = new ObjectMapper();
+ ObjectMapper mapper = new ObjectMapper().findAndRegisterModules();
JsonNode response = mapper.readTree(content);
String url = this.getRequestUrl();
String endpoint = "";
@@ -1876,7 +1876,7 @@ public void telemetryFillPropsOverride() {
MockWebServer mockWebServer = new MockWebServer();
try {
String content = readFileContent("QnaMaker_ReturnsAnswer.json");
- ObjectMapper mapper = new ObjectMapper();
+ ObjectMapper mapper = new ObjectMapper().findAndRegisterModules();
JsonNode response = mapper.readTree(content);
String url = this.getRequestUrl();
String endpoint = "";
@@ -2030,7 +2030,7 @@ public CompletableFuture resumeDialog(DialogContext dc, Dialog
private QnAMaker qnaReturnsAnswer(MockWebServer mockWebServer) {
try {
String content = readFileContent("QnaMaker_ReturnsAnswer.json");
- ObjectMapper mapper = new ObjectMapper();
+ ObjectMapper mapper = new ObjectMapper().findAndRegisterModules();
JsonNode response = mapper.readTree(content);
String url = this.getRequestUrl();
String endpoint = "";
@@ -2065,7 +2065,7 @@ private String readFileContent (String fileName) throws IOException {
}
private HttpUrl initializeMockServer(MockWebServer mockWebServer, JsonNode response, String url) throws IOException {
- ObjectMapper mapper = new ObjectMapper();
+ ObjectMapper mapper = new ObjectMapper().findAndRegisterModules();
String mockResponse = mapper.writeValueAsString(response);
mockWebServer.enqueue(new MockResponse()
.addHeader("Content-Type", "application/json; charset=utf-8")
@@ -2080,7 +2080,7 @@ private HttpUrl initializeMockServer(MockWebServer mockWebServer, JsonNode respo
}
private void enqueueResponse(MockWebServer mockWebServer, JsonNode response) throws JsonProcessingException {
- ObjectMapper mapper = new ObjectMapper();
+ ObjectMapper mapper = new ObjectMapper().findAndRegisterModules();
String mockResponse = mapper.writeValueAsString(response);
mockWebServer.enqueue(new MockResponse()
.addHeader("Content-Type", "application/json; charset=utf-8")
diff --git a/libraries/bot-builder/src/main/java/com/microsoft/bot/builder/BotFrameworkAdapter.java b/libraries/bot-builder/src/main/java/com/microsoft/bot/builder/BotFrameworkAdapter.java
index c3d366c2e..60e0e8f44 100644
--- a/libraries/bot-builder/src/main/java/com/microsoft/bot/builder/BotFrameworkAdapter.java
+++ b/libraries/bot-builder/src/main/java/com/microsoft/bot/builder/BotFrameworkAdapter.java
@@ -1302,7 +1302,8 @@ public CompletableFuture onTurn(TurnContext turnContext, NextDelegate next
&& turnContext.getActivity().getConversation() != null
&& StringUtils.isEmpty(turnContext.getActivity().getConversation().getTenantId())) {
- JsonNode teamsChannelData = new ObjectMapper().valueToTree(turnContext.getActivity().getChannelData());
+ ObjectMapper mapper = new ObjectMapper().findAndRegisterModules();
+ JsonNode teamsChannelData = mapper.valueToTree(turnContext.getActivity().getChannelData());
if (teamsChannelData != null && teamsChannelData.has("tenant")
&& teamsChannelData.get("tenant").has("id")) {
diff --git a/libraries/bot-builder/src/main/java/com/microsoft/bot/builder/BotState.java b/libraries/bot-builder/src/main/java/com/microsoft/bot/builder/BotState.java
index 5c56dfbff..e3f7fe8a7 100644
--- a/libraries/bot-builder/src/main/java/com/microsoft/bot/builder/BotState.java
+++ b/libraries/bot-builder/src/main/java/com/microsoft/bot/builder/BotState.java
@@ -38,6 +38,8 @@ public abstract class BotState implements PropertyManager {
*/
private Storage storage;
+ private ObjectMapper mapper = new ObjectMapper().findAndRegisterModules();
+
/**
* Initializes a new instance of the BotState class.
*
@@ -221,7 +223,7 @@ public JsonNode get(TurnContext turnContext) {
String stateKey = getClass().getSimpleName();
CachedBotState cachedState = turnContext.getTurnState().get(stateKey);
- return new ObjectMapper().valueToTree(cachedState.state);
+ return mapper.valueToTree(cachedState.state);
}
/**
@@ -355,7 +357,7 @@ public static class CachedBotState {
/**
* Object-JsonNode converter.
*/
- private ObjectMapper mapper = new ObjectMapper();
+ private ObjectMapper mapper = new ObjectMapper().findAndRegisterModules();
/**
* Construct with empty state.
diff --git a/libraries/bot-builder/src/main/java/com/microsoft/bot/builder/teams/TeamsActivityHandler.java b/libraries/bot-builder/src/main/java/com/microsoft/bot/builder/teams/TeamsActivityHandler.java
index 4831fffe6..3d51319f4 100644
--- a/libraries/bot-builder/src/main/java/com/microsoft/bot/builder/teams/TeamsActivityHandler.java
+++ b/libraries/bot-builder/src/main/java/com/microsoft/bot/builder/teams/TeamsActivityHandler.java
@@ -663,7 +663,7 @@ protected CompletableFuture onTeamsMembersAddedDispatch(
TeamInfo teamInfo,
TurnContext turnContext
) {
- ObjectMapper mapper = new ObjectMapper();
+ ObjectMapper mapper = new ObjectMapper().findAndRegisterModules();
mapper.findAndRegisterModules();
List teamsMembersAdded = new ArrayList<>();
@@ -731,7 +731,7 @@ protected CompletableFuture onTeamsMembersRemovedDispatch(
TeamInfo teamInfo,
TurnContext turnContext
) {
- ObjectMapper mapper = new ObjectMapper();
+ ObjectMapper mapper = new ObjectMapper().findAndRegisterModules();
mapper.findAndRegisterModules();
List teamsMembersRemoved = new ArrayList<>();
diff --git a/libraries/bot-connector/pom.xml b/libraries/bot-connector/pom.xml
index f892898cd..38999fc5a 100644
--- a/libraries/bot-connector/pom.xml
+++ b/libraries/bot-connector/pom.xml
@@ -58,7 +58,6 @@
com.google.guava
guava
- 30.1-jre
@@ -93,7 +92,7 @@
commons-codec
commons-codec
- 1.11
+ 1.15
@@ -188,4 +187,30 @@
+
+
+
+
+ org.apache.maven.plugins
+ maven-pmd-plugin
+ ${pmd.version}
+
+
+ org.apache.maven.plugins
+ maven-checkstyle-plugin
+ ${checkstyle.version}
+
+ com/microsoft/bot/restclient/**
+
+
+
+
+ checkstyle
+
+
+
+
+
+
+
diff --git a/libraries/bot-connector/src/main/java/com/microsoft/bot/restclient/interceptors/LoggingInterceptor.java b/libraries/bot-connector/src/main/java/com/microsoft/bot/restclient/interceptors/LoggingInterceptor.java
index 7b11988df..684254f80 100644
--- a/libraries/bot-connector/src/main/java/com/microsoft/bot/restclient/interceptors/LoggingInterceptor.java
+++ b/libraries/bot-connector/src/main/java/com/microsoft/bot/restclient/interceptors/LoggingInterceptor.java
@@ -34,7 +34,7 @@
public class LoggingInterceptor implements Interceptor {
private static final String LOGGING_HEADER = "x-ms-logging-context";
private static final String BODY_LOGGING = "x-ms-body-logging";
- private static final ObjectMapper MAPPER = new ObjectMapper();
+ private static final ObjectMapper MAPPER = new ObjectMapper().findAndRegisterModules();
private LogLevel logLevel;
/**
diff --git a/libraries/bot-dialogs/pom.xml b/libraries/bot-dialogs/pom.xml
index 329cf00b5..fd9f09e51 100644
--- a/libraries/bot-dialogs/pom.xml
+++ b/libraries/bot-dialogs/pom.xml
@@ -56,13 +56,16 @@
com.microsoft.azure
azure-documentdb
- 2.6.0
+ 2.6.1
+ test
com.azure
azure-storage-blob
- 12.8.0
+ 12.10.0
+ test
+
com.microsoft.bot
bot-integration-core
@@ -79,10 +82,10 @@
test-jar
test
+
com.google.guava
guava
- 24.1.1-jre
org.javatuples
@@ -92,12 +95,11 @@
org.apache.commons
commons-lang3
- 3.7
org.yaml
snakeyaml
- 1.20
+ 1.27
@@ -149,4 +151,30 @@
+
+
+
+
+ org.apache.maven.plugins
+ maven-pmd-plugin
+ ${pmd.version}
+
+
+ org.apache.maven.plugins
+ maven-checkstyle-plugin
+ ${checkstyle.version}
+
+ com/microsoft/recognizers/**
+
+
+
+
+ checkstyle
+
+
+
+
+
+
+
diff --git a/libraries/bot-dialogs/src/main/java/com/microsoft/bot/dialogs/DialogSet.java b/libraries/bot-dialogs/src/main/java/com/microsoft/bot/dialogs/DialogSet.java
index c5cbb4b61..63fdcd743 100644
--- a/libraries/bot-dialogs/src/main/java/com/microsoft/bot/dialogs/DialogSet.java
+++ b/libraries/bot-dialogs/src/main/java/com/microsoft/bot/dialogs/DialogSet.java
@@ -13,16 +13,16 @@
import java.nio.charset.StandardCharsets;
import java.util.Collection;
+import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.CompletableFuture;
-import org.apache.commons.collections4.map.HashedMap;
import org.apache.commons.lang3.StringUtils;
/**
* A collection of Dialog objects that can all call each other.
*/
public class DialogSet {
- private Map dialogs = new HashedMap<>();
+ private Map dialogs = new HashMap<>();
private StatePropertyAccessor dialogState;
@JsonIgnore
private BotTelemetryClient telemetryClient;
diff --git a/libraries/bot-dialogs/src/main/java/com/microsoft/bot/dialogs/ObjectPath.java b/libraries/bot-dialogs/src/main/java/com/microsoft/bot/dialogs/ObjectPath.java
index 61e3c31e3..ce3c6e002 100644
--- a/libraries/bot-dialogs/src/main/java/com/microsoft/bot/dialogs/ObjectPath.java
+++ b/libraries/bot-dialogs/src/main/java/com/microsoft/bot/dialogs/ObjectPath.java
@@ -22,73 +22,8 @@
import java.util.Set;
import java.util.function.BiConsumer;
import java.util.stream.Collectors;
-import org.apache.commons.collections4.IteratorUtils;
import org.apache.commons.lang3.StringUtils;
-/**
- * Generic Arraylist of Object.
- */
-class Segments extends ArrayList