Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Removing RecordNotFoundException from subclass

 
Jonathan Elkharrat
Ranch Hand
Posts: 170
Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i think the RecordNotFoundException in the writing methods is not necessary and here's why:

since the lock method already check that the record exist, and the writing methods
make sure the record is locked, that mean one thing ---> the record exist!

just making a point..
 
Roel De Nijs
Sheriff
Posts: 10763
148
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


But you are not the first one, that point is already made several times (I made the same remark more than 2 years ago, and not onlt for the write methods, but also for unlock-method )
 
Jonathan Elkharrat
Ranch Hand
Posts: 170
Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
now that you mention it, it's quite contradictory to have a RecordNotFoundException in the unlock method.
suppose someone lock a record, delete it and then call the unlock.
i just found a bug in my code now thanks to you
 
Happiness is not a goal ... it's a by-product of a life well lived - Eleanor Roosevelt. Tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!