findbugs

Any Tools to Catch Silly Mistakes in C Code?

て烟熏妆下的殇ゞ 提交于 2019-12-04 01:17:05
I had a nasty typo that wasted my time and my colleague's time, it was something like this: for (i = 0; i < blah; i++); // <- I had a semi-colon here, that's the bug! { // Some awesome logic here } First of all, it's very embarrassing, second thing, I should never repeat this. I'm relatively new to C. In Java, I guess I can use FindBugs to catch errors like these, what tool should I use for C code? Lint? Yes, PC-Lint is probably the best tool available. Michael Burr In addition to Lykathea's PC-Lint suggestion , you can also get better (or at least more) diagnostics if you bump up the warning

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

二次信任 提交于 2019-12-04 00:52:18
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 version of a particular annotation. It could be the case that some jsr305.jar annotations should be

Java resource management: understanding Findbugs results

偶尔善良 提交于 2019-12-03 21:38:26
问题 Findbugs bugs me about a method which opens two Closeable instances, but I can't understand why. Source public static void sourceXmlToBeautifiedXml(File input, File output) throws TransformerException, IOException, JAXBException { FileReader fileReader = new FileReader(input); FileWriter fileWriter = new FileWriter(output); try { // may throw something sourceXmlToBeautifiedXml(fileReader, fileWriter); } finally { try { fileReader.close(); } finally { fileWriter.close(); } } } Findbugs

What is the meaning of Possible null pointer dereference in findbug?

左心房为你撑大大i 提交于 2019-12-03 17:07:07
问题 I am using Sonar and I have got this kind of violation from it for a peace of my code: Correctness - Possible null pointer dereference Has anyone know about this rule in findbugs? I searched a lot but I can not find a good sample code (in Java) which describe this rule, unfortunately findbugs site did not have any sample code or good description about this rule. Why does this violation appear? 回答1: It says here NP: Possible null pointer dereference (NP_NULL_ON_SOME_PATH) There is a branch of

FindBugs warning: Inefficient use of keySet iterator instead of entrySet iterator

怎甘沉沦 提交于 2019-12-03 14:35:43
问题 Please refer to the following method : public Set<LIMSGridCell> getCellsInColumn(String columnIndex){ Map<String,LIMSGridCell> cellsMap = getCellsMap(); Set<LIMSGridCell> cells = new HashSet<LIMSGridCell>(); Set<String> keySet = cellsMap.keySet(); for(String key: keySet){ if(key.startsWith(columnIndex)){ cells.add(cellsMap.get(key)); } } return cells; } FindBugs give this waring message : " Inefficient use of keySet iterator instead of entrySet iterator This method accesses the value of a Map

Findbugs vs Google CodePro AnalytiX (Eclipse plugins) [closed]

天大地大妈咪最大 提交于 2019-12-03 12:34:35
问题 As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 7 years ago . I already have used the Google CodePro AnalytiX but I never used Findbugs. My first impression with Findbugs is that it is harder to

Findbugs and Maven 3.x

笑着哭i 提交于 2019-12-03 12:19:45
Has anyone managed to get findbugs 2.3.1, 2.3.2-SNAPSHOT or 2.4-SNAPSHOT to work with a Maven 3.x project? I always end up with: [ERROR] Failed to execute goal org.codehaus.mojo:findbugs-maven-plugin:2.4-SNAPSHOT:findbugs (default-cli) on project cular-db: An error has occurred in FindBugs Report report generation. Could not find matching constructor for: org.codehaus.mojo.findbugs.FindbugsReportGenerator(org.codehaus.doxia.module.xhtml.XhtmlSink, java.util.PropertyResourceBundle, java.io.File, org.apache.maven.doxia.tools.DefaultSiteTool) I tried all the latest possible versions. It does not

eclipse/myeclipse配置*

。_饼干妹妹 提交于 2019-12-03 11:41:58
一、保存自己的工作窗口,在窗口的基础上新增自己需要的窗口,一般console/svn等窗口。 二、将eclipse所有的编码格式都设置为utf-8 如何为eclipse设置编码格式 三、配置查看文件所在的文件夹 windows 中 Eclipse 打开当前文件所在文件夹 四、将字体改为5号字体即可 eclipse怎么设置字体大小 五、 引入插件,将文件夹links,myPlugins放到eclipse的安装目录下,重启即可以引入插件了,有些插件可能eclipse已经自带了,所以引入插件前一定看一下eclipse中哪些是已经有了的,有的就不引入。 六、到svn官网下载对应版本的svn: svn官网 ,eclipse版本不同,svn版本也不同。下载的site-1.8.22.zip包,解压后将plugins和features放到你的插件库即可。 七、配置code style,导入 eclipse-java-google-style.xml(google的java编程规范,如果没配置,就用eclipse的默认编程规范) 他会自动命名成GoogleStyle。GoogleStyle的强制换行很麻烦,弄的你的代码这里换个行那里换个行,点击edit,找到Line Wrapping选项卡,将Maximum line width改成1000,以后就不会强制换行了。 八、配置save actions

What is the proper way to use a Logger in a Serializable Java class?

余生长醉 提交于 2019-12-03 10:19:43
I have the following ( doctored ) class in a system I'm working on and Findbugs is generating a SE_BAD_FIELD warning and I'm trying to understand why it would say that before I fix it in the way that I thought I would. The reason I'm confused is because the description would seem to indicate that I had used no other non-serializable instance fields in the class but bar.model.Foo is also not serializable and used in the exact same way (as far as I can tell) but Findbugs generates no warning for it. import bar.model.Foo; import java.io.File; import java.io.Serializable; import java.util.List;

Hadoop集群搭建-03编译安装hadoop

痞子三分冷 提交于 2019-12-03 09:42:04
Hadoop集群搭建-05安装配置YARN Hadoop集群搭建-04安装配置HDFS Hadoop集群搭建-03编译安装hadoop Hadoop集群搭建-02安装配置Zookeeper Hadoop集群搭建-01前期准备 hadoop的编译和安装是直接在一台机器上搞得,姑且nn1机器。 全程切换到root用户下操作 1.hadoop的一些资源在这里: https://www.lanzous.com/b849710/ 密码:9vui [hadoop@nn1 zk_op]$ su - root [root@nn1 ~]# mkdir /tmp/hadoop_c [root@nn1 ~]# cd /tmp/hadoop_c/ 用xshell的rz命令上传源码包到上面的目录。 [root@nn1 hadoop_c]# tar -xzf /tmp/hadoop_c/hadoop-2.7.3-src.tar.gz -C /usr/local/ yum安装一下乱七八糟要用到的软件和插件 yum -y install svn ncurses-devel gcc* lzo-devel zlib-devel autoconf automake libtool cmake openssl-devel bzip2 2.编译安装protobuf,谷歌的通信和存储协议,必须要用 [root@nn1 ~]#