我有一个这样的课程。
public class Event {
public Event(String objectName, Integer moduleId, Integer actionId) {
if (StringUtils.nullOrEmpty(objectName)) {
throw new IllegalArgumentException("The objectName field is not supplied");
}
if (0 > moduleId || null == moduleId) {
throw new IllegalArgumentException("The moduleId field is invalid");
}
if (0 > actionId || null == actionId) {
throw new IllegalArgumentException("The actionId field is invalid");
}
objectName = objectName;
moduleId = moduleId;
actionId = actionId;
}
}
当我测试moduleId和actionId的空值时,我得到了空指针异常。但这对于objectName很好。我做错什么了吗?