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

sun.awt.motif.MFontConfiguration fails to close java.util.Scanner

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P4
    • Resolution: Won't Fix
    • Affects Version/s: 6u10
    • Fix Version/s: None
    • Component/s: client-libs
    • Labels:
    • Subcomponent:
    • CPU:
      x86
    • OS:
      linux

      Description

      FULL PRODUCT VERSION :
      java version "1.6.0_06"
      Java(TM) SE Runtime Environment (build 1.6.0_06-b02)
      Java HotSpot(TM) Client VM (build 10.0-b22, mixed mode, sharing)


      ADDITIONAL OS VERSION INFORMATION :
      Linux xx 2.6.18-92.1.6.el5 #1 SMP Wed Jun 25 13:49:24 EDT 2008 i686 i686 i386 GNU/Linux

      A DESCRIPTION OF THE PROBLEM :
      The getVersionString(File f) method of sun.awt.motif.MFontConfiguration creates a java.util.Scanner but does not close it. The end result is that a input stream is left hanging around until such time as it is garbage collected.

      I believe this can be trivially fixed by adding scanner.close() as a finally clause in the getVersionString(File f) method.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Observing the effect is somewhat difficult unless you have an application which needs to write to a very high number of simultaneous streams.


      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      > Trace for File Handle:
              java.io.FileInputStream.<init>(FileInputStream.java:107)
              java.util.Scanner.<init>(Scanner.java:636)
              sun.awt.motif.MFontConfiguration.getVersionString(MFontConfiguration.java:169)
              sun.awt.motif.MFontConfiguration.setOsNameAndVersion(MFontConfiguration.java:150)
              sun.awt.FontConfiguration.<init>(FontConfiguration.java:67)
              sun.awt.motif.MFontConfiguration.<init>(MFontConfiguration.java:31)
              sun.awt.X11GraphicsEnvironment.createFontConfiguration(X11GraphicsEnvironment.java:897)
              sun.java2d.SunGraphicsEnvironment$2.run(SunGraphicsEnvironment.java:205)
              java.security.AccessController.doPrivileged(Native Method)
              sun.java2d.SunGraphicsEnvironment.<init>(SunGraphicsEnvironment.java:125)
              sun.awt.X11GraphicsEnvironment.<init>(X11GraphicsEnvironment.java:204)
              sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
              sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
              sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
              java.lang.reflect.Constructor.newInstance(Constructor.java:513)
              java.lang.Class.newInstance0(Class.java:355)
              java.lang.Class.newInstance(Class.java:308)
              java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(GraphicsEnvironment.java:68)
              java.awt.image.BufferedImage.createGraphics(BufferedImage.java:1135)


      REPRODUCIBILITY :
      This bug can be reproduced always.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              ndcosta Nelson Dcosta (Inactive)
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Imported:
                Indexed: