Java 如何揭示FileInputStream的弱点?

Java 如何揭示FileInputStream的弱点?,java,sonarqube,sonarqube-scan,Java,Sonarqube,Sonarqube Scan,SonarQube 6.5不抱怨以下代码: private static Properties loadProperties(File file) throws IOException { Properties properties = new Properties(); properties.load(new FileInputStream(file)); return properties; } 我在这里看到至少两个星期: 溪流没有关闭 是否有规则可以激活,以检测

SonarQube 6.5不抱怨以下代码:

private static Properties loadProperties(File file) throws IOException {
    Properties properties = new Properties();
    properties.load(new FileInputStream(file));
    return properties;
}
我在这里看到至少两个星期:

  • 溪流没有关闭

  • 是否有规则可以激活,以检测此类异常