Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

The exception of lock(int i)

 
Daniel Patrickson
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all!
It seems to me that throwing an IOException from
is not what one should be doing.
IOExceptions are used to denote an error while working with files,
streams and such things (thus IO).
Instead I would suggest using a IndexOutOfBoundsException
Any thoughts? Am I astray?
regards
/ppatrickson
 
Philippe Maquet
Bartender
Posts: 1872
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Daniel,
Welcome to the Ranch. Did you get an IOException declared in the throws clause of a given lock() method in your assignment ? (It's not the case in mine). If yes, is it in an interface or a class ? If just in the interface, you don't need to implement it. If you got in a class defined by Sun, don't change the method signature, don't throw the exception and document that in your implementation that IOException will never be thrown.
Best,
Phil.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic