当前位置:网站首页>Arrays Aslist uses bug
Arrays Aslist uses bug
2022-06-22 17:12:00 【Seven days at night】
After using the code scanning tool , Found code
obj.andIn("id", Arrays.asList(arr));
Prompt here BUG,BUG The message is :
Bug: int[] passed to varargs method java.util.Arrays.asList(Object[]) in com.vs.api.impl.VsMpExaminationPaperServiceImpl.changePublish(Integer, Integer)
This code passes a primitive array to a function that takes a variable number of object arguments. This creates an array of length one to hold the primitive array and passes it to the function.
Rank: Scary (7), confidence: High
Pattern: VA_PRIMITIVE_ARRAY_PASSED_TO_OBJECT_VARARG
Type: VA, Category: CORRECTNESS (Correctness)
After in-depth understanding, we found that :
Use new ArrayList<>(Arrays.asList(arr)) The way ,Arrays.asList() The output value of is passed to ArrayList Constructor , Then a reference will be created arr Of elements in the array ArrayList, So the results of the disruption will not be synchronized to arr Array to . If used directly Arrays.asList(arr) Result , The results will be synchronized to arr Array . Lead to arr The elements in the array will also be scrambled .
边栏推荐
- spark关于数据倾斜问题
- Post to asp Net core length limitation and solution when transferring data
- QT notes qmap user defined key
- In the era of video explosion, who is supporting the high-speed operation of video ecological network?
- 【招聘】[北京中关村/远程][TensorBase][开源数据仓库]等一群人,做一件事
- 图计算Hama-BSP模型的运行流程
- Apache ShardingSphere 一文读懂
- Blazor University (31)表单 —— 验证
- Hydra installation and use
- Team management | how to improve the thinking skills of technical leaders?
猜你喜欢

每秒处理10万高并发订单的乐视集团支付系统架构分享

网传学习通1.7亿密码泄露!有什么补救措施?

Tried several report tools, and finally found a report based on Net 6

系统吞吐量、TPS(QPS)、用户并发量、性能测试概念和公式
Database mysql master-slave scheme

web技术分享| 【高德地图】实现自定义的轨迹回放

Partage de l'architecture du système de paiement du Groupe letv pour traiter 100 000 commandes simultanées élevées par seconde

Qt笔记-QMap自定义键(key)

Blazor University (31)表单 —— 验证

高可用性的ResourceManager
随机推荐
What is a flush? Is online account opening safe?
MYSQL_ ERRNO : 1292 Truncated incorrect date value At add_ num :1
spark-shuffle的写入器源码分析
Apache ShardingSphere 一文读懂
Spark on data skew
【阿里云服务器-安装mysql的5.6版本安装,重装】
Web technology sharing | [Gaode map] to realize customized track playback
High availability ResourceManager
网传学习通1.7亿密码泄露!有什么补救措施?
C#-Linq源码解析之DefaultIfEmpty
Docker 之MySQL 重启,提示Error response from daemon: driver failed programming external connectivity on **
scala-for推导:能够在for表达式中的最初部分定义值,并在(外面)后面的表达式中使用该值
Special research on Intelligent upgrading of heavy trucks in China in 2022
redis.clients.jedis.exceptions.JedisDataException ERR invalid password.
spark-cache的源码分析
Scala equality
[pop up box 2 at the bottom of wechat applet package]
Mybaits:常用数据库操作(东软的操作)
Examples of MySQL account addition, deletion, modification, data import and export commands
scala的相等性