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

JTable.print() failed with UnsupportedCharsetException on AIX ko_KR locale

XMLWordPrintable

    • b15
    • ppc
    • aix

        On AIX ko_KR locale, I could see following exception after JTable.print() was called

        ==========
        java.nio.charset.UnsupportedCharsetException: sun.font.X11KSC5601
                at java.base/java.nio.charset.Charset.forName(Charset.java:527)
                at java.desktop/sun.awt.FontConfiguration.getFontCharsetEncoder(FontConfiguration.java:964)
                at java.desktop/sun.awt.FontConfiguration.buildFontDescriptors(FontConfiguration.java:921)
                at java.desktop/sun.awt.FontConfiguration.getFontDescriptors(FontConfiguration.java:884)
                at java.desktop/sun.awt.FontConfiguration.getFontDescriptors(FontConfiguration.java:876)
                at java.desktop/sun.awt.PlatformFont.<init>(PlatformFont.java:74)
                at java.desktop/sun.awt.X11.XFontPeer.<init>(XFontPeer.java:33)
                at java.desktop/sun.awt.X11.XToolkit.getFontPeer(XToolkit.java:952)
                at java.desktop/java.awt.Font.getFontPeer(Font.java:488)
                at java.desktop/java.awt.Font$FontAccessImpl.getFontPeer(Font.java:282)
                at java.desktop/sun.print.PSPrinterJob.platformFontCount(PSPrinterJob.java:1247)
                at java.desktop/sun.print.PSPathGraphics.platformFontCount(PSPathGraphics.java:150)
                at java.desktop/sun.print.PathGraphics.printedSimpleGlyphVector(PathGraphics.java:851)
                at java.desktop/sun.print.PathGraphics.drawGlyphVector(PathGraphics.java:649)
                at java.desktop/sun.font.ExtendedTextSourceLabel.handleDraw(ExtendedTextSourceLabel.java:193)
                at java.desktop/sun.font.Decoration.drawTextAndDecorations(Decoration.java:123)
                at java.desktop/sun.font.ExtendedTextSourceLabel.draw(ExtendedTextSourceLabel.java:197)
                at java.desktop/java.awt.font.TextLine.draw(TextLine.java:776)
                at java.desktop/java.awt.font.TextLayout.draw(TextLayout.java:2609)
                at java.desktop/sun.swing.SwingUtilities2.drawString(SwingUtilities2.java:541)
                at java.desktop/sun.swing.SwingUtilities2.drawStringUnderlineCharAt(SwingUtilities2.java:652)
                at java.desktop/sun.swing.SwingUtilities2.drawStringUnderlineCharAt(SwingUtilities2.java:631)
                at java.desktop/javax.swing.plaf.basic.BasicLabelUI.paintEnabledText(BasicLabelUI.java:138)
                at java.desktop/javax.swing.plaf.basic.BasicLabelUI.paint(BasicLabelUI.java:203)
                at java.desktop/javax.swing.plaf.ComponentUI.update(ComponentUI.java:161)
                at java.desktop/javax.swing.JComponent.paintComponent(JComponent.java:852)
                at java.desktop/sun.swing.table.DefaultTableCellHeaderRenderer.paintComponent(DefaultTableCellHeaderRenderer.java:159)
                at java.desktop/javax.swing.JComponent.printComponent(JComponent.java:1292)
                at java.desktop/javax.swing.JComponent.paint(JComponent.java:1132)
                at java.desktop/javax.swing.CellRendererPane.paintComponent(CellRendererPane.java:170)
                at java.desktop/javax.swing.plaf.basic.BasicTableHeaderUI.paintCell(BasicTableHeaderUI.java:741)
                at java.desktop/javax.swing.plaf.basic.BasicTableHeaderUI.paint(BasicTableHeaderUI.java:683)
                at java.desktop/javax.swing.plaf.ComponentUI.update(ComponentUI.java:161)
                at java.desktop/javax.swing.JComponent.paintComponent(JComponent.java:852)
                at java.desktop/javax.swing.JComponent.printComponent(JComponent.java:1292)
                at java.desktop/javax.swing.JComponent.paint(JComponent.java:1132)
                at java.desktop/javax.swing.JComponent.print(JComponent.java:1274)
                at java.desktop/javax.swing.TablePrintable.print(TablePrintable.java:370)
                at java.desktop/javax.swing.JTable$ThreadSafePrintable$1.run(JTable.java:6630)
                at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:318)
                at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:773)
                at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:720)
                at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:714)
                at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
                at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86)
                at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:742)
                at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
                at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
                at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:117)
                at java.desktop/java.awt.WaitDispatchSupport$2.run(WaitDispatchSupport.java:191)
                at java.desktop/java.awt.WaitDispatchSupport$4.run(WaitDispatchSupport.java:236)
                at java.desktop/java.awt.WaitDispatchSupport$4.run(WaitDispatchSupport.java:234)
                at java.base/java.security.AccessController.doPrivileged(AccessController.java:318)
                at java.desktop/java.awt.WaitDispatchSupport.enter(WaitDispatchSupport.java:234)
                at java.desktop/java.awt.Dialog.show(Dialog.java:1080)
                at java.desktop/java.awt.Component.show(Component.java:1728)
                at java.desktop/java.awt.Component.setVisible(Component.java:1675)
                at java.desktop/java.awt.Window.setVisible(Window.java:1036)
                at java.desktop/java.awt.Dialog.setVisible(Dialog.java:1016)
                at java.desktop/sun.swing.PrintingStatus.showModalOnEDT(PrintingStatus.java:204)
                at java.desktop/sun.swing.PrintingStatus.showModal(PrintingStatus.java:172)
                at java.desktop/javax.swing.JTable.print(JTable.java:6439)
                at java.desktop/javax.swing.JTable.print(JTable.java:6246)
                at java.desktop/javax.swing.JTable.print(JTable.java:6201)
                at java.desktop/javax.swing.JTable.print(JTable.java:6166)
                at java.desktop/javax.swing.JTable.print(JTable.java:6140)
                at WeekdayList$1.actionPerformed(WeekdayList.java:28)
                at java.desktop/javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1972)
                at java.desktop/javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2313)
                at java.desktop/javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:405)
                at java.desktop/javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:262)
                at java.desktop/javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:279)
                at java.desktop/java.awt.Component.processMouseEvent(Component.java:6620)
                at java.desktop/javax.swing.JComponent.processMouseEvent(JComponent.java:3398)
                at java.desktop/java.awt.Component.processEvent(Component.java:6385)
                at java.desktop/java.awt.Container.processEvent(Container.java:2266)
                at java.desktop/java.awt.Component.dispatchEventImpl(Component.java:4995)
                at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2324)
                at java.desktop/java.awt.Component.dispatchEvent(Component.java:4827)
                at java.desktop/java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4948)
                at java.desktop/java.awt.LightweightDispatcher.processMouseEvent(Container.java:4575)
                at java.desktop/java.awt.LightweightDispatcher.dispatchEvent(Container.java:4516)
                at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2310)
                at java.desktop/java.awt.Window.dispatchEventImpl(Window.java:2780)
                at java.desktop/java.awt.Component.dispatchEvent(Component.java:4827)
                at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:775)
                at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:720)
                at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:714)
                at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
                at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86)
                at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:97)
                at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:747)
                at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:745)
                at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
                at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86)
                at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:744)
                at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
                at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
                at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
                at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
                at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
                at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)
        ==========

        Test instructions are as follows:
        (Note: GUI environment, Korean locale and printer setting are required on AIX system)

        1. Compile WeekdayList.java and execute it on ko_KR locale with -Dfile.encoding=COMPAT option on GUI environment
            $ env LANG=ko_KR java -Dfile.encoding=COMPAT WeekdayList
        2. Press Print button
        3. On print dialog, select "Print To File" checkbox, press Print button
        4. On file dialog, set "File Name", press Save button
           (If file name is there, confirmation dialog is displayed, press "Yes" if the file can be overwritten)
        5. Then see above exception

        According to my investigation, sun.font.X11KSC5601 came from:
          src/java.desktop//unix/classes/sun/font/MFontConfiguration.java:
            encodingMap.put("ksc5601.1987-0", "sun.font.X11KSC5601");

        This issue was happned on following code.
                if (!charsetName.startsWith("sun.awt.") && !charsetName.equals("default")) {
                    fc = Charset.forName(charsetName);
                } else {

        On JDK8, X11KSC5601 class file is in sun.awt.motif package.

        But it seems it was moved to sun.font package by:
            JDK-8035302 Eliminate dependency on jdk.charsets from 2D font code.
        I think !charsetName.startsWith("sun.font.") should be added

              itakiguchi Ichiroh Takiguchi
              itakiguchi Ichiroh Takiguchi
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

                Created:
                Updated:
                Resolved: