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

[macosx]Cannot get the printer name correctly when using Java7.

XMLWordPrintable

    • 2d
    • x86
    • os_x

      FULL PRODUCT VERSION :
      java version "1.7.0_04"
      Java(TM) SSE Runtime Environment (build 1.7.0_04-b21)
      Java HotSpot(TM) 64-Bit server VM (build 23.0-b21, mixed mode)

      ADDITIONAL OS VERSION INFORMATION :
      Mac OSX Lion 10.7.4 (11E53)

      A DESCRIPTION OF THE PROBLEM :
      I try to get a name of the printer which is connected my PC (Mac) using javax.print.PrintService.
      However, a part of the name is incorrect.
      Non-alphanumeric characters included in the name has been converted into the underscore, so the print job doesn't work properly.
      In the case of Java6, this problem doesn't occur on the same PC.
      It also work correctly on WindowsXP SP3 + Java7.

      REGRESSION. Last worked in version 6u31

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Execute the code below.

      package print;
       
      import javax.print.*;
      import javax.print.attribute.HashPrintRequestAttributeSet;
      import javax.print.attribute.PrintRequestAttributeSet;
       
      public class print_test {
          /**
           * @param args
           */
          public static void main(String[] args) {
       
              PrintRequestAttributeSet attributes = new HashPrintRequestAttributeSet();
       
              PrintService[] services = PrintServiceLookup
                      .lookupPrintServices(DocFlavor.SERVICE_FORMATTED.PRINTABLE, null);
       
              // get printname
              for (int i = 0 ; services.length > i ; i++) {
                  System.out.println(services[i].getName());
              }
          }
      }


      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Canon ip_3100
      ApeosPort-IV C2775 (b5_d8_e0)
      10.123.120.122
      ACTUAL -
      _10_123_120_122
      ApeosPort_IV_C2775__b5_d8_e0_
      Canon_ip_3100

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      package print;
       
      import javax.print.*;
      import javax.print.attribute.HashPrintRequestAttributeSet;
      import javax.print.attribute.PrintRequestAttributeSet;
       
      public class print_test {
          /**
           * @param args
           */
          public static void main(String[] args) {
       
              PrintRequestAttributeSet attributes = new HashPrintRequestAttributeSet();
       
              PrintService[] services = PrintServiceLookup
                      .lookupPrintServices(DocFlavor.SERVICE_FORMATTED.PRINTABLE, null);
       
              // get printname
              for (int i = 0 ; services.length > i ; i++) {
                  System.out.println(services[i].getName());
              }
          }
      }

      ---------- END SOURCE ----------

            prr Philip Race
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: