有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

爪哇杰克逊。数据绑定。JsonNode()在null字段上返回true(不应该返回)

当像这样遍历JSONNODES列表时

 for(JsonNode result: results){
   if (predicate==Predicate.GREATER_THAN && result.has("JarVersion")){
        //gets in here even though 'JarVersion' is null
        if(result.get("JarVersion").textValue().compareTo(version) > 0)
          //fails here because nulls pass through

由于某种原因,即使结果是这样。get(“JarVersion”)返回null,它传递结果。他有一张支票

这个库的has()函数有问题吗

我查看了它,在接口上它所做的只是results.get(fieldName) != null,但是有许多空的情况通过(并破坏)我的代码


共 (0) 个答案