JDK-8000293 : REGRESSION : There is no way to get Icon inf, once Softreference is released
  • Type: Backport
  • Backport of: JDK-7195106
  • Component: client-libs
  • Sub-Component: java.beans
  • Affected Version: 6u33
  • Priority: P2
  • Status: Closed
  • Resolution: Fixed
  • Submitted: 2012-10-01
  • Updated: 2012-11-19
  • Resolved: 2012-10-02
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 7 JDK 8
7u10 b12Fixed 8Fixed
Description
In recent JDK6ux( jdk6u21 and later), Icon can not be gotten by getIcon.

CONFIGURATION :
JDK : 6u21 and later/JDK7u5/JDK8(b53) (sparcV9)
OS : Solaris10

REPRODUCE:
1. Compile the test case attached below.
2. Run "java -XX:SoftRefLRUPolicyMSPerMB=0 b"

EXPECTED :

BufferedImage@116471f: type = 1 DirectColorModel: rmask=ff0000 gmask=ff00 bmask=ff amask=0 IntegerInterleavedRaster: width = 16 height = 16 #Bands = 3 xOff = 0yOff = 0 dataOffset[0] 0
BufferedImage@1f14ceb: type = 1 DirectColorModel: rmask=ff0000 gmask=ff00 bmask=ff amask=0 IntegerInterleavedRaster: width = 16 height = 16 #Bands = 3 xOff = 0yOff = 0 dataOffset[0] 0

ACTUAL : (2nd icon inf. cahnges "null")

BufferedImage@34a1fc: type = 1 DirectColorModel: rmask=ff0000 gmask=ff00 bmask=ff amask=0 IntegerInterleavedRaster: width = 16 height = 16 #Bands = 3 xOff = 0 yOff = 0 dataOffset[0] 0
null

TESTCASE:
==============================================================
import java.beans.*;
import java.awt.*;
import java.awt.image.*;

class b
{
  public static void main(String[] arg) throws Exception
  {
    BeanInfo info = Introspector.getBeanInfo(X.class);
    Image im = info.getIcon(BeanInfo.ICON_COLOR_16x16);
    System.out.println(im);
    System.gc();
    im = info.getIcon(BeanInfo.ICON_COLOR_16x16);
    System.out.println(im);
  }
  public static class X  {  }
  public static class XBeanInfo extends SimpleBeanInfo  {
    public XBeanInfo(){}
    public Image getIcon(int type)    {
      return new BufferedImage(16, 16, BufferedImage.TYPE_INT_RGB);
    }
  }
}
==============================================================


Please see comment section for more detils