From 29b9522b72740081123765bfd871c26c497a1597 Mon Sep 17 00:00:00 2001 From: apanichella Date: Fri, 15 Sep 2017 15:10:55 +0200 Subject: [PATCH] Fixing few NPEs for input and output coverage --- .../metaheuristics/mosa/structural/MultiCriteriatManager.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/client/src/main/java/org/evosuite/ga/metaheuristics/mosa/structural/MultiCriteriatManager.java b/client/src/main/java/org/evosuite/ga/metaheuristics/mosa/structural/MultiCriteriatManager.java index b18d1ae788..eba701f6f1 100644 --- a/client/src/main/java/org/evosuite/ga/metaheuristics/mosa/structural/MultiCriteriatManager.java +++ b/client/src/main/java/org/evosuite/ga/metaheuristics/mosa/structural/MultiCriteriatManager.java @@ -131,6 +131,8 @@ private void addDependencies4Output() { OutputCoverageTestFitness output = (OutputCoverageTestFitness) ff; ClassLoader loader = TestGenerationContext.getInstance().getClassLoaderForSUT(); BytecodeInstructionPool pool = BytecodeInstructionPool.getInstance(loader); + if (pool.getInstructionsIn(output.getClassName(), output.getMethod()) == null) + continue; for (BytecodeInstruction instruction : pool.getInstructionsIn(output.getClassName(), output.getMethod())) { if (instruction.getBasicBlock() != null){ Set cds = instruction.getBasicBlock().getControlDependencies(); @@ -159,6 +161,8 @@ private void addDependencies4Input() { InputCoverageTestFitness input = (InputCoverageTestFitness) ff; ClassLoader loader = TestGenerationContext.getInstance().getClassLoaderForSUT(); BytecodeInstructionPool pool = BytecodeInstructionPool.getInstance(loader); + if (pool.getInstructionsIn(input.getClassName(), input.getMethod()) == null) + continue; for (BytecodeInstruction instruction : pool.getInstructionsIn(input.getClassName(), input.getMethod())) { if (instruction.getBasicBlock() != null){ Set cds = instruction.getBasicBlock().getControlDependencies();