-
Notifications
You must be signed in to change notification settings - Fork 356
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add guard for loading yaml source, gracefully handling the loading error. #3224
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor comments. Otherwise 👍
} | ||
} | ||
} catch (Exception e) { | ||
logger.error("Loading yaml {} type failed, yaml source: {}", resourceType, yamlSource); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we print the error message as well to understand what is the parsing error?
@@ -167,17 +169,19 @@ public YamlResourceLoader(InputStream yamlInput, URI source, Properties properti | |||
|
|||
private Collection<Map<String, Object>> loadResources(ResourceType resourceType) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we add a test to validate that this do not happen again? It is fine if we want to include it using a different PR
…ror. (#3224) * Add guard for loading yaml source, gracefully handling the loading error.
* Large repository handling * rewrite-xml tests passing * AddGradleEnterpriseTest passing * UpgradeGradleWrapper passing * License headers * Reject version of rocksdb which is broken on Windows * Fix CreateTextFile. Move Groovy adaptability tests into a package where they wont name collide with java tests * Remove visitJavaSourceFile * Move org.openrewrite.java.cleanup to rewrite-static-analysis * Move a few commonly used cleanup recipes back * Move some recipes back from static-analysis that are actually formatting recipes * Move groovy cleanup tests to rewrite-static-analysis, fix other compilation issues * Fix UnnecessaryParentheses * Fix SelectRecipeExamplesTest * Fix more tests, move java-best-practices to rewrite-static-analysis * Fix remaining tests * Remove deprecated gradle parser builders * Remove some incubating annotations, order imports * Remove select deprecations * Remove `JavaParser#[gs]etSourceSet()` overrides * Make precondition of `ChangeMethodTargetToStatic` optional Also add `stopAfterPreVisit()` call to `RemoveImport#preVisit()` and fix failing `UseJavaParserBuilderInJavaTemplateTest` test. * Make sure `Preconditions.check()` also works with other source types * Add a few more `stopAfterPreVisit()` directives * Change return type of `ScanningRecipe#generate()` Use `Collection<? extends SourceFile>` rather than `Collection<SourceFile>`. * Update call site for `ScanningRecipe#generate()` * Don't attempt to instantiate abstract recipe classes For example the `ScanningRecipe` type. * Change top-level detection logic in `TreeVisitor#visit()` Using `cursor.getParent() == root` doesn't work when a visitor is called with a client-supplied cursor (i.e. `visit(Tree, P, Cursor)`, as then the top-level for that visitor is not properly detected and as a result the after visitors don't get applied. * Reset `TreeVisitor#visitCount` after exiting top-level This way the visitor can be reused. * Add `stopAfterPreVisit()` call to `AddImport#preVisit()` * Update signatures of `Recipe#run()` methods * Resolve some conflicts after rebasing * Changeset * SourceSet -> LargeSourceSet * Polish * Polish * Polish * Fix constructor calls in `InMemoryLargeSourceSet` Also add generated and deleted sources to changeset. * FindCallGraph public getVisitor * Missing expected generated file check was in wrong place in RewriteTest * Recipe#generate can observe other files generated in the same cycle * Add guard for loading yaml source, gracefully handling the loading error. (#3224) * Add guard for loading yaml source, gracefully handling the loading error. * Fix PlainText#withText * Iteration on cachable, context-free java templating. * Cleanup * Refactor to `JavaTemplate.Builder#requiresContext(boolean)` The `JavaTemplate` currently also requires access to the `Cursor` in order to be able to format the code (using `JavaVisitor#autoFormat()`) before returning it to the caller. The alternative would be to require the calling visitor to apply the formatting itself after updating the LST. * Add `Cursor` parameter to `J#withTemplate()` * Update all uses of `JavaTemplate#builder()` and `J#withTemplate()` * Polish * ChangeText not extendable * Recipe#getDescription not optional * Polish AddDependency * Remove LargeSourceSet#flatMap and LargeSourceSet#concat * Remove LargeSourceSet#getInitialState * Updated `JavaTemplate` uses to context-free where possible * Fix bug in `RecipeSchedulerCheckingExpectedCycles` `LargeSourceSet` parameter of `afterCycle()` could be same instance from previous cycle. * `ScanningRecipe#getVisitor()` must implement `isAcceptable()` Also fix failing `ExtractInterfaceTest`. * Post-merge conflict resolution * Fix last failing test The estimated effort was taken from the root recipe rather than from the "leaf recipe". * Fix bug when replacing context-free method body * For now exclude lambdas and method references from context-free support * Further simplify LargeSourceSet, remove ForkJoinScheduler * Rename RecipeScheduler#mapForRecipeRecursively * LargeSourceSet edit/generate * Add simple test for context-free template caching * RewriteTest customizable LargeSourceSet builder * Fix migration recipes * Change ScanningRecipe's acc message id to use hashCode instead of UUID to solve some potential issues of multiple ScanningRecipes in a getRecipleList * NullSkippingSet -> NullSkippingMap * Revert "Change ScanningRecipe's acc message id to use hashCode instead of UUID to solve some potential issues of multiple ScanningRecipes in a getRecipleList" This reverts commit bff5444. * visitParameterizedType needs to call withType * getRecipeList should not return new recipe instances * Javadoc on getRecipeList * Add validation that Recipe#getRecipeList always returns the same references * Propagate shared root cursor via `visit(Tree, ExecutionContext, Cursor)` To let the recipe's visitor use the shared root cursor the `RecipeScheduler` now invokes `visit(Tree, ExecutionContext, Cursor)` rather than first explicitly setting the `TreeVisitor#cursor` field and then calling `visit(Tree, ExecutionContext)`. This is necessary for the wrapping visitors created by `Preconditions` and `ScanningRecipe`, as the shared root otherwise won't get propagated to the actual visitor. * Fix compiler problem with Lombok `@Getter(lazy = true)` * Set root cursor before calling `TreeVisitor#isAcceptable()` This is required by the implementation of `ScanningRecipe#isAcceptable()` since it retrieves the accumulator from the root cursor * make RemoveGradleDependency recipe public * Add `@JsonIgnore` to `FindDeprecatedUses#recipeList` Somehow the `@Getter(lazy=true)` coupled with the initializer method appears to change the serialization. * Fix bug in `SemanticallyEqual` when comparing modifiers `J.Modifier` instances cannot be compared using `Object#equals(Object)` since this will only compare the `id` field. Instead, the `J.Modifier#type` should be compared. * Fix failing HCL tests after root cursor sharing refactoring * Fix failing YAML tests after root cursor sharing refactoring * Avoid J.ArrayType double visit on type * Don't add types in use to `JavaSourceSet` `Assertions#addTypesToSourceSet()` now no longer iterates over the `TypesInUse` of each compilation unit to add the `JavaType`s to the `JavaSourceSet` classpath. * Restore ShortenFullyQualifiedTypeReferences from rewrite-static-analysis * Eliminate double visit on AnnotatedType type * chore: deprecate PartProvider, and change to use internal helper function in MigrateRecipeToRewrite8 * Fix error in `README.md` * getRecipeList called once per cycle * getInitialValue() -> getInitialValue(ExecutionContext) * Remove recipeList validation from RewriteTest * Remove deprecated Gradle recipes * Get tests passing * Update benchmark code * Fixes compilation issues with gradle * Revert "Fixes compilation issues with gradle" This reverts commit 486c30e. * Flush RecipeRunStats * Autodetecte * Fix SourceFileResults data table (#3280) --------- Co-authored-by: Sam Snyder <[email protected]> Co-authored-by: Knut Wannheden <[email protected]> Co-authored-by: Kun Li <[email protected]> Co-authored-by: Tim te Beek <[email protected]> Co-authored-by: Kun Li <[email protected]> Co-authored-by: rpau <[email protected]>
latest.release
after unblocking SAAS.