// TODO this should be generated by RegisterRule and modified in DTO.
String parentKey = null;
- if (activeRuleDto.getParentId() != null) {
- ActiveRuleDto parentDto = db.activeRuleDao().getById(session, activeRuleDto.getParentId());
+ Integer parentId = activeRuleDto.getParentId();
+ if (parentId != null) {
+ ActiveRuleDto parentDto = db.activeRuleDao().getById(session, parentId);
parentKey = parentDto.getKey().toString();
}
newRule.put(ActiveRuleField.PARENT_KEY.field(), parentKey);
import org.sonar.server.search.Result;
import javax.annotation.CheckForNull;
-import javax.annotation.Nullable;
+
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
}
@Override
- protected Rule toDoc(@Nullable Map<String, Object> fields) {
- Preconditions.checkArgument(fields != null, "Cannot construct Rule with null response!!!");
+ protected Rule toDoc(Map<String, Object> fields) {
+ Preconditions.checkNotNull(fields, "Cannot construct Rule with null response");
return new RuleDoc(fields);
}