JDK-4397681 : MediaTracker serialization spec refer package-protected field MediaEntry
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 1.3.0
  • Priority: P4
  • Status: Open
  • Resolution: Unresolved
  • OS: solaris_2.5
  • CPU: sparc
  • Submitted: 2000-12-13
  • Updated: 2021-07-13
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
tbdUnresolved
Related Reports
Relates :  
Relates :  
Relates :  
Description

Name: apR10100			Date: 12/13/2000



--------------------- 1.3's MediaTracker serialized form spec

Class java.awt.MediaTracker implements Serializable 
Serialized Fields 
head
java.awt.MediaEntry head
The head of the list of Images that is being tracked by the MediaTracker.
 
addImage(), removeImage()
---------------------------------------------------------

refer MediaEntry class, that is absent in spec. This makes serialized form of
MediaTracker class incompatible between java implementations.

---------------- e-mail thread

  This interface is meant to allow any instance of a class implementing it to
  have it's state saved to and restored from a java stream.

  MediaTracker, by its nature has a very transient state, with each of the
  objects
  being tracked changing state independently of the MediaTracker object itself.
  Also, the states of these objects will very likely have no meaning after the
  deserialization of a MediaTracker, which could be at any time in the future.

  MediaTracker also relies on a linked list of abstract MediaEntry objects,
  currently with only one concrete subclass: ImageMediaEntry. While this
  subclass
  also implements the serializable interface, MediaEntry does not. All of the
  state information about the tracked object is held in the MediaEntry class,
  and thus is lost on serialization. As well as the state information, the
  list
  structure itself is held in MediaEntry, meaning that only the first added
  object
  of the lowest ID set will be serialized at all.

  Finaly, the only object that a MediaTracker can hold is a java.awt.Image, a
  class that is not itself serializable (and nor are any of its concrete
  implementations).

  So, the only state in which a MediaTracker can be sucessfuly serialised is
  the one in which it contains no tracked objects, and MediaTracker does not
  implement an API which allows code to check if there are any present.

  The PJCK1.2 test for the serialization of MediaTracker:

    tests/api/java_awt/serialization/MediaTrackerTests.java

  creates 4 Images, and one MediaTracker, does not add any of the Images to
  the MediaTracker, and then tests for the correct serialization and
  deserialization of the object, checking that the state of the tracked
  objects
  of the saved object (of which there are none) matches the state of the
  tracked
  objects of the restored object (of which there are also none).

  If the Images had been added, the test would of course fail with a
  NotSerializableException.

  Our implementation of MediaTracker does not use MediaEntry or
  ImageMediaEntry
  classes, adding them to our Java implementation would increase code size and
  provide no extra functionality, as they are never used, and can never be
  added
  to a serialized stream without an exception being thrown ending the
  attempted serialization.

  However, to pass the JCK test, these classes must be added, and extra code
  added to our implementation of MediaTracker to attempt the serialization of
  instances of these classes, which must fail by throwing an exception.
----------------
                      
======================================================================

Comments
EVALUATION I believe MediaTracker issues are generally handled by classes_2D. eric.hawkes@eng 2000-12-13 In general, 2D will handle MediaTracker issues if it really pertains to images. However, it is obvious that AWT added this feature to MediaTracker and they need to fix it. jeannette.hung@Eng 2000-12-14
14-12-2000