• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Does this mean automatic failure ?

 
Krishna Varma Adluru
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
I have a quick question.
In Data Class(Given by SUN),we all have methods
like:
public DataInfo[] criteriaFind(String criteria) throws DatabaseException
public void lock(int record)
public void unlock(int record)
Please look carefully into the above methods.
If I change the above methods in the Data class to look like:
public DataInfo[] criteriaFind(String criteria) throws QueryException, DatabaseException
public void lock(int record) throws SomeException
public void unlock(int record) throws SomeException
Please look carefully in the above methods. I have changed them to
throw more exceptions ..

Does that mean that I am changing the signature of the method ?
Does that mean that I am not following SUN's instructions ?
Does that mean that SUN will automatically fail any submissions like the one above ?

Please respond guys,
Thank You,
Regards,
Krishna Varma Adluru
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well I don't know about failing or not, but there really is no reason to need to do this amount of changing. After all the real exceptions will be thrown by your implementing Local and remote classes, and some by your Server, but not needed fom your Data class, if they are not already there.
What would be a good reason for making those changes?
Mark
 
Krishna Varma Adluru
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Mark Spritzler:

What would be a good reason for making those changes?
Mark

You are correct with regard to lock() and unlock()
methods. With regard to criteriaFind() method,
let's say that user sends a query of the form,
"Origin airport=,Destination airport=abcd".
Here, the user is sending a "Syntactically wrong" query. There is no problem with regard to database. Why do we need to throw "DatabaseException" ?. I would like to throw "QueryException" to indicate that there is some problem in the syntax of the query.
We might argue that "As we are forming the query,
how will there be any Syntactically wrong queries ..?"
But, think about the case if we have to provide a Command driven UI like in SQLPLUS. User can make mistakes right ..?
This is essentially to detach client from the Server.
Please provide your valuable input.
Thank You,
Regards,
Krishna Varma Adluru
 
Burk Hufnagel
Ranch Hand
Posts: 814
3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Krishna,
If you either create a subclass that extends Data, or create a class that contains a Data object, then *that* class can inplement criteriaFind and throw whatever exceptions you would care to throw without modifying the original Data class.
However, the question that pops up for me is this:
if you replace calls to deprecated methods currently being called from the Data class then haven't you modified the Data class -- whether or not you implement a criteriaFind method or not?
If so then isn't everyone "modifying the Data class", whether or not the extend it too?
OTOH if you don't remove the offending code then your submission will still call deprecated methods, which I am lead to believe is incorrect - and so I assume would cost you points.
Anbody want to share their opinion on this?
Burk
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here, the user is sending a "Syntactically wrong" query. There is no problem with regard to database. Why do we need to throw "DatabaseException" ?. I would like to throw "QueryException" to indicate that there is some problem in the syntax of the query.
We might argue that "As we are forming the query,
how will there be any Syntactically wrong queries ..?"
But, think about the case if we have to provide a Command driven UI like in SQLPLUS. User can make mistakes right ..?

We aren't building SQLPLUS. Plus you can have a CriteriaBuilder class that takes the users choices, and makes the criteriaString, and it can check to make sure that it is valid, and that class can throw a "QueryException" if you have to have it in there.
Mark
 
Krishna Varma Adluru
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Marks,
Thanks for the reply.
Regards,
Krishna Varma Adluru
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic