【发布时间】:2018-06-20 13:52:27
【问题描述】:
我从 sonarqube 收到以下错误
可能会抛出“NullPointerException”; “getFolderPath()”可以返回 空。
对于以下行:
if (upstreamContent.getFolderPath() != null && !upstreamContent.getFolderPath().isEmpty()) {
...
}
upstreamContent 不能为空。
如何在不关闭规则的情况下在 sonarqube 中修复它?
更新:
有人让我显示 UpstreamContent 的来源
public class UpstreamContent {
@Nullable
private String folderPath;
...
@CheckForNull
@Nullable
public String getFolderPath() {
return folderPath;
}
public void setFolderPath(String folderPath) {
this.folderPath = folderPath;
}
}
【问题讨论】:
-
您确定刷新了 SonarCube 分析吗?我觉得没问题。
-
你能告诉
upstreamContent的类型 -
"您确定您刷新了 SonarCube 分析吗?"是的,我确定。