refactor: update CSV response handling to return true for empty or null responses

This commit is contained in:
extio-de
2026-06-28 15:18:46 +02:00
parent b617def2f8
commit e18880354e
3 changed files with 9 additions and 5 deletions

View File

@@ -3,8 +3,8 @@ package de.extio.lmlib.agent.responsehandler;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.regex.Pattern;
import java.util.function.BiConsumer;
import java.util.regex.Pattern;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -62,7 +62,7 @@ public class CsvAgentResponseHandler implements StreamedAgentResponseHandler {
final String resp = completion.response();
if (resp == null || resp.isBlank()) {
LOGGER.warn("Empty completion response for CSV parsing");
return false;
return true;
}
try {

View File

@@ -90,7 +90,7 @@ public class CsvUnmarshallingAgentResponseHandler implements AgentResponseHandle
final String resp = completion.response();
if (resp == null || resp.isBlank()) {
LOGGER.warn("Empty completion response for CSV parsing");
return false;
return true;
}
try {

View File

@@ -235,7 +235,9 @@ public class CsvAgentResponseHandlerTest {
final Completion completion = new Completion("", null, null, null);
final boolean result = handler.handle(completion, context);
assertFalse(result);
assertTrue(result);
assertTrue(context.getStringValues("empty_a") == null || context.getStringValues("empty_a").isEmpty());
assertTrue(context.getStringValues("empty_b") == null || context.getStringValues("empty_b").isEmpty());
}
@Test
@@ -247,7 +249,9 @@ public class CsvAgentResponseHandlerTest {
final Completion completion = new Completion(null, null, null, null);
final boolean result = handler.handle(completion, context);
assertFalse(result);
assertTrue(result);
assertTrue(context.getStringValues("null_a") == null || context.getStringValues("null_a").isEmpty());
assertTrue(context.getStringValues("null_b") == null || context.getStringValues("null_b").isEmpty());
}
@Test