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

Assumptions that URL[Connection].getContent() returns an ImageProducer

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P4 P4
    • tbd
    • 24, 25
    • client-libs
    • None

      The following code in java.desktop/share/classes/java/beans/SimpleBeanInfo.java assumes an ImageProducer returned by URL.getContent()
          public Image loadImage(final String resourceName) {
              try {
                  final URL url = getClass().getResource(resourceName);
                  if (url != null) {
                      final ImageProducer ip = (ImageProducer) url.getContent();
                      if (ip != null) {
                          return Toolkit.getDefaultToolkit().createImage(ip);
                      }
                  }
              } catch (final Exception ignored) {
              }
              return null;
          }

      The spec. doesn't guarantee this.
      SimpleBeanInfo should probably be migrated to some other API to interpret the image data
      The test java/beans/SimpleBeanInfo/LoadingStandardIcons/LoadingStandardIcons.java
      can be used to verify the migration

      This would allow us to drop the SPI implemented by
      sun/awt/www/content/MultimediaContentHandlers.java
      The test java/beans/SimpleBeanInfo/LoadingStandardIcons/LoadingStandardIcons.java will fail if it isn't migrated.

            prr Philip Race
            prr Philip Race
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: