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

[macosx] failing to load MultiResolutionImage in case if file name contains extra "@2x"

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not an Issue
    • Icon: P4 P4
    • None
    • 9
    • client-libs

      The example is unnatural and probably does not correspond to naming conventions (so probably not an issue); but just in case:

      please take JDK-8133847 test example and define
      private static final String IMAGE_NAME_1X = "someimage";
      private static final String IMAGE_NAME_2X = "someimage@2x";

      Output (Mac OS X 10.10.3, JDK9 b77) is as expected:
        file: /Users/xxx/work/tests/Test/someimage
        image class: sun.awt.image.MultiResolutionToolkitImage

      then set
      private static final String IMAGE_NAME_1X = "some.image";
      private static final String IMAGE_NAME_2X = "some.image@2x";

      Output is invalid:
        file: /Users/xxx/work/tests/Test/some.image
        image class: sun.awt.image.ToolkitImage
         Exception in thread "main" java.lang.ClassCastException: sun.awt.image.ToolkitImage cannot be cast to sun.awt.image.MultiResolutionImage
              at Test.main(Test.java:27)

      (in case of non-empty extension the MultiResolutionImage could be read).

            alexsch Alexandr Scherbatiy
            avstepan Alexander Stepanov (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: