davidradl commented on code in PR #36:
URL:
https://github.com/apache/flink-connector-http/pull/36#discussion_r2993638484
##########
flink-connector-http/src/main/java/org/apache/flink/connector/http/table/lookup/querycreators/GenericJsonAndUrlQueryCreator.java:
##########
@@ -164,26 +164,29 @@ public LookupQueryInfo createLookupQuery(final RowData
lookupDataRow) {
/**
* Substitutes placeholders in the template with values from the JSON
object. Placeholders are
- * in the format {@code <fieldName>} where fieldName is a top-level field
in the JSON object.
+ * in the format {@code {{fieldName}}} where fieldName is a top-level
field in the JSON object.
*
* @param template the template string with placeholders
* @param jsonObject the JSON object containing field values
* @return the template with placeholders replaced by actual values
*/
private String substituteTemplate(String template, ObjectNode jsonObject) {
- java.util.regex.Pattern pattern =
java.util.regex.Pattern.compile("<([^>]+)>");
+ java.util.regex.Pattern pattern =
java.util.regex.Pattern.compile("\\{\\{([^}]+)\\}\\}");
java.util.regex.Matcher matcher = pattern.matcher(template);
- StringBuffer result = new StringBuffer();
+ StringBuilder result = new StringBuilder();
while (matcher.find()) {
String fieldName = matcher.group(1);
JsonNode fieldValue = jsonObject.get(fieldName);
if (fieldValue == null) {
- throw new IllegalArgumentException(
- String.format(
- "Template placeholder <%s> references a field
that does not exist in the lookup row",
- fieldName));
+ IllegalArgumentException illegalArgumentException =
+ new IllegalArgumentException(
+ String.format(
+ "Template placeholder {{%s}}
references a field that does not exist in the lookup row",
+ fieldName));
+ log.error(illegalArgumentException.getMessage(),
illegalArgumentException);
Review Comment:
I was not seeing this exception in the log - I want to check this
separately to ensure the message does make it to the log. Removing for now to
get this through.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]