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

Media Locator cannot follow redirect response

    XMLWordPrintable

    Details

    • Subcomponent:
    • CPU:
      x86_64
    • OS:
      windows_7

      Description

      ADDITIONAL SYSTEM INFORMATION :
      Windows 7 Pro 64-bit
      Microsoft Windows [Version 6.1.7601]
      Java 11.0.1+13
      openjfx "11" from maven repositories

      A DESCRIPTION OF THE PROBLEM :
      Media Locator cannot follow "Moved permanently" response - 301 status code.

      http://download.blender.org/peach/bigbuckbunny_movies/BigBuckBunny_320x180.mp4
      has been moved to:
      https://download.blender.org/peach/bigbuckbunny_movies/BigBuckBunny_320x180.mp4


      $ curl -I http://download.blender.org/peach/bigbuckbunny_movies/BigBuckBunny_320x180.mp4
        % Total % Received % Xferd Average Speed Time Time Time Current
                                       Dload Upload Total Spent Left Speed
        0 178 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0HTTP/1.1 301 Moved Permanently
      Server: nginx
      Date: Fri, 02 Nov 2018 11:47:11 GMT
      Content-Type: text/html
      Content-Length: 178
      Location: https://download.blender.org/peach/bigbuckbunny_movies/BigBuckBunny_320x180.mp4


      JavaFx Locator returns: MediaException: MEDIA_INACCESSIBLE : could not connect to media (http://download.blender.org/peach/bigbuckbunny_movies/BigBuckBunny_320x180.mp4)

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Run executable test case and wait for video to be opened (or for exception in console).

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      301 response code is handled and video is played as expected from new location: https://download.blender.org/peach/bigbuckbunny_movies/BigBuckBunny_320x180.mp4
      ACTUAL -
      JavaFx Locator returns: MediaException: MEDIA_INACCESSIBLE : could not connect to media (http://download.blender.org/peach/bigbuckbunny_movies/BigBuckBunny_320x180.mp4)

      ---------- BEGIN SOURCE ----------
      import javafx.application.Application;
      import javafx.scene.Scene;
      import javafx.scene.layout.BorderPane;
      import javafx.scene.media.Media;
      import javafx.scene.media.MediaPlayer;
      import javafx.scene.media.MediaView;
      import javafx.stage.Stage;

      public class Main
      {

          public static void main( String[] args )
          {
              Application.launch( MainFx.class, args );
          }

          public static class MainFx extends Application
          {

              @Override
              public void start( final Stage primaryStage ) throws Exception
              {
                  System.err.println( Runtime.version().toString() );
                  final BorderPane parent = new BorderPane();
                  final Media media =
                      new Media( "http://download.blender.org/peach/bigbuckbunny_movies/BigBuckBunny_320x180.mp4" );
                  media.setOnError( () -> {
                      throw new IllegalStateException( media.getError() );
                  } );
                  final MediaView aMediaView = new MediaView( new MediaPlayer( media ) );
                  aMediaView.getMediaPlayer().setAutoPlay( true );
                  parent.setCenter( aMediaView );
                  final Scene aScene = new Scene( parent, 800, 600 );
                  primaryStage.setScene( aScene );
                  primaryStage.show();
              }

          }
      }
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      Every url passed to javafx.scene.Media must be checked against response code to handle 301 status code relocations.

      FREQUENCY : always


        Attachments

          Activity

            People

            • Assignee:
              pmangal Priyanka Mangal (Inactive)
              Reporter:
              webbuggrp Webbug Group
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: