BeDesk-Express

  • État Fermée
  • Pourcentage achevé
    100%
  • Type Bug
  • Catégorie Application
  • Assignée à
    DevTeam
  • Système d'exploitation Windows
  • Sévérité Critique
  • Priorité Très haute
  • Basée sur la version 17.8
  • Due pour la version 18.1
  • Échéance Non décidée
  • Votes
  • Privée
Concerne le projet: BeDesk-Express
Ouverte par DevTeam - 2017-10-03
Dernière modification par DevTeam - 2018-03-21

FS#1388 - Bug Java 9 : java.lang.NullPointerException @ java.desktop/sun.print.RasterPrinterJob.setAttributes

Nécessite un correctif de Java 9 et/ou du pilote d'impression

CE PROBLEME NECESSITE UN CORRECTIF DE JAVA 9 : CE CORRECTIF EST ATTENDU DE LA PART DE ORACLE (l’éditeur de Java)

Selon le ticket JDK-8186987 (https://bugs.openjdk.java.net/browse/JDK-8186987), un correctif est prévue par l’équipe JDK est planifiée pour Java 10 (http://openjdk.java.net/projects/jdk/10/)à paraitre en mars 2018. Ceci reporte ce correctif à BeDesk 18.

Attente de résolution tiers.

Contournement du problème

Pour contourner ce souci, utiliser le nouveau module d’impression via l’application PDF par défaut du système (voir Options/Système/Paramètres Système/Module d’impression).

https://guide.bedesk-express.com/faq:select_desktop_printer_job

Descriptif du problème

Avec Java 9 et certains modèles d’imprimante, lorsqu’on essaye d’imprimer un document sur Windows, rien ne se passe.

Liste des modèles d'imprimante affectés par le souci que nous avons répertorié:

  • Brother MFC-8520DN (confirmé)
  • Brother MFC-9140CDN (confirmé)
  • Brother DCP-9055CDN (confirmé)
  • Brother MFC-9460 (confirmé)
  • Brother MFC-9330 (non confirmé)
  • Brother DCP-7055 (confirmé)
  • Brother HL-4150CDN (confirmé)
  • HP Officejet Pro 6830 (non confirmé - peut-être un faux positif)
  • HP Photosmart 5520 (confirmé - via USB)

Journal de débogage

Lorsqu’on examine le journal de débogage, on trouve par exemple ceci:

AUTO-CONFIGURATION> RECHERCHE DE LA FILE D'IMPRESSION PAR DEFAUT... PATIENTEZ...
AUTO-CONFIGURATION> FILE D'IMPRESSION TROUVEE : Java Printing sur Brother MFC-8520DN Printer ACCUEIL1...
Before Attributes:
   media-printable-area = (25.4,25.4)->(159.102,246.238)mm[javax.print.attribute.standard.MediaPrintableArea]
   media = iso-a4[javax.print.attribute.standard.MediaSizeName]
Utilisation de l'ancien systeme d'impression... [ignorer le selecteur]
Service non trouve ... Tentative du 2ieme type... Avons-nous de la chance?...
MainWindow Activated...
Service d'impression disponible Brother MFC-8520DN Printer ACCUEIL1
setPrintService...
Print to:Brother MFC-8520DN Printer ACCUEIL1
Attributes:
   media-printable-area = (25.4,25.4)->(159.102,246.238)mm[javax.print.attribute.standard.MediaPrintableArea]
   media = iso-a4[javax.print.attribute.standard.MediaSizeName]
MyPrintServiceUI.getPaper - PrintableArea :(25.4,25.4)->(159.102,246.238)mm
                                     :X,Y = (72.0,72.0) lpi
                                     :W,H = (450.997802734375,697.9974975585938) lpi
MyPrintServiceUI.getPaper - Media Size    :iso-a4
                                     :210.0x297.0 mm
                                     :595.2755737304688x841.8897705078125 lpi
MyPrintServiceUI.getPaper - PrintableArea :(25.4,25.4)->(159.102,246.238)mm
                                     :X,Y = (72.0,72.0) lpi
                                     :W,H = (450.997802734375,697.9974975585938) lpi
MyPrintServiceUI.getPaper - Media Size    :iso-a4
                                     :210.0x297.0 mm
                                     :595.2755737304688x841.8897705078125 lpi
HTMLDOC *** AutoCheckFontSize patching font size 6 -> 7 ***
<#> Report length : 5130
<#> Report created in 292ms...
HTMLDOC *** AutoCheckFontSize patching font size 10 -> 11 ***
HTMLDOC *** AutoCheckFontSize patching font size 6 -> 7 ***
CREATE PageClassicHeaderImage : javax.swing.ImageIcon@74d65d9e
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
        at java.desktop/sun.print.RasterPrinterJob.setAttributes(Unknown Source)
        at java.desktop/sun.awt.windows.WPrinterJob.setAttributes(Unknown Source)
        at java.desktop/sun.print.RasterPrinterJob.print(Unknown Source)
        at bedesk._MainApp.factIconsBar_imprimeFact_actionPerformed(_MainApp.java:2866)
        at bedesk.AppAction.printDocument(AppAction.java:264)
        at bedesk.ui.iconsbar.document.DocumentsIconsBar$3.actionPerformed(DocumentsIconsBar.java:106)
        at java.desktop/javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
        at java.desktop/javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
        at java.desktop/javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
        at java.desktop/javax.swing.DefaultButtonModel.setPressed(Unknown Source)
        at java.desktop/javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
        at java.desktop/java.awt.AWTEventMulticaster.mouseReleased(Unknown Source)
        at java.desktop/java.awt.AWTEventMulticaster.mouseReleased(Unknown Source)
        at java.desktop/java.awt.Component.processMouseEvent(Unknown Source)
        at java.desktop/javax.swing.JComponent.processMouseEvent(Unknown Source)
        at java.desktop/java.awt.Component.processEvent(Unknown Source)
        at java.desktop/java.awt.Container.processEvent(Unknown Source)
        at java.desktop/java.awt.Component.dispatchEventImpl(Unknown Source)
        at java.desktop/java.awt.Container.dispatchEventImpl(Unknown Source)
        at java.desktop/java.awt.Component.dispatchEvent(Unknown Source)
        at java.desktop/java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
        at java.desktop/java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
        at java.desktop/java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
        at java.desktop/java.awt.Container.dispatchEventImpl(Unknown Source)
        at java.desktop/java.awt.Window.dispatchEventImpl(Unknown Source)
        at java.desktop/java.awt.Component.dispatchEvent(Unknown Source)
        at java.desktop/java.awt.EventQueue.dispatchEventImpl(Unknown Source)
        at java.desktop/java.awt.EventQueue.access$500(Unknown Source)
        at java.desktop/java.awt.EventQueue$3.run(Unknown Source)
        at java.desktop/java.awt.EventQueue$3.run(Unknown Source)
        at java.base/java.security.AccessController.doPrivileged(Native Method)
        at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
        at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
        at java.desktop/java.awt.EventQueue$4.run(Unknown Source)
        at java.desktop/java.awt.EventQueue$4.run(Unknown Source)
        at java.base/java.security.AccessController.doPrivileged(Native Method)
        at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
        at java.desktop/java.awt.EventQueue.dispatchEvent(Unknown Source)
        at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
        at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
        at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
        at java.desktop/java.awt.EventDispatchThread.pumpEvents(Unknown Source)
        at java.desktop/java.awt.EventDispatchThread.pumpEvents(Unknown Source)
        at java.desktop/java.awt.EventDispatchThread.run(Unknown Source)

La partie qui est la plus intéressante est celle-ci:

java.lang.NullPointerException
        at java.desktop/sun.print.RasterPrinterJob.setAttributes(Unknown Source)
        at java.desktop/sun.awt.windows.WPrinterJob.setAttributes(Unknown Source)
        at java.desktop/sun.print.RasterPrinterJob.print(Unknown Source)
        at bedesk._MainApp.factIconsBar_imprimeFact_actionPerformed(_MainApp.java:2866)

Le problème n’est pas directement dans le logiciel BeDesk. Il s’agit d’un bug de Java 9.


Description du bug JDK-8186987 : https://bugs.openjdk.java.net/browse/JDK-8186987

Ce problème a été rectifié dans l’OpenJDK le 21 septembre dernier, mais Oracle n’a pas encore reporté le correctif dans le Java 9 officiel.


Il semble que le pilote d’impression ne donne pas toujours les informations de résolution (la densité des points par pouce). Du coup, là où les informations devraient se trouver, il y a un pointeur NULL. D’où l’erreur.


Comme décrit par le BTS d’OpenJDK, il serait possible de contourner le souci en forçant la résolution de base (300dpi) en cas d’absence de l’objet PrinterResolution.

A rechercher et tester...


Tentative de contournement du problème à l’aide d’un wrapper qui enveloppe les PrintService retournés par le système. Ce wrapper PatchedPrintService détecte et corrige les attributs erronés ou manquant.

Tests nécessaires...


Malgré le Patch on continue avec :

CREATE PageClassicHeaderImage : javax.swing.ImageIcon@730a4a8c
         log> PatchedPrintService.getDefaultAttributeValue(javax.print.attribute.standard.JobSheets)
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
        at java.desktop/sun.print.RasterPrinterJob.setAttributes(Unknown Source)
        at java.desktop/sun.awt.windows.WPrinterJob.setAttributes(Unknown Source)
        at java.desktop/sun.print.RasterPrinterJob.print(Unknown Source)
        at java.desktop/sun.print.Win32PrintJob.pageableJob(Unknown Source)
        at java.desktop/sun.print.Win32PrintJob.print(Unknown Source)
        at java.desktop/sun.print.RasterPrinterJob.spoolToService(Unknown Source)
        at java.desktop/sun.print.RasterPrinterJob.print(Unknown Source)
        at bedesk._MainApp.factIconsBar_imprimeFact_actionPerformed(_MainApp.java:2866)

Or le patch fonctionne bien:

         log> PatchedPrintService.getDefaultAttributeValue(javax.print.attribute.standard.PrinterResolution)
PatchedPrintService : NULL javax.print.attribute.standard.PrinterResolution
PatchedPrintService : PATCHING javax.print.attribute.standard.PrinterResolution = 30000x30000 dphi
       - printer-resolution = 30000x30000 dphi [javax.print.attribute.standard.PrinterResolution]

Nouvel essai sur un poste affecté à l’aide du JDK:

CREATE PageClassicHeaderImage : javax.swing.ImageIcon@2ca36e49
         log> PatchedPrintService.getDefaultAttributeValue(javax.print.attribute.standard.JobSheets)
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
        at java.desktop/sun.print.RasterPrinterJob.setAttributes(RasterPrinterJob.java:1240)
        at java.desktop/sun.awt.windows.WPrinterJob.setAttributes(WPrinterJob.java:696)
        at java.desktop/sun.print.RasterPrinterJob.print(RasterPrinterJob.java:1510)
        at java.desktop/sun.print.Win32PrintJob.pageableJob(Win32PrintJob.java:573)
        at java.desktop/sun.print.Win32PrintJob.print(Win32PrintJob.java:390)
        at java.desktop/sun.print.RasterPrinterJob.spoolToService(RasterPrinterJob.java:1428)
        at java.desktop/sun.print.RasterPrinterJob.print(RasterPrinterJob.java:1516)
        at bedesk._MainApp.factIconsBar_imprimeFact_actionPerformed(_MainApp.java:2866)
        at bedesk.AppAction.printDocument(AppAction.java:264)
        at bedesk.ui.iconsbar.document.DocumentsIconsBar$3.actionPerformed(DocumentsIconsBar.java:106)
        at java.desktop/javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1967)
        at java.desktop/javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2308)
        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:269)
        at java.desktop/java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:297)
        at java.desktop/java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:297)
        at java.desktop/java.awt.Component.processMouseEvent(Component.java:6578)
        at java.desktop/javax.swing.JComponent.processMouseEvent(JComponent.java:3343)
        at java.desktop/java.awt.Component.processEvent(Component.java:6343)
        at java.desktop/java.awt.Container.processEvent(Container.java:2259)
        at java.desktop/java.awt.Component.dispatchEventImpl(Component.java:4961)
        at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2317)
        at java.desktop/java.awt.Component.dispatchEvent(Component.java:4793)
        at java.desktop/java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4904)
        at java.desktop/java.awt.LightweightDispatcher.processMouseEvent(Container.java:4539)
        at java.desktop/java.awt.LightweightDispatcher.dispatchEvent(Container.java:4480)
        at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2303)
        at java.desktop/java.awt.Window.dispatchEventImpl(Window.java:2758)
        at java.desktop/java.awt.Component.dispatchEvent(Component.java:4793)
        at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:766)
        at java.desktop/java.awt.EventQueue.access$500(EventQueue.java:97)
        at java.desktop/java.awt.EventQueue$3.run(EventQueue.java:717)
        at java.desktop/java.awt.EventQueue$3.run(EventQueue.java:711)
        at java.base/java.security.AccessController.doPrivileged(Native Method)
        at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:89)
        at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:99)
        at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:739)
        at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:737)
        at java.base/java.security.AccessController.doPrivileged(Native Method)
        at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:89)
        at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:736)
        at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:199)
        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)
Cette tâche dépend de
ID Projet Résumé Priorité Sévérité Progression
1899 BeDesk-Express  FS#1899 - Integration de Java 10  Moyenne Basse
100%
Cette tâche a la sous-tâche suivante
ID Projet Résumé Priorité Sévérité Progression
1390 BeDesk-Express  FS#1390 - Correction des attributs des pilotes d'impression à l'aide d'un   Très haute Critique
100%
Fermée par  DevTeam
2018-03-21 14:01
Raison de la fermeture :  Disponible

Chargement...

Activer les raccourcis clavier

Liste des tâches

Détails de la tâche

Édition de la tâche