IllegalArgumentException thrown from afterPropertiesSet where IllegalStateException would be more appropriate
See original GitHub issueIwein 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
Issue Analytics
- State:
- Created 14 years ago
- Comments:5 (1 by maintainers)
Top Results From Across the Web
java - Right exception to throw for the lack of a system property
IllegalArgumentException - Thrown to indicate that a method has been passed an illegal or inappropriate argument.
Read more >When do IllegalStateException and IllegalArgumentException ...
This exception is thrown when you call a method at illegal or inappropriate time an IlleagalStateException is generated. For example, the remove ...
Read more >How to Throw IllegalArgumentException in Java - Rollbar
The IllegalArgumentException is thrown to indicate an illegal or unsuitable argument passed to a method. Learn how to solve it.
Read more >JndiObjectFactoryBean.setJndiName - Java - Tabnine
Thrown when trying to retrieve an element past the end of an Enumeration or Iterator. TreeMap (java.util). Walk the nodes of the tree...
Read more >Setter injection versus constructor injection and the use of ...
I'd like to begin with reviewing constructor injection. ... (collaborator == null) { throw new IllegalArgumentException("Collaborator cannot ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hi, I opened PR #4055 to address this issue.
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 useAssert.notNull
as you mentioned. It would be great to make this consistent across the whole code base and not only for theFlatFileItemReader
. Feel free to open a PR if you want, contributions are welcome!