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

JavaFX cannot load some jpg images over http

    XMLWordPrintable

Details

    • x86_64
    • windows_10

    Description

      ADDITIONAL SYSTEM INFORMATION :
      os used : windows 10,
      jdk used : 8 update 281

      A DESCRIPTION OF THE PROBLEM :
      i am trying to load images from web using image class. The image class is not loading most of the url's. It is throwing an excetion "com.sun.javafx.iio.ImageStorageException: No loader for image data" for image.getException() method for those url's which it does not loads.


      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      i have posted the code in stackoverflow link:-
      https://stackoverflow.com/questions/66969607/not-able-to-load-images-from-internet-imageview-in-javafx

      or alternately i have posted the code in oracle community:-
      https://community.oracle.com/tech/developers/discussion/4482935/not-able-to-load-images-from-internet-imageview-in-javafx/p1?new=1

      or a similar code can be found in github page which also showing this problem
      https://gist.github.com/jewelsea/2556122


      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      the program should display image in imageview javafx. for most of the url's it is not displaying the image in imageview and you will get an exception "com.sun.javafx.iio.ImageStorageException: No loader for image data".
      some images are displayed without error from the url.
      ACTUAL -
      Image class should load and display image in ImageView. The same url's are working fine with other devices like browser, android devices.

      ---------- BEGIN SOURCE ----------
      please see the stackoverflow link :-
      https://stackoverflow.com/questions/66969607/not-able-to-load-images-from-internet-imageview-in-javafx

      please see oracle community link :-
      https://community.oracle.com/tech/developers/discussion/4482935/not-able-to-load-images-from-internet-imageview-in-javafx/p1?new=1

      please see github link:-
      https://gist.github.com/jewelsea/2556122
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      //Temprary code to load image is given as below:-

      URLConnection connection = new URL(i3).openConnection();
      connection.addRequestProperty("User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:25.0) Gecko/20100101 Firefox/25.0");
      Image image = new Image(connection.getInputStream());

      //In this method we cannot attach progress listeners or error listeners.

      FREQUENCY : always


      Attachments

        Issue Links

          Activity

            People

              kcr Kevin Rushforth
              webbuggrp Webbug Group
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated: