报告未安全关闭的 JNDI 资源。 该检查报告的 JNDI 资源包括 javax.naming.InitialContextjavax.naming.NamingEnumeration

默认情况下,该检查假定资源可以由名称中带有 'close' 或 'cleanup' 的任何方法关闭。

示例:


  Object findObject(Properties properties, String name) throws NamingException {
    Context context = new InitialContext(properties); //上下文未关闭
    return context.lookup(name);
  }

使用以下选项配置检查: