Skip to content
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

Revise script engine retrieval for better error reporting [SPR-13491] #18069

Closed
spring-projects-issues opened this issue Sep 23, 2015 · 1 comment
Assignees
Labels
type: enhancement A general enhancement
Milestone

Comments

@spring-projects-issues
Copy link
Collaborator

spring-projects-issues commented Sep 23, 2015

Juergen Hoeller opened SPR-13491 and commented

With ScriptTemplateView as well as StandardScriptFactory / StandardScriptEvaluator, it's common for the specified engine name to be unresolvable. Let's introspect the available engine factories and list all available script engines in our exception message. Also, let's make sure to consistently reuse ScriptEngineManager set up for our specific ClassLoader.


Affects: 4.2 GA

Issue Links:

Referenced from: commits c7fd4cc

@spring-projects-issues
Copy link
Collaborator Author

spring-projects-issues commented Sep 23, 2015

Juergen Hoeller commented

It turns out that ScriptEngineManager.getEngineByName returning null can mean either "no such engine known" or "engine failed to initialize", since it swallows all exceptions...

As a consequence, I've introduced a StandardScriptUtils.retrieveEngineByName helper which performs the lookup, manually checks for whether we're dealing with an initialization failure, and lists all available engine names in the exception message if actually not found.

Given this opportunity, I've also revised StandardScriptFactory for finer-grained template methods, added further configuration variants to StandardScriptEvaluator, and dealt with #18065's identification of thread-local ScriptEngine instances in ScriptTemplateView.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

2 participants