NPE while applying more than one root recipes selected in eclipse

This commit is contained in:
aboyko
2022-12-07 10:37:35 -05:00
parent ae43ae98d0
commit da8ea1d33a
2 changed files with 10 additions and 2 deletions

View File

@@ -124,6 +124,7 @@ public class RecipeTreeModel {
return recipes[0];
} else {
RecipeDescriptor aggregate = new RecipeDescriptor();
aggregate.name = recipes.length + " recipes";
aggregate.displayName = recipes.length + " recipes";
aggregate.description = "Multiple recipes to be applied. Number of recipes " + recipes.length;
aggregate.tags = Arrays.stream(recipes).flatMap(r -> r.tags.stream()).collect(Collectors.toSet());

View File

@@ -349,10 +349,17 @@ public class RewriteRecipeRepository implements ApplicationContextAware {
throw new RuntimeException("No recipes found to perform!");
} else if (aggregateRecipe.getRecipeList().size() == 1) {
Recipe r = aggregateRecipe.getRecipeList().get(0);
String progressToken = params.getWorkDoneToken() == null || params.getWorkDoneToken().getLeft() == null ? r.getName() : params.getWorkDoneToken().getLeft();
String progressToken = params.getWorkDoneToken() == null
|| params.getWorkDoneToken().getLeft() == null
? (r.getName() == null ? UUID.randomUUID().toString() : r.getName())
: params.getWorkDoneToken().getLeft();
return apply(r, uri, progressToken);
} else {
String progressToken = params.getWorkDoneToken() == null || params.getWorkDoneToken().getLeft() == null ? aggregateRecipe.getName() : params.getWorkDoneToken().getLeft();
String progressToken = params.getWorkDoneToken() == null
|| params.getWorkDoneToken().getLeft() == null
? (aggregateRecipe.getName() == null ? UUID.randomUUID().toString()
: aggregateRecipe.getName())
: params.getWorkDoneToken().getLeft();
return apply(aggregateRecipe, uri, progressToken);
}
});