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

MediaPlayer: NPE in startTimeProperty() / stopTimeProperty

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P4 P4
    • tbd
    • 7u25
    • javafx

      Having this code:

      final MediaPlayer result = new MediaPlayer(media);
      result.startTimeProperty();


      throws an NPE at my system:


      Exception in runnable
      java.lang.NullPointerException
      at javafx.scene.media.MediaPlayer.calculateCycleDuration(MediaPlayer.java:1122)
      at javafx.scene.media.MediaPlayer.preReady(MediaPlayer.java:1727)
      at javafx.scene.media.MediaPlayer$_PlayerStateListener$1.run(MediaPlayer.java:2251)
      at com.sun.javafx.application.PlatformImpl$4$1.run(PlatformImpl.java:179)
      at com.sun.javafx.application.PlatformImpl$4$1.run(PlatformImpl.java:176)
      at java.security.AccessController.doPrivileged(Native Method)
      at com.sun.javafx.application.PlatformImpl$4.run(PlatformImpl.java:176)
      at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:76)
      at com.sun.glass.ui.gtk.GtkApplication._runLoop(Native Method)
      at com.sun.glass.ui.gtk.GtkApplication$3$1.run(GtkApplication.java:82)
      at java.lang.Thread.run(Thread.java:724)


      The given media for the player is valid.
      On searching the bug, I added a change listener on the status property:

      result.statusProperty().addListener(new ChangeListener<Status>() {
        @Override
        public void changed(ObservableValue<? extends Status> observable, Status oldValue, Status newValue) {
          System.out.println("status changed: " + oldValue + " -> " + newValue);
          }
        });


      Output:

      status changed: null -> READY


      I assume this could be the reason for the NPE. I would not expect getting an NPE but the player dealing internally with the status UNKNOWN instead of null (if this is the reason).

            Unassigned Unassigned
            duke J. Duke
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Imported: