findbugs

Is there a way to suppress FindBugs from generating warnings on code generated by static weaving?

时间秒杀一切 提交于 2019-12-07 05:41:36
问题 I'm getting what I think are false positives from FindBugs (2.0.2) and Sonar (3.7.3) on code that is being generated via static weaving of EclipseLink (2.5.1) JPA entities. Specifically, I am seeing multiple occurrences of ES_COMPARING_PARAMETER_STRING_WITH_EQ Comparison of String parameter using == or != in com.test.domain.MyEntity._persistence_set(String, Object) and URV_INHERITED_METHOD_WITH_RELATED_TYPES Inherited method com.test.domain.MyEntity._persistence_get(String) returns more

java compilation error using findbugs. com.sun.tools.javac.code.Symbol$CompletionFailure: class file for javax.annotation.meta.When not found

倖福魔咒の 提交于 2019-12-07 03:01:08
问题 I am trying to use the annotations of findbugs 1.3.2. I used the edu.umd.cs.findbugs.annotations.NonNull annotation in a simple test, and it works fine. However, now I have a large project, composed of sub-modules, using maven, and I get the following compilation error by just importing that annotation in some java file: com.sun.tools.javac.code.Symbol$CompletionFailure: class file for javax.annotation.meta.When not found what can be the problem? i tried adding the findbugs dependency in all

API incompatibility with SonarQube 5.6 and Java Analyzer 4.0 with Findbugs 3.3 or Cobertura 1.6.3

一曲冷凌霜 提交于 2019-12-07 00:16:59
问题 The analyzes of my projects are failing with SonarQube 5.6 , after updating the Java Plugin from version 3.14 to 4.0 . In my SonarQube instance, among other plugins, I currently have the Findbugs plugin (version 3.3 ) and the Cobertura plugin ( 1.6.3 ) which require the Java plugin. Looking at the log, I get the following message: [ERROR] Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.1-build231:sonar (default-cli) on project MyProject: Execution default-cli of goal

How to run findbug on the test code

倾然丶 夕夏残阳落幕 提交于 2019-12-06 13:28:47
I have a test only maven project. The folder structure is as follows project-root |_ src | |_ main | | |_ java | | |_ resources | |_ test | |_ java | |_ resources |_ .classpath |_ .project When I run the findbug plugin It do not pick the classes under test. Is there a way we can instrument the test code which is under test, to find bug? My maven pon has the below plugin under the reporting section <reporting> <plugins> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>findbugs-maven-plugin</artifactId> <version>3.0.1</version> <configuration> <threshold>low</threshold> <xmlOutput>true<

idea 常用插件

六眼飞鱼酱① 提交于 2019-12-06 10:15:36
首先说一下idea引入外部插件的方式: 1.打开settings配置面板 2.选择plugins--》install pluginfrom disk 选择相应插件包==》点击ok 最后,“ Restart ” 重启idea 让它加载一下新加入的插件!!! 常用插件: 下面的所有插件都使用上面外部引用方式集成相应的插件包即可 1. FindBugs-IDEA 作用: 检测代码中可能的bug及不规范的位置, 写完代码后检测下 避免低级bug, 静态分析工具承诺无需开发人员费劲就能找出代码中已有的缺陷。当然,如果有多年的编写经验,就会知道这些承诺并不是一定能兑现。 插件提供地址: https://plugins.jetbrains.com/plugin/3847-findbugs-idea 成功标志: 重启idea后如果插件加载成功左下角出现: 实际应用: 扫描完成后: 附录(网摘): FindBugs 它用来查找Java代码中存在的bug。它使用静态分析方法标识出Java程序中上百种潜在的不同类型的错误。 FindBugs支持对包级别、项目级别、模块级别、单个文件级别,以及自定义范围的Bug分析。 FindBugs:特色是能够检查出空指针异常这种bug! 使用:右键单击(module、单个文件等)--->在快捷菜单中选择findbugs即可 附:FindBugs的Bug种类说明 Bad

Eclipse 安装findbugs插件

喜欢而已 提交于 2019-12-06 08:30:51
官方主站: http://findbugs.sourceforge.net/index.html findbugs 在线安装 http://findbugs.cs.umd.edu/eclipse 离线安装 3.0及以上版本jdk需要达到1.7版本才可以安装 全版本下载地址: http://sourceforge.net/projects/findbugs/files/ 方式1:直接解压到eclipse dropins或者plugins目录,重启eclipse即可 方式2: 1.解压到自定义插件目录:如 MyPlugins目录 2.在dropins目录插件findbugs.link文件,在里面输入path=MyPlugins/findbugs 3.重启eclipse,如果不能安装成功,继续往下 4.进入eclipse/configuration/org.eclipse.equinox.simpleconfigurator目录下 5.编辑bundles.info文件,全文搜索edu,有无请修改或增加为以下一行内容,前后不允许有换行或者空格出现 6.edu.umd.cs.findbugs.plugin.eclipse, 3.0.1.20150306-5afe4d1 , MyPlugins/findbugs/ ,4,false 7.红色部分为插件的版本号,请修改其对应的版本号 8

Checkstyle and Findbugs for changed files only on Jenkins (and/or Hudson)

元气小坏坏 提交于 2019-12-06 03:26:23
问题 We work with a lot of legacy code and we think about introducing some metrics for new code. Is it possible to let Findbugs and Checkstyle run on changed files only instead of a complete project? It would be nice to assure that only file with a minimum of quality is checked in, but the code base itself is not (yet) touched and evaluated not to confuse people by thousands of issues. 回答1: In theory, it would be possible. You would use a shell script to parse the SVN (or whatever SCM) change logs

Suppress FindBugs warnings in Eclipse

我的未来我决定 提交于 2019-12-06 01:23:07
I am using a string as a lock and so want to ensure the object is a new instance. FindBugs complains because it's generally more efficient to define the string directly (with double quotes). My code looks like: /** A lock for the list of inputs. */ @edu.umd.cs.findbugs.annotations.SuppressWarnings("DM_STRING_CTOR") //We want a new String object here as this is a lock. private final Object inputListLock = new String("inputListLock"); Am I doing something wrong here? The Eclipse FindBugs plugin is still reporting this as a problem: Pattern id: DM_STRING_CTOR, type: Dm, category: PERFORMANCE

FindBugs - “may fail to close stream” when using ObjectOutputStream

我与影子孤独终老i 提交于 2019-12-05 22:51:26
问题 I have this piece of code, which is to write an Ojbect to a byte array stream: static byte[] toBytes(MyTokens tokens) throws IOException { ByteArrayOutputStream out = null; ObjectOutput s = null; try { out = new ByteArrayOutputStream(); try { s = new ObjectOutputStream(out); s.writeObject(tokens); } finally { try { s.close(); } catch (Exception e) { throw new CSBRuntimeException(e); } } } catch (Exception e) { throw new CSBRuntimeException(e); } finally { IOUtils.closeQuietly(out); } return

Should annotations in jar305.jar be preferred over similar annotations in annotation.jar for FindBugs?

旧街凉风 提交于 2019-12-05 14:29:43
问题 In the FindBugs distribution, annotations.jar is not a subset of jsr305.jar . However, several annotations seem to be duplicated (either exactly, or very closely). Should I prefer an annotation in jsr305.jar if I have a choice? Note that I'm not just interested in knowing that it would be "better" to use annotations from jsr305.jar simply because they represent a standard. Rather, I want to know whether the FindBugs tool will perform the same (or better) analysis if I prefer the jsr305.jar