尝试从表中获取数据时出现以下错误。
java.io.EOFException: No content to map to Object due to end of input
错误发生在下面一行:
try {
if (pgObject == null) {
return new ObjectMapper().readValue("", Map.class); // error here
}else {
return new ObjectMapper().readValue(pgObject.getValue(), Map.class);
}
} catch (IOException e) {
// System.out.println("Exception Occured in json converter 1");
e.printStackTrace();
return null;
}
最佳答案
要返回空 map ,您必须使用以下内容:
mapper.readValue("{}", Map.class);
因为空字符串 ""
并不意味着空 JSON。空 JSON 由 {}
指示。在类似的行上,JSON 中的空数组由 []
关于java.io.EOFException : No content to map to Object due to end of input while retrieving data,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59043316/