File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

IllegalStateException in delete/update

 
Paweł Baczyński
Bartender
Pie
Posts: 1697
30
Firefox Browser IntelliJ IDE Java Windows
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is it a good idea to throw IllegalStateException from delete and update methods when invoked on an unlocked record?
The interface doesn't mention this exception. But... ISE is an unchecked exception so it doesn't need to me mentioned.
What do you think?
 
Roel De Nijs
Sheriff
Posts: 9137
75
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I used IllegalArgumentException and IllegalStateException quite extensively in my application.
 
Paweł Baczyński
Bartender
Pie
Posts: 1697
30
Firefox Browser IntelliJ IDE Java Windows
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Suppose null was passed to createRecord(String[] record)
Which is better? NullPointerException or InvalidArgumentException?
I'd use InvalidArgumentException because it is more specific.
 
Roel De Nijs
Sheriff
Posts: 9137
75
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I used IllegalArgumentException for that purpose. But the Java classes (like String) uses NullPointerException: Unless otherwise noted, passing a null argument to a constructor or method in this class will cause a NullPointerException to be thrown.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic