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

IllegalArgumentException thrown from FlatFileItemReader where IllegalState would be more appropriate [BATCH-1337] #2244

Open
spring-issuemaster opened this issue Jul 14, 2009 · 4 comments

Comments

@spring-issuemaster
Copy link
Collaborator

@spring-issuemaster spring-issuemaster commented Jul 14, 2009

Iwein Fuld opened BATCH-1337 and commented

public void afterPropertiesSet() throws Exception {
		Assert.notNull(lineMapper, "LineMapper is required");
	}

Should use Assert.state instead imo.


Affects: 2.0.1

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

@spring-issuemaster spring-issuemaster commented Jul 15, 2009

Dave Syer commented

Agree. And the problem is fairly ubiquitous in afterPropertiesSet() methods. Maybe the change can be scripted?

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

@spring-issuemaster spring-issuemaster commented Sep 13, 2009

Robert Kasanicky commented

Maybe we should switch to using @Required on setters?

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

@spring-issuemaster spring-issuemaster commented Sep 13, 2009

Dave Syer commented

I don't like @Required, and I don't think it's appropriate for framework classes, since it requires the user to add a bean post processor for it to work. InitializingBean is better for my money.

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

@spring-issuemaster spring-issuemaster commented Nov 21, 2018

Mahmoud Ben Hassine commented

@Iwein Fuld I also agree. However, there are some places in the code base that use Assert.state (like AbstractJob and AbstractStep) while other places use Assert.notNull as you mentioned. It would be great to make this consistent across the whole code base and not only for the FlatFileItemReader. Feel free to open a PR if you want, contributions are welcome!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant
You can’t perform that action at this time.