Win a copy of 97 Things Every Java Programmer Should Know this week in the Java in General forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

Question about reasonability of exceptions list in the Task 1.1.1

 
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.

 
Sheriff
Posts: 11604
178
Hibernate jQuery Eclipse IDE Spring MySQL Database AngularJS Tomcat Server Chrome Java
  • 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: 11604
178
Hibernate jQuery Eclipse IDE Spring MySQL Database AngularJS Tomcat Server Chrome Java
  • 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 )
 
Sometimes you feel like a nut. Sometimes you feel like a tiny ad.
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic