Skip to content

SpelExpression throws NullPointerException instead of EvaluationException for primitives [SPR-16123] #20671

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

Closed
spring-projects-issues opened this issue Oct 26, 2017 · 3 comments
Assignees
Labels
in: core Issues in core modules (aop, beans, core, context, expression) type: bug A general bug
Milestone

Comments

@spring-projects-issues
Copy link
Collaborator

spring-projects-issues commented Oct 26, 2017

Wojciech Gruszczyk opened SPR-16123 and commented

Bug proof:

package com.demo.bugproof;

import org.junit.Test;
import org.springframework.expression.EvaluationException;
import org.springframework.expression.spel.standard.SpelExpressionParser;


public class SpelNPEDemoTest
{

	@Test(expected = EvaluationException.class)
	public void npeBugProof()
	{
		new SpelExpressionParser().parseExpression("demo").setValue(new SomePOJO(), null);
	}

	private class SomePOJO
	{
		private boolean demo;

		public boolean isDemo()
		{
			return demo;
		}

		public void setDemo(final boolean demo)
		{
			this.demo = demo;
		}
	}

}

Affects: 4.3.11

Issue Links:

Referenced from: commits fd6f2bd

@spring-projects-issues
Copy link
Collaborator Author

Juergen Hoeller commented

This works fine against 5.0.x for me; I'll try against 4.3.x tomorrow.

@spring-projects-issues
Copy link
Collaborator Author

spring-projects-issues commented Oct 27, 2017

Juergen Hoeller commented

As far as I can tell, this works against 4.3.12 already, assumably as a side effect of #20215 (a wider backport of nullability refinements from 5.0). Could you please doube-check against 4.3.12?

@spring-projects-issues
Copy link
Collaborator Author

Wojciech Gruszczyk commented

I confirm. On 4.3.12 it works as expected. Thank you for quick feedback!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: core Issues in core modules (aop, beans, core, context, expression) type: bug A general bug
Projects
None yet
Development

No branches or pull requests

2 participants