JDK-7195106 : REGRESSION : There is no way to get Icon inf, once Softreference is released
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.beans
  • Affected Version: 6u33
  • Priority: P2
  • Status: Closed
  • Resolution: Fixed
  • OS: solaris_10
  • CPU: sparc
  • Submitted: 2012-08-30
  • Updated: 2013-06-26
  • Resolved: 2012-09-11
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 Availabitlity Release.

To download the current JDK release, click here.
JDK 6 JDK 7 JDK 8
6u71Fixed 7u10Fixed 8 b56Fixed
Related Reports
Relates :  
Relates :  
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

Comments
Using the Regression Test
2013-05-30

EVALUATION This is a regression after the 7064279 fix. We must use references to clean BeanInfo's cache automatically, but we can reload explicit BeanInfo on demand.
2012-09-03