Skip to content

Commit 25036b0

Browse files
authored
Catch class loading errors in Contest Estimator (#1709)
[contest-estimator] Catch exception if `.class` not found while loading at Contest Estimator Add more diagnostics and logs Fix #1701
1 parent 63f096b commit 25036b0

File tree

1 file changed

+24
-10
lines changed

1 file changed

+24
-10
lines changed

utbot-junit-contest/src/main/kotlin/org/utbot/contest/ContestEstimator.kt

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -414,7 +414,7 @@ fun runEstimator(
414414
try {
415415
project.classloader.loadClass(fqn).kotlin
416416
} catch (e: Throwable) {
417-
logger.info { "Smoke test failed for class: $fqn" }
417+
logger.warn(e) { "Smoke test failed for class: $fqn" }
418418
}
419419
}
420420

@@ -445,16 +445,30 @@ fun runEstimator(
445445
break@outer
446446
}
447447

448-
val cut =
449-
ClassUnderTest(
450-
project.classloader.loadClass(classFqn).id,
451-
project.outputTestSrcFolder,
452-
project.unzippedDir
448+
try {
449+
val cut =
450+
ClassUnderTest(
451+
project.classloader.loadClass(classFqn).id,
452+
project.outputTestSrcFolder,
453+
project.unzippedDir
454+
)
455+
456+
logger.info { "------------- [${project.name}] ---->--- [$classIndex:$classFqn] ---------------------" }
457+
458+
tool.run(
459+
project,
460+
cut,
461+
timeLimit,
462+
fuzzingRatio,
463+
methodNameFilter,
464+
statsForProject,
465+
compiledTestDir,
466+
classFqn
453467
)
454-
455-
logger.info { "------------- [${project.name}] ---->--- [$classIndex:$classFqn] ---------------------" }
456-
457-
tool.run(project, cut, timeLimit, fuzzingRatio, methodNameFilter, statsForProject, compiledTestDir, classFqn)
468+
}
469+
catch (e: Throwable) {
470+
logger.warn(e) { "===================== ERROR IN [${project.name}] FOR [$classIndex:$classFqn] ============" }
471+
}
458472
}
459473
}
460474
}

0 commit comments

Comments
 (0)