Skip to content

Commit e0d34d6

Browse files
authored
Fallback to no configuration mode when spring-analyzer crushes (#2150)
1 parent 6420a78 commit e0d34d6

File tree

2 files changed

+15
-10
lines changed

2 files changed

+15
-10
lines changed

utbot-framework/src/main/kotlin/org/utbot/framework/process/EngineProcessMain.kt

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -77,16 +77,21 @@ private fun EngineProcessModel.setup(kryoHelper: KryoHelper, watchdog: IdleWatch
7777
}.toTypedArray())))
7878
}
7979
watchdog.measureTimeForActiveCall(getSpringBeanQualifiedNames, "Getting Spring bean definitions") { params ->
80-
val springAnalyzerProcess = SpringAnalyzerProcess.createBlocking(params.classpath.toList())
81-
val beans = springAnalyzerProcess.terminateOnException { _ ->
82-
springAnalyzerProcess.getBeanQualifiedNames(
83-
params.classpath.toList(),
84-
params.config,
85-
params.fileStorage,
86-
).toTypedArray()
80+
try {
81+
val springAnalyzerProcess = SpringAnalyzerProcess.createBlocking(params.classpath.toList())
82+
val beans = springAnalyzerProcess.terminateOnException { _ ->
83+
springAnalyzerProcess.getBeanQualifiedNames(
84+
params.classpath.toList(),
85+
params.config,
86+
params.fileStorage,
87+
).toTypedArray()
88+
}
89+
springAnalyzerProcess.terminate()
90+
beans
91+
} catch (e: Exception) {
92+
logger.error(e) { "Spring Analyzer crushed, resorting to using empty bean list" }
93+
emptyArray()
8794
}
88-
springAnalyzerProcess.terminate()
89-
beans
9095
}
9196
watchdog.measureTimeForActiveCall(createTestGenerator, "Creating Test Generator") { params ->
9297
AnalyticsConfigureUtil.configureML()

utbot-intellij/src/main/kotlin/org/utbot/intellij/plugin/generator/UtTestsDialogProcessor.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ object UtTestsDialogProcessor {
252252
)
253253
}
254254
}
255-
val shouldUseImplementors = model.typeReplacementApproach is ReplaceIfPossible
255+
val shouldUseImplementors = beanQualifiedNames.isNotEmpty()
256256

257257
SpringApplicationContext(
258258
mockFrameworkInstalled,

0 commit comments

Comments
 (0)