Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8000293

REGRESSION : There is no way to get Icon inf, once Softreference is released

XMLWordPrintable

    • b12
    • Verified

      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

            malenkov Sergey Malenkov (Inactive)
            tbaba Tadayuki Baba (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: