Review methods that provide variables that are known to be null
FEA: ItEr74S04BugFixing
This commit is contained in:
parent
9f11338947
commit
07d335ab17
6 changed files with 14 additions and 24 deletions
|
|
@ -25,6 +25,7 @@ import java.math.BigDecimal;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.lang.Validate;
|
||||
import org.hibernate.Criteria;
|
||||
import org.hibernate.criterion.Restrictions;
|
||||
import org.joda.time.LocalDate;
|
||||
|
|
@ -77,10 +78,7 @@ public class CostCategoryDAO extends IntegrationEntityDAO<CostCategory>
|
|||
@Override
|
||||
public CostCategory findUniqueByCode(String code)
|
||||
throws InstanceNotFoundException {
|
||||
if (code == null) {
|
||||
throw new InstanceNotFoundException(code, CostCategory.class
|
||||
.getName());
|
||||
}
|
||||
Validate.notNull(code);
|
||||
|
||||
Criteria c = getSession().createCriteria(CostCategory.class).add(
|
||||
Restrictions.eq("code", code).ignoreCase());
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ import java.util.HashSet;
|
|||
import java.util.Set;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.commons.lang.Validate;
|
||||
import org.hibernate.validator.AssertTrue;
|
||||
import org.hibernate.validator.NotNull;
|
||||
import org.hibernate.validator.Valid;
|
||||
|
|
@ -325,10 +326,7 @@ public class WorkReport extends IntegrationEntity {
|
|||
|
||||
public Label getLabelByType(LabelType type)
|
||||
throws InstanceNotFoundException {
|
||||
|
||||
if (type == null) {
|
||||
throw new InstanceNotFoundException(type, LabelType.class.getName());
|
||||
}
|
||||
Validate.notNull(type);
|
||||
|
||||
for (Label l : this.labels) {
|
||||
if (l.getType().getId().equals(type.getId())) {
|
||||
|
|
|
|||
|
|
@ -1361,7 +1361,7 @@ public class ManageOrderElementAdvancesController extends
|
|||
.canRemoveOrChange(advanceMeasurement))) {
|
||||
if (value == null) {
|
||||
advanceMeasurement.setDate(null);
|
||||
((Datebox) comp).setValue(value);
|
||||
((Datebox) comp).setValue(null);
|
||||
throw new WrongValueException(comp,
|
||||
_("The date is not valid, the date must be not empty"));
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -137,12 +137,10 @@ public abstract class AssignedMaterialsModel<T, A> implements
|
|||
|
||||
categoryDAO.reattach(materialCategory);
|
||||
final MaterialCategory parent = materialCategory.getParent();
|
||||
if (parent == null) {
|
||||
if (!materialCategories.contains(parent, materialCategory)) {
|
||||
if (!materialCategories.contains(parent, materialCategory)) {
|
||||
if (parent == null) {
|
||||
materialCategories.addToRoot(materialCategory);
|
||||
}
|
||||
} else {
|
||||
if (!materialCategories.contains(parent, materialCategory)) {
|
||||
} else {
|
||||
addCategory(materialCategories, parent);
|
||||
materialCategories.add(parent, materialCategory);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -372,17 +372,14 @@ public class TimeLineRequiredMaterialModel implements
|
|||
|
||||
categoryDAO.reattach(materialCategory);
|
||||
final MaterialCategory parent = materialCategory.getParent();
|
||||
if (parent == null) {
|
||||
if (!materialCategories.contains(parent, materialCategory)) {
|
||||
if (!materialCategories.contains(parent, materialCategory)) {
|
||||
if (parent == null) {
|
||||
materialCategories.addToRoot(materialCategory);
|
||||
addMaterials(materialCategories, materialCategory);
|
||||
}
|
||||
} else {
|
||||
if (!materialCategories.contains(parent, materialCategory)) {
|
||||
} else {
|
||||
addCategory(materialCategories, parent);
|
||||
materialCategories.add(parent, materialCategory);
|
||||
addMaterials(materialCategories, materialCategory);
|
||||
}
|
||||
addMaterials(materialCategories, materialCategory);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@ import java.util.Set;
|
|||
import javax.xml.datatype.XMLGregorianCalendar;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.commons.lang.Validate;
|
||||
import org.navalplanner.business.common.Registry;
|
||||
import org.navalplanner.business.common.exceptions.InstanceNotFoundException;
|
||||
import org.navalplanner.business.common.exceptions.ValidationException;
|
||||
|
|
@ -597,9 +598,7 @@ public final class WorkReportConverter {
|
|||
private static Label getLabelByLabelType(Set<Label> labels, LabelType type)
|
||||
throws InstanceNotFoundException {
|
||||
|
||||
if (type == null) {
|
||||
throw new InstanceNotFoundException(type, LabelType.class.getName());
|
||||
}
|
||||
Validate.notNull(type);
|
||||
|
||||
for (Label l : labels) {
|
||||
if (l.getType().equals(type)) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue