摘要:
报错:Store a copy of "columnIds".
解释:漏洞都是一个类型的问题:可变类型(数组、列表)的数据应该复制一份,而不应该直接返回或直接使用
原来的代码:
public List<String> getColumnIds() {
return columnIds;
}
public void setColumnIds(List<String> columnIds) {
this.columnIds = columnIds;
}
修改后的代码:
public void setColumnIds(List<String> columnIds) {
if (null == columnIds) {
this.columnIds = new ArrayList<>();
} else {
this.columnIds = Collections.unmodifiableList(columnIds);
}
}
public List<String> getColumnIds() {
return Collections.unmodifiableList(columnIds);
}
注意:本文归作者所有,未经作者允许,不得转载