Win a copy of AWS Security this week in the Cloud/Virtualization forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

SecurityException in IE Browser

 
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
 
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,
 
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.
 
Wait for it ... wait .... wait .... NOW! Pafiffle! A perfect tiny ad!
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic