白名单 没有set 变量

This commit is contained in:
bwcx_jzy 2021-08-02 13:51:53 +08:00
parent bfef0de2ba
commit d3231191d3
2 changed files with 4 additions and 2 deletions

View File

@ -11,6 +11,7 @@ import io.jpom.system.ExtConfigBean;
import java.io.File; import java.io.File;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
@ -116,7 +117,7 @@ public class AgentWhitelist extends BaseJsonModel {
* @param jsonArray jsonArray * @param jsonArray jsonArray
* @return str * @return str
*/ */
public static String convertToLine(List<String> jsonArray) { public static String convertToLine(Collection<String> jsonArray) {
try { try {
return CollUtil.join(jsonArray, StrUtil.CRLF); return CollUtil.join(jsonArray, StrUtil.CRLF);
} catch (Exception e) { } catch (Exception e) {

View File

@ -18,6 +18,7 @@ import org.springframework.web.bind.annotation.ResponseBody;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.util.Collection;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -55,7 +56,7 @@ public class WhitelistDirectoryController extends BaseServerController {
*/ */
Field[] fields = ReflectUtil.getFields(AgentWhitelist.class); Field[] fields = ReflectUtil.getFields(AgentWhitelist.class);
for (Field field : fields) { for (Field field : fields) {
List<String> fieldValue = (List<String>) ReflectUtil.getFieldValue(agentWhitelist, field); Collection<String> fieldValue = (Collection<String>) ReflectUtil.getFieldValue(agentWhitelist, field);
map.put(field.getName(), AgentWhitelist.convertToLine(fieldValue)); map.put(field.getName(), AgentWhitelist.convertToLine(fieldValue));
} }
// map.put("project", AgentWhitelist.convertToLine(agentWhitelist.getProject())); // map.put("project", AgentWhitelist.convertToLine(agentWhitelist.getProject()));