summaryrefslogtreecommitdiff
path: root/groot-formats
diff options
context:
space:
mode:
authordoufenghu <[email protected]>2024-05-03 17:12:21 +0800
committerdoufenghu <[email protected]>2024-05-03 17:12:21 +0800
commit734d16598a679f63edab64b2c71afe5bfb2334f3 (patch)
tree7219dd443a06f91c08177ed86e649b5d0804d8c9 /groot-formats
parent5b847ff909a9ec55c48db254385d3f5d105479b1 (diff)
[Improve][test-e2e-kafka] Support error json format test
Diffstat (limited to 'groot-formats')
-rw-r--r--groot-formats/format-json/src/main/java/com/geedgenetworks/formats/json/JsonEventDeserializationSchema.java4
-rw-r--r--groot-formats/format-json/src/main/java/com/geedgenetworks/formats/json/JsonToMapDataConverter.java7
2 files changed, 5 insertions, 6 deletions
diff --git a/groot-formats/format-json/src/main/java/com/geedgenetworks/formats/json/JsonEventDeserializationSchema.java b/groot-formats/format-json/src/main/java/com/geedgenetworks/formats/json/JsonEventDeserializationSchema.java
index 5c51a3f..89d68e0 100644
--- a/groot-formats/format-json/src/main/java/com/geedgenetworks/formats/json/JsonEventDeserializationSchema.java
+++ b/groot-formats/format-json/src/main/java/com/geedgenetworks/formats/json/JsonEventDeserializationSchema.java
@@ -38,10 +38,10 @@ public class JsonEventDeserializationSchema implements DeserializationSchema<Eve
map = JSON.parseObject(message);
} catch (Exception e) {
if(ignoreParseErrors){
- LOG.error(String.format("json解析失败for:%s", message), e);
+ LOG.error(String.format("JSON Parse Errors:%s", message), e);
return null;
}else{
- throw new IOException(String.format("json解析失败for:%s", message), e);
+ throw new IOException(String.format("JSON Parse Errors:%s", message), e);
}
}
diff --git a/groot-formats/format-json/src/main/java/com/geedgenetworks/formats/json/JsonToMapDataConverter.java b/groot-formats/format-json/src/main/java/com/geedgenetworks/formats/json/JsonToMapDataConverter.java
index 96b55d5..f40d2e2 100644
--- a/groot-formats/format-json/src/main/java/com/geedgenetworks/formats/json/JsonToMapDataConverter.java
+++ b/groot-formats/format-json/src/main/java/com/geedgenetworks/formats/json/JsonToMapDataConverter.java
@@ -34,10 +34,8 @@ public class JsonToMapDataConverter implements Serializable {
while (!reader.nextIfMatch('}') ){
String fieldName = reader.readFieldName();
ValueConverter converter = filedConverters.get(fieldName);
- //System.out.println(fieldName);
if(converter != null){
Object rst = converter.convert(reader);
- //System.out.println(rst);
obj.put(fieldName, rst);
}else{
reader.skipValue();
@@ -46,12 +44,13 @@ public class JsonToMapDataConverter implements Serializable {
return obj;
} catch (Exception e) {
- LOG.error(String.format("json解析失败for:%s", message), e);
+
+ LOG.error(String.format("JSON Parse Errors:%s", message), e);
if(ignoreParseErrors){
return null;
}
- throw new UnsupportedOperationException("json格式不正确:" + message);
+ throw new UnsupportedOperationException("Unsupported type or invalid data format:" + message);
}
}