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

SecurityException in IE Browser

 
rohan arora
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello everyone,
The porblem is in the double buffering (createImage(int x,int y) method).
The problem occur when i closed and open the Applet again and again and it sometime give the SecurityException.the java Console message is.
java.lang.SecurityException: Too many images
at com/ms/awt/image/ImageRepresentation.incNativeCount
at com/ms/awt/image/ImageRepresentation.offscreenInit
at com/ms/awt/image/Image.<init>
at com/ms/awt/ImageX.<init>
at com/ms/awt/WComponentPeer.createImage
at java/awt/Component.createImage
at PoolTable_Canvas.doPaint
at PoolTable_Canvas.update
at com/ms/awt/WComponentPeer.doUpdate
at com/ms/awt/WComponentPeer.doUpdate
at com/ms/awt/WUpdate.run
at com/ms/ui/windowmanager/RunnableMessage.run
at com/ms/awt/WSystemQueue.getMessage
at com/ms/awt/WEventQueue.getNextEvent
at java/awt/EventDispatchThread.run
.please give ur suggestios too prevent this Exception as early as possible.
Thanks
 
Thomas Smets
Ranch Hand
Posts: 111
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This simply means that the VM's GC is not doing a proper job... What you should dois try to nullyfy all the reference & dispose () all the frame not used.
You probably should spend some tedious time (but also quiet exciting ) in trapping all the WindowEvent to add some code to do that !
I should really help the VM doing it's job !
One question though,
I sthis always after a fixed number of Open / close or the faster the sooner.
In the first case you really have some de-allocation problem. In the latter, the trick should definitively help !
Complete explainationis here.
Thomas,
 
David G Risner
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Make sure that the Image you use for double-buffering is kept in a member variable of the class and is only created once, not everytime you enter the paint method. I usually have something like this:

You might think that the checking if bufferImage and imageGraphics are null is superfluous, but it is possible for these to end up as being null if the system is running low on resources. Of course, you would probably want to display an error of some sort in this case.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic