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

MediaPlayer: NPE in startTimeProperty() / stopTimeProperty

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Priority: P4
    • Resolution: Unresolved
    • Affects Version/s: 7u25
    • Fix Version/s: tbd
    • Component/s: javafx
    • Environment:

      Description

      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).

        Attachments

          Activity

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            duke J. Duke (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:
              Imported: