资源预览内容
第1页 / 共24页
第2页 / 共24页
第3页 / 共24页
第4页 / 共24页
第5页 / 共24页
第6页 / 共24页
第7页 / 共24页
第8页 / 共24页
第9页 / 共24页
第10页 / 共24页
亲,该文档总共24页,到这儿已超出免费预览范围,如果喜欢就下载吧!
资源描述
FindBugs Bug DescriptionsThis document lists the standard bug patterns reported by version 0.8.5.Summary序号等级DescriptionCategory14AEC: Call to equals() with null argument调用Equal方法的参数为空Correctness15AEC: Call to equals() comparing different interface types 调用Equal方法去比较不同的接口类型Correctness16AEC: Call to equals() comparing different types调用Equal方法去比较不同的数据类型Correctness17AES: Comparison of String objects using = or !=使用= 或者 != 去比较字符串或对象Correctness29BIJU: TestCase implements setUp but doesnt call super.setUp()测试实例实现了setUp()但没有调用super.setUp()Correctness36ANP: Null pointer dereference in method方法中存在空指针Correctness37ANP: Null pointer dereference in method on exception path方法中存在某异常路径中的空指针Correctness38ANP: Possible null pointer dereference in method方法中存在可能在运行时出现的空指针异常Correctness39ANP: Possible null pointer dereference in method on exception path方法中存在可能在某些异常路径下出现的空指针异常Correctness41CNm: Class defines equal(); should it be equals()?类中定义了equal方法,但是没有重写java.lang.Object中equal方法,这也有可能是有意这么做的Correctness42BNm: Confusing method names一些方法名只有大小写的区别,容易混绕Correctness43BNm: Confusing method name方法名和其超类的类名相同Correctness44CNm: Class defines hashcode(); should it be hashCode()?类中定义了hashCode()方法,但是没有重写java.lang.Object中的hashCode()方法,这也有可能是有意这么做的Correctness45CNm: Class defines tostring(); should it be toString()?类中定义了tostring()方法,但是没有重写java.lang.Object中的tostring()方法,这也有可能是有意这么做的Correctness46ANm: Very confusing method names一些方法名只有大小写的区别,特别容易混绕Correctness47AODR: Method may fail to close database resource方法可能没有关闭数据源Correctness48AODR: Method may fail to close database resource on exception方法在异常时可能无法关闭数据源Correctness49AOS: Method may fail to close stream方法可能没有关闭流Correctness50AOS: Method may fail to close stream on exception方法在异常时可能无法关闭流Correctness53CRCN: Redundant comparision to null of previously checked value预测值的几个比较的值中有null值Correctness54CRCN: Redundant comparison to null几个比较的值中有null值Correctness57CRV: Method ignores return value方法忽略了返回值Correctness59ASI: Static initializer for class creates instance before all static final fields assigned类的静态初始化器实例化一个该类对象要在所有的常量属性定义之前Correctness72CUwF: Unwritten field永远不会写到的字段,所有读取将返回默认值Correctness83AMS: Field isnt final but should be字段应该为常量的却不是常量Malicious code vulnerability86AIS2: Inconsistent synchronization类中字段访问不同步Multithreaded correctness88AML: Method synchronizes on an updated field方法从一个可变字段对象的引用中同步。这是不太可能有用的,因为不同的线程可以在不同的对象上同步。Multithreaded correctness92CRu: Invokes run on a thread (did you mean to start it instead?)当一个类继承Runnable接口时候,还去调用run方法,实际上只需要调用Start方法就可以启动新的线程,Multithreaded correctness93CSC: Constructor invokes Thread.start()构造函数调用Thread.start()Multithreaded correctness102CDm: Method invokes dubious new String(String) constructor; just use the argument方法中调用String的构造函数来新建一个字符串,直接使用其参数即可Performance103ADm: Method invokes dubious String.equals(); use String.length() = 0 instead方法中调用了不确定的String.equals(),使用String.length() = 0来代替Performance104ADm: Method invokes toString() method on a String; just use the String方法中用一个字符串去调用方法toString(),用String就可以了Performance105CDm: Method invokes dubious new String() constructor; just use 方法中新建一个空字符串用new String()。直接用“”就可以了Performance106CFI: Empty finalizer should be deleted空finalizer()方法是没有用的,所以应该予以删除Performance114CUPM: Private method is never called这个私有方法从来没有被调用到Performance115CUrF: Unread field读不到的字段,应该从类中删除Performance116CUuF: Unused field读不到的字段,应该从类中删除PerformanceDescriptionsAM: Creates an empty jar file entryThe code calls putNextEntry(), immediately followed by a call to closeEntry(). This results in an empty JarFile entry. The contents of the entry should be written to the JarFile between the calls to putNextEntry() and closeEntry().AM: Creates an empty zip file entryThe code calls putNextEntry(), immediately followed by a call to closeEntry(). This results in an empty ZipFile entry. The contents of the entry should be written to the ZipFile between the calls to putNextEntry() and closeEntry().BIT: Incompatible bit masksThis method compares an expression of the form (a & C) to D, which will always compare unequal due to the specific values of constants C and D. This may indicate a logic error or typo.BIT: Incompatible bit masksThis method compares an expression of the form (a & 0) to 0, which will always compare equal. This may indicate a logic error or typo.BIT: Incompatible bit masksThis method compares an expression of the form (a | C) to D. which will always compare unequal due to the specific values of constants C and D. This may indicate a logic error or typo.Typically, this bug occurs because the code wants to perform a membership test in a bit set, but
收藏 下载该资源
网站客服QQ:2055934822
金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号