• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

DatabaseException

 
Brandon W
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
In the Data.java file, when I tried to compile the part of the program, I got the following error:
unreported exception java.lang.DatabaseException; must be caught or declared to be thrown. Seemingly, the function getRecord which throws DatabaseException is not enough:
public DataInfo getRecord(int recNum) throws DatabaseException {
If I changed the declaration to be:
public DataInfo getRecord(int recNum) throws IOException {
I could get rid of the problem. My question is Do Sun allows us to make such like this... changing what being thrown? Or there's other way to do it?
Brandon
 
Enrico Mannarino
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I didn't change anything and it compiles fine.
Are you sure you haven't change anytning in Data before compiling?
Enrico
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In your call to getRecord from the "test" class you must put that in a try-catch.
Mark
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic