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

NullPointerExcpn-java.awt.image.FilteredImageSource.startProduction JDK-8079607

    XMLWordPrintable

Details

    • CSR
    • Resolution: Approved
    • P3
    • 10
    • client-libs
    • behavioral
    • minimal
    • Hide
      The change does not alter the intent of the methods but mandates the threads to acquire lock on FilteredImageSource before executing the methods. This has the potential to cause deadlocks in a multi-threaded scenario. However, a thorough verification has confirmed that the possibility of deadlocks doesn't exist with existing ImageProducers in JDK.
      Show
      The change does not alter the intent of the methods but mandates the threads to acquire lock on FilteredImageSource before executing the methods. This has the potential to cause deadlocks in a multi-threaded scenario. However, a thorough verification has confirmed that the possibility of deadlocks doesn't exist with existing ImageProducers in JDK.
    • Java API
    • SE

    Description

      Summary

      Synchronize the methods of FilteredImageSource to avoid NullPointerExceptions while accessing the HashTable.

      Problem

      A NullPointerException was observed at java.awt.image.FilteredImageSource.startProduction method.

      FilteredImageSource instantiates a HashTable for its operation. The methods- startProduction and requestTopDownLeftRightResend of FilteredImageSource read or update this HashTable in un-synchronized manner. In a multi-threaded environment, the un-synchronized access to the HashTable is susceptible to the exceptions as reported in the bug.

      Solution

      The proposed solution makes the concerned methods 'synchronized' after duly evaluating possibilities for deadlocks.

      Specification

        /**
         * This class is an implementation of the ImageProducer interface which
         * takes an existing image and a filter object and uses them to produce
      -- * image data for a new filtered version of the original image.
      ++ * image data for a new filtered version of the original image. Furthermore,
      ++ * {@code FilteredImageSource} is safe for use by multiple threads.

      -- public void startProduction(ImageConsumer ic) {
      ++ public synchronized void startProduction(ImageConsumer ic) {

      -- public void requestTopDownLeftRightResend(ImageConsumer ic) {
      ++ public synchronized void requestTopDownLeftRightResend(ImageConsumer ic) {

      Attachments

        Issue Links

          Activity

            People

              pnarayanan Prahalad Kumar Narayanan (Inactive)
              shadowbug Shadow Bug
              Philip Race
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: