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

[Template] avoid thousands of MissingPropertyExceptions #1067

Open
xael-fry opened this issue Dec 27, 2016 · 6 comments
Open

[Template] avoid thousands of MissingPropertyExceptions #1067

xael-fry opened this issue Dec 27, 2016 · 6 comments

Comments

@xael-fry
Copy link
Member

From @angryziber in #1039:

Binding can only contain variables (basically, a Map), not properties.

If groovy doesn't find a variable, it throws a MissingPropertyException populating the stacktrace.

GroovyTemplate.getProperty() first calls the getVariable(), if it throws (happens very often if you have optional bindings), then it catches and delegates to getProperty(), that does some slow work itself again.

This small change avoids these excessive exceptions with stacktraces on every missing variable access.

@angryziber
Copy link
Contributor

Do you have any examples of which code breaks?

We found that without this change, sometimes you could #{set} something and then use the value with just ${}

@xael-fry
Copy link
Member Author

@angryziber As I said in #1039, I am doing a PR with tests for that.
Yes this is the goal of set, so you mean that with your change with cannot do it anymore.

@angryziber
Copy link
Contributor

angryziber commented Dec 28, 2016 via email

@xael-fry
Copy link
Member Author

xael-fry commented Dec 29, 2016

Yes I could be used by Get, but as nothing block to used it another way, we cannot block now a behavior that was accepted before, or it will affect users projects, or we should do it in a major revision.
But what do you mean by But I found one case, where the set value was accessible via ${} before, but not anymore., in your project, in play/examples?

@angryziber
Copy link
Contributor

angryziber commented Dec 29, 2016 via email

@xael-fry
Copy link
Member Author

No I just say that the initial behavior was to used #{set} /#{get} but as we allowed to used ${} in the past, I am not sure we can remove this behavior in the minor release

xael-fry added a commit to xael-fry/play that referenced this issue Dec 29, 2016
xael-fry added a commit to xael-fry/play that referenced this issue Dec 29, 2016
asolntsev added a commit that referenced this issue Dec 29, 2016
[#1067] test(tag): add demo and test for used of #{set} and #{get}
@xael-fry xael-fry removed this from the 1.4.4 milestone Jan 19, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants