JDK-7194578 : *Windows 8* ClassCastException in java2d functionality when applet loaded
  • Type: Bug
  • Component: client-libs
  • Sub-Component: 2d
  • Affected Version: 7u10
  • Priority: P2
  • Status: Closed
  • Resolution: Duplicate
  • OS: windows
  • CPU: x86
  • Submitted: 2012-08-28
  • Updated: 2012-10-17
  • Resolved: 2012-08-30
Related Reports
Duplicate :  
Description
When applet "Middoploy" loaded from http://www.jgames.com and game started.
Applet trows 
Exception in thread 
"AWT-EventQueue-2" 
java.lang.ClassCastException: [S cannot be cast to [I
at java.awt.image.DirectColorModel.getRGB(Unknown Source)

Comments
EVALUATION The problem with the ClassCastException was resolved in jdk8 as a part of fix for CR 6997116. However, this fix was not backported to jdk7 update releases. If the problem is highly visible on windows 8, we probably should consider to backport the fix to 7u8. However this backport should be done under corresponding subCR of 6997116, so I am closing the CR 7194578 as a duplicate of 6997116.
30-08-2012

EVALUATION Problem went away when ddraw is disable by setting the "noddraw" property to false. Re-assigning this CR to java2d team.
29-08-2012

WORK AROUND set the following property in java control panel before running the applet: -Dsun.java2d.noddraw=false
29-08-2012

EVALUATION Full stack trace of the exception is as follows: Exception in thread "AWT-EventQueue-2" java.lang.ClassCastException: [S cannot be cast to [I at java.awt.image.DirectColorModel.getRGB(Unknown Source) at sun.java2d.loops.OpaqueCopyAnyToArgb.Blit(Unknown Source) at sun.java2d.loops.GraphicsPrimitive.convertFrom(Unknown Source) at sun.java2d.loops.GraphicsPrimitive.convertFrom(Unknown Source) at sun.java2d.loops.MaskBlit$General.MaskBlit(Unknown Source) at sun.java2d.loops.Blit$GeneralMaskBlit.Blit(Unknown Source) at sun.java2d.pipe.DrawImage.blitSurfaceData(Unknown Source) at sun.java2d.pipe.DrawImage.renderImageCopy(Unknown Source) at sun.java2d.pipe.DrawImage.copyImage(Unknown Source) at sun.java2d.pipe.DrawImage.copyImage(Unknown Source) at sun.java2d.SunGraphics2D.drawImage(Unknown Source) at sun.awt.image.ImageRepresentation.drawToBufImage(Unknown Source) at sun.java2d.pipe.DrawImage.copyImage(Unknown Source) at sun.java2d.SunGraphics2D.drawImage(Unknown Source) at sun.java2d.SunGraphics2D.drawImage(Unknown Source) at Monopoly.printStuff(Monopoly.java:176) at Monopoly.paint(Monopoly.java:159) at sun.awt.RepaintArea.paintComponent(Unknown Source) at sun.awt.RepaintArea.paint(Unknown Source) at sun.awt.windows.WComponentPeer.handleEvent(Unknown Source) at java.awt.Component.dispatchEventImpl(Unknown Source) at java.awt.Container.dispatchEventImpl(Unknown Source) at java.awt.Component.dispatchEvent(Unknown Source) at java.awt.EventQueue.dispatchEventImpl(Unknown Source) at java.awt.EventQueue.access$000(Unknown Source) at java.awt.EventQueue$3.run(Unknown Source) at java.awt.EventQueue$3.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source) at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source) at java.awt.EventQueue$4.run(Unknown Source) at java.awt.EventQueue$4.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source) at java.awt.EventQueue.dispatchEvent(Unknown Source) at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.run(Unknown Source) I've decompiled the Monopoly.class, line #159 is as follows: if (this.printThings) printStuff(paramGraphics); (paramGraphics is of Graphics type) line #176 is as follows: paramGraphics.drawImage(localPlayer.myGamePiece(), localPlayer.xyCords().x, localPlayer.xyCords().y, this); Attaching the decompiled Monopoly.java source code.
29-08-2012