【发布时间】:2016-06-03 13:21:10
【问题描述】:
当两个列表的长度不相等时,我需要throw RuntimeException。我们正在使用SonarQube 工具进行代码审查。
代码如下:
if (objctArray.length != columnArray.length) {
throw new RuntimeException(String.format("objctArray and columnArray length is not same. objctArray length = %d, columnArray length = %d", objctArray.length, columnArray.length));
}
现在,SonarQube 在throw new RuntimeException 行提出了Define and throw a dedicated exception instead of using a generic one. 的问题。我不知道我可以替换哪个异常来解决SonarQube 问题。
【问题讨论】:
-
信息够清楚了。你有什么不明白的?