Win a copy of Java 9 Modularity: Patterns and Practices for Developing Maintainable Applications this week in the Java 9 forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Question about reasonability of exceptions list in the Task 1.1.1  RSS feed

 
Pavlo Rybakov
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I'm a little bit confused about task 1.1.1

In the DB-interface I found:


Here is everything Ok.
Before lock the record with number recNo, I have to check whether this record exists in the database file.
If record does not exist or deleted - throw RecordNotFoundException.

But what I do not understand:

why do we need RecordNotFoundException for unlock?

for example, if I write something like

- should RecordNotFoundException occur - it will happen in the lock-method.

 
Roel De Nijs
Sheriff
Posts: 11338
177
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Pavlo,

First of all: please try to use complete words when you are posting questions, because a lot of not-native english speakers are reading and posting to these forums, and abbreviations makes things less clear, so edit your 1st post. And also provide a more meaningful title of your topic.

If the unlock method signature indicates this method could throw a RecordNotFoundException, it doesn't mean you have to throw it. Your reasoning is spot-on, I myself also didn't throw a RecordNotFoundException from the unlock method, nor from update and/or delete methods.

Kind regards,
Roel
 
Pavlo Rybakov
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you Roel !

Hopefully I changed all my abbreviations.
It was without malicious intent.
 
Roel De Nijs
Sheriff
Posts: 11338
177
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No problem although I'm a regular on this forum, I had some difficulties decyphering them (could also be the brain inactivity because it's quiet late )
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!