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

Why does Data.updateRecord throw SecurityException...please help!

 
Jae Zee
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hallo Ranchers!
Can anyone please tell me why the update record must throw both security exceptions and recordnotfound exceptions? I understand that this will happen in server mode, but if I am running standalone with no RMI, then I definately am not haveing any concurrent access to anything and therefore do not need to throw eigther. This is a real tough subject that I have worked on now for some time without any success in finding a nice solution. I would be SOOO happy for any help I could get here
Thanks in advance
 
Paul Bourdeaux
Ranch Hand
Posts: 783
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The SecurityException is thrown when a client tries to update the record without the correct lock cookie. You are correct that locking really isn't an issue when running in stand alone mode, but the Data class should never know what mode you are running in. It should treat all cases the same regardless of the type of client.

The RecordNotFoundException is thrown when a client tries to update a record that doesn't exist or has been deleted. It doesn't matter if you are running in networked or standalone mode, this exception is still needed.

Hope that helped.
[ March 18, 2005: Message edited by: Paul Bourdeaux ]
 
Jae Zee
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a lot for your reply. I wander if I actually need a record validity check in the local mode. Especially since my user does:

search record- book record- update record

This means that while working in the local mode, no other threads can go in and change my db records right? Should the updateRecord in bd.Data really still check for record validity? I am doing this in the remoteDataAdapter instead
/cheers and thanks in adv.
 
Andrew Monkhouse
author and jackaroo
Marshal Commander
Pie
Posts: 12014
220
C++ Firefox Browser IntelliJ IDE Java Mac Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Jae,

I wander if I actually need a record validity check in the local mode. Especially since my user does: ...


The problem is in those two words I highlighted. You are relying on your client's internal processing to avoid doing the validity checking. But what happens if some "junior programmer" changes some of your client code? Or the customer decides to write some other application that happens to use your Data class?

Apart from which, I think you have acknowledged that you do need these checks in the networked mode. So, unless you have two versions of the Data class , you are going to have this checking in the standalone version anyway .

Regards, Andrew
 
Jae Zee
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Andrew!
I don't have two versions of the data class, butI do have a remoteDataAdapter which wraps the data class. This class(remoteDataAdapter) that takes care of locking and all other functionalities that are needed in the networking mode. I never call my lock method in the data class, I do this only from the remoteDataAdapter class. Does this sound OK?
I also wonder if you have any possibility of giving me some feedback on my completed assignment? I'm almost done and would really appreciate some overall feedback.
Thanks
/Jae
 
Andrew Monkhouse
author and jackaroo
Marshal Commander
Pie
Posts: 12014
220
C++ Firefox Browser IntelliJ IDE Java Mac Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Jae,

If I am understanding your approach, it is one that has been used many times succesfully in the past. So you should have no problems with it.

The issue of having someone (Max / myself / Phil / ...) looking at projects and offering feedback has come up several times. Basically I (and some of the others mentioned) do not feel that this would be ethical. Plus, I really don't have time. Sorry.

Regards, Andrew
 
Jae Zee
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ok.Thanks for the help
/Jae
 
Jae Zee
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi again Andrew and all other Java Gurus!
I thought about what Andrew said about it being unfair play if someone looked through my assignment, and I wonder if I could write an arktitectural overview and have it looked through instead, I've seen lots do this on the ranch, since it contains no code and only my main architectural choices. Is this also seen as unfair play or not?
Thanks
/Jae
 
Andrew Monkhouse
author and jackaroo
Marshal Commander
Pie
Posts: 12014
220
C++ Firefox Browser IntelliJ IDE Java Mac Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Jae,

As you have noted, this is something that happens on a regular basis. We don't really have a problem with it, since a reader has to understand the architectural choices in order to be able to use them (and has to understand why the architecture is designed the way it is in order to answer the questions in the exam).

If you do want to do this, I would suggest you start a separate topic for it.

Regards, Andrew
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic