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

calling start() on broken init()

 
Pawel Veselov
Ranch Hand
Posts: 165
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Recently we had an argue, that ends with nothing.
The question is: If call to applet's init() finished with init() throws an exception, should we call start() then ? I found no words about that in any specification, though I searched some. Docs just say we should call start() after init() and when browser reshows the page. I believe, that applet that threw an exception from init() should be treated as unitialized and no following call to start() should be issued. This is the current behaviour for Netscape and HotJava.
Any thoughts on this subject would be greately appreciated.
Thanx.

------------------
With best of best regards, Pawel S. Veselov ( aka Black Angel )

 
Matt Midcap
Sheriff
Posts: 440
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would have to agree with you Pawel. This is just common sense isn't it (anyone else have an opinion)?
From what I understand, the init() method is used to initialize "stuff" needed for your applet - like a constructor. Although applets can have default constructors, its usually handled with the init() method (this in not your problem).
Although I don't know what your applet does, I would think the applet would be "unpredictable" if it throws an exception at start-up. If it didn't init() correctly, your problems will only snowball.
Just my two cents...
Best Regards,
Matt Midcap
[This message has been edited by Matt Midcap (edited May 20, 1999).]
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Alas, I don't know what my applet does or would probably do. I am programming the other side - the browser.
My oppenents used the argument, that they can be dumb enough to make this buggy init() that will throw some exception, but it is not too awful for not calling start().
But I've found one more -- what is the way for applet to report it is unititialized ? If applet itself doesn't want to be initialized and wants for his start() method not to be called ?
 
Matt Midcap
Sheriff
Posts: 440
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry for the delayed responce, anyway let me make sure I understand your last question:
You want to have the applet report
1. that it was not able to be initialized
2. that the applet doesn't want to be initialized
3. the applet does not want its start() method to be called
Am I correct in understanding this?
 
Pawel Veselov
Ranch Hand
Posts: 165
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I got some other interpretation of the same questions.
1)What browser should do if applet threw an exception from init() method of Applet interface ?
-OR-
Should browser call start() method for applet if init() method threw an exception ?
There are reasons for both yes and no answers:
yes) The specification says that for any applet the following sequence will be executed: init(), start()
no) Let's imagine we're in browser. We call init(), then start() and leave this thread. So any uncaugh exception should stop thread's execution, is it init() or start(). We even don't need to caught and dump any exception occured and leave it for JVM.
2) Should we treat an applet as unitialized one if it threw an exception from init() ?
3) The most general question : is this described somewhere ?
 
Matt Midcap
Sheriff
Posts: 440
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You have some good points about both arguments. Unfortunately I have yet to see a documentation regarding this.
If you do find out, please let us know what the "standard" might be.
Best Regards,
Matt Midcap
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic