boss代码review记录

发布时间 : 星期日 文章boss代码review记录更新完毕开始阅读

} if (tel == null) { if (other.tel != null) { returnfalse; } } elseif (!tel.equals(other.tel)) { returnfalse; } returntrue; } 1.22 一行代码也要有{}

1.22.1 错误示例

1.22.2 Bug描述

1.22.3 解决方案

1.23 Session

1.23.1 错误示例

1.23.2 Bug描述

Bug: Store of non serializable its.dev.riil.pojo.User into HttpSession Patternid: J2EE_STORE_OF_NON_SERIALIZABLE_OBJECT_INTO_SESSION, type: J2EE, category: BAD_PRACTICE This code seems to be storing a non-serializable object into an HttpSession. If this session is passivated or migrated, an error will result. 1.23.3 解决方案

1.24 随机数

1.24.1 错误示例

1.24.2 Bug描述

Bug: Method its.bgp.oa.client.OaClientTest.createOrg(List, int, int, String) uses the nextDouble method of Random to generate a random integer; using nextInt is more efficient Patternid: DM_NEXTINT_VIA_NEXTDOUBLE, type: Dm, category: PERFORMANCE If r is a java.util.Random, you can generate a random number from 0 to

n-1 using r.nextInt(n), rather than using (int)(r.nextDouble() * n).

1.24.3 解决方案

1.25 提交的代码要格式化

1.25.1 错误示例

1.25.2 Bug描述

1.25.3 解决方案

1.26 Findbugs自查

1.26.1 错误示例

1.26.2 Bug描述

1.26.3 解决方案

1.27 去掉重复前缀

联系合同范文客服:xxxxx#qq.com(#替换为@)