不好意思,忘了写这个方法了 在Emp里加个这个 /* * 非法输入将不改变 * */ public void update(String email,String phoneNum,String re) throws InputErrorException { if(!email.equals("")&& email.matches("\\w+@\\w+\\.\\w+")) this.email=email; if(!phoneNum.equals("")&&! phoneNum.matches("\\d+")) throw new InputErrorException("the phone number is wrong !!!"); this.phoneNum=phoneNum; if(!re.equals("")&&re.length()>256) throw new InputErrorException("re is too long ,it should less than 256 chars"); this.re=re; }
在Emp里加个这个
/*
* 非法输入将不改变
* */
public void update(String email,String phoneNum,String re) throws InputErrorException {
if(!email.equals("")&& email.matches("\\w+@\\w+\\.\\w+"))
this.email=email;
if(!phoneNum.equals("")&&! phoneNum.matches("\\d+")) throw new InputErrorException("the phone number is wrong !!!");
this.phoneNum=phoneNum;
if(!re.equals("")&&re.length()>256) throw new InputErrorException("re is too long ,it should less than 256 chars");
this.re=re;
}