if (null == department) {
// Throw NPE
throw new NullPointerException("department is null"); //NOI18N
- } else if (department.getDepartmentId() instanceof Long) {
- // Should not happen
- throw new IllegalArgumentException("department.departmentId should not be set."); //NOI18N
+ } else if (department.getDepartmentId() == null) {
+ // Throw NPE again
+ throw new NullPointerException("department.departmentId is null"); //NOI18N
+ } else if (department.getDepartmentId() < 1) {
+ // Throw IAE
+ throw new IllegalArgumentException(MessageFormat.format("department.departmentId={0} is not valid", department.getDepartmentId())); //NOI18N
} else if (department.getDepartmentCompany() == null) {
// Throw NPE
throw new NullPointerException("department.departmentCompany is null"); //NOI18N