@ -18,6 +18,7 @@ package org.springframework.boot.build.bom.bomr;
@@ -18,6 +18,7 @@ package org.springframework.boot.build.bom.bomr;
import java.util.ArrayList ;
import java.util.Collection ;
import java.util.Collections ;
import java.util.HashMap ;
import java.util.List ;
import java.util.Map ;
@ -52,7 +53,12 @@ public final class InteractiveUpgradeResolver implements UpgradeResolver {
@@ -52,7 +53,12 @@ public final class InteractiveUpgradeResolver implements UpgradeResolver {
}
List < LibraryWithVersionOptions > libraryUpdates = this . libraryUpdateResolver
. findLibraryUpdates ( librariesToUpgrade , librariesByName ) ;
return libraryUpdates . stream ( ) . map ( this : : resolveUpgrade ) . filter ( Objects : : nonNull ) . toList ( ) ;
try {
return libraryUpdates . stream ( ) . map ( this : : resolveUpgrade ) . filter ( Objects : : nonNull ) . toList ( ) ;
}
catch ( UpgradesInterruptedException ex ) {
return Collections . emptyList ( ) ;
}
}
private Upgrade resolveUpgrade ( LibraryWithVersionOptions libraryWithVersionOptions ) {
@ -69,8 +75,15 @@ public final class InteractiveUpgradeResolver implements UpgradeResolver {
@@ -69,8 +75,15 @@ public final class InteractiveUpgradeResolver implements UpgradeResolver {
options . addAll ( libraryWithVersionOptions . getVersionOptions ( ) ) ;
return questions . selectOption ( question , options , defaultOption ) ;
} ) . get ( ) ;
if ( this . userInputHandler . interrupted ( ) ) {
throw new UpgradesInterruptedException ( ) ;
}
return ( selected . equals ( defaultOption ) ) ? null
: new Upgrade ( libraryWithVersionOptions . getLibrary ( ) , selected . getVersion ( ) ) ;
}
static class UpgradesInterruptedException extends RuntimeException {
}
}