欢迎使用优快云-markdown编辑器

这篇博客详细列举了在优快云-markdown编辑器使用中遇到的Findbugs检测到的问题,包括不同类型的equals比较、不恰当的引用比较、不必要的double类型转换以及潜在的空指针异常。这些问题可能会影响代码的正确性和效率。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

About Findbugs:

  1. CALL TO EQUALS() COMPARING DIFFERENT TYPES.
    1) This method calls equals(Object) on two references of different class types and analysis suggests they will be to objects of different classes at runtime. Further, examination of the equals methods that would be invoked suggest that either this call will always return false, or else the equals method is not be symmetric (which is a property required by the contract for equals in class Object).
  2. Bug: Suspicious comparison of Integer references in com.oasys.serviceImpl.BadgeTaskServiceImpl.addBadgeTaskMgr(WorkFlowTasksModel)

This method compares two reference values using the == or != operator, where the correct way to compare instances of this type is generally with the equals() method. It is possible to create distinct instances that are equal but do not compare as == since they are different objects. Examples of classes which should generally not be compared by reference are java.lang.Integer, java.lang.Float, etc.

3.Bug: Integral value cast to double and then passed to Math.ceil in com.oasys.util.ExcelUtil.exportExcel(List, String, int, OutputStream)

This code converts an integral value (e.g., int or long) to a double precision floating point number and then passing the result to the Math.ceil() function, which rounds a double to the next higher integer value. This operation should always be a no-op, since the converting an integer to a double should give a number with no fractional part. It is likely that the operation that generated the value to be passed to Math.ceil was intended to be performed using double precision floating point arithmetic.

4.Bug: Possible null pointer dereference of null in com.oasys.listener.pd.EmpSalPositionChgApp.EmpSalPositionChgAppTaskListener.setDirectSuperiorTaskGroup(DelegateTask, Integer)

There is a branch of statement that, if executed, guarantees that a null value will be dereferenced, which would generate a NullPointerException when the code is executed. Of course, the problem might be that the branch or statement is infeasible and that the null pointer exception can’t ever be executed; deciding that is beyond the ability of FindBugs.

5.Bug: Class com.oasys.model.BusinessTripApp defines non-transient non-serializable instance field taskModel

This Serializable class defines a non-primitive instance field which is neither transient, Serializable, or java.lang.Object, and does not appear to implement the Externalizable interface or the readObject() and writeObject() methods. Objects of this class will not be deserialized correctly if a non-Serializable object is stored in this field.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值