fixed potential nullpointer issues in DeploymentUtil.java class
diff --git a/plugins/org.eclipse.app4mc.amalthea.model/src/org/eclipse/app4mc/amalthea/model/util/DeploymentUtil.java b/plugins/org.eclipse.app4mc.amalthea.model/src/org/eclipse/app4mc/amalthea/model/util/DeploymentUtil.java
index d8b74cd..3dae0f3 100644
--- a/plugins/org.eclipse.app4mc.amalthea.model/src/org/eclipse/app4mc/amalthea/model/util/DeploymentUtil.java
+++ b/plugins/org.eclipse.app4mc.amalthea.model/src/org/eclipse/app4mc/amalthea/model/util/DeploymentUtil.java
@@ -106,7 +106,7 @@
EList<SchedulerAllocation> schedulerAllocs = model.getMappingModel().getSchedulerAllocation();
for (ISR isr : model.getSwModel().getIsrs()) {
for (ISRAllocation ia : isrAlloc) {
- if (ia.getIsr().equals(isr)) {
+ if (ia.getIsr()!=null && ia.getIsr().equals(isr)) {
for (SchedulerAllocation coreAlloc : schedulerAllocs) {
if (coreAlloc.getResponsibility().contains(core) && coreAlloc.getScheduler() == ia.getController()) {
result.add(isr);
@@ -127,7 +127,7 @@
public static List<TaskAllocation> getTaskAllocations(Task task, Amalthea model) {
List<TaskAllocation> allocs = new ArrayList<>();
for (TaskAllocation ta : model.getMappingModel().getTaskAllocation()) {
- if (ta.getTask().equals(task)) {
+ if (ta.getTask()!=null && ta.getTask().equals(task)) {
allocs.add(ta);
}
}
@@ -201,7 +201,7 @@
private static void getAssignedCoresForISR(ISR isr, final MappingModel mappingModel, Set<ProcessingUnit> processingUnits) {
for (ISRAllocation isrAlloc : mappingModel.getIsrAllocation()) {
- if (isrAlloc.getIsr().equals(isr)) {
+ if (isrAlloc.getIsr()!=null && isrAlloc.getIsr().equals(isr)) {
for (SchedulerAllocation coreAlloc : mappingModel.getSchedulerAllocation()) {
if (coreAlloc.getScheduler() != null && coreAlloc.getScheduler().equals(isrAlloc.getController())) {
processingUnits.addAll(coreAlloc.getResponsibility());
@@ -216,7 +216,7 @@
Set<TaskAllocation> taskAllocations = new HashSet<>();
for (TaskAllocation taskAlloc : mappingModel.getTaskAllocation()) {
- if (taskAlloc.getTask().equals(task)) {
+ if (taskAlloc.getTask()!=null && taskAlloc.getTask().equals(task)) {
taskAllocations.add(taskAlloc);
}
}
@@ -230,7 +230,7 @@
TaskScheduler scheduler2 = taskAlloc.getScheduler();
// check if the same scheduler manages the task and the core -- this includes hierarchical schedulers.
- if (scheduler1.equals(scheduler2) || scheduler1.getChildSchedulers().contains(scheduler2)) {
+ if (scheduler1!=null && (scheduler1.equals(scheduler2) || scheduler1.getChildSchedulers().contains(scheduler2))) {
// check core affinity -- retain the core affinity with the scheduler responsibility
if (!taskAlloc.getAffinity().isEmpty()) {
for (ProcessingUnit core : taskAlloc.getAffinity()) {