类型: 安全缺陷
程序中采用了硬编码方式处理邮箱地址,一方面会降低系统安全性,另一方面不易于程序维护。
public class UserDAO {private static Map<Integer, User> users = new LinkedHashMap<Integer, User>();static {users.put(1001, new User(1001, "韩信", 30, "18984758285", "hanxin@126.com"));users.put(1002, new User(1002, "张良", 30, "18366666678", "zhangliang@163.com"));users.put(1003, new User(1003, "萧何", 47, "18922220007", "xiaohe@s163.com"));// ...}// 用户信息的增删改查方法// ...}public class User {private int id;private String name;private int age;private String tel;private String email;public User() {}public User(int id, String name, int age, String tel, String email) {this.id = id;this.name = name;this.age = age;this.tel = tel;this.email = email;}// Getter and Setter// ...}
