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

TEST_BUG: /java/awt/PrintJob/QuoteAndBackslashTest fails

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not an Issue
    • Icon: P4 P4
    • 6u2
    • 6u2
    • client-libs
    • None
    • 2d
    • sparc
    • solaris_10

      Java Version: 1.6.0_02-ea-b02 and 1.6.0_01-ea-b04
      Platform: Solaris-Sparc
                host: d2-sunburst.sfbay
      Problem:
        The regression test fails due to two problems.
        First, it doesn't print that banner titles which contain double quotation marks
      or backslashes correctly in solaris platform.
        Second, when you click the print button in test frame, it threw exceptions, but if you click the print on the applet, it is OK, see exceptions below:

      d2-sunburst% /net/jre.sfbay/p/v06/jdk/6_02/ea/b02/binaries/solaris-sparc/bin/appletviewer QuoteAndBackslashTest.html
      Finished printing.
      Exception in thread "AWT-EventQueue-1" java.security.AccessControlException: access denied (java.lang.RuntimePermission queuePrintJob)
              at java.security.AccessControlContext.checkPermission(AccessControlContext.java:323)
              at java.security.AccessController.checkPermission(AccessController.java:546)
              at java.lang.SecurityManager.checkPermission(SecurityManager.java:532)
              at java.lang.SecurityManager.checkPrintJobAccess(SecurityManager.java:1355)
              at sun.print.PrintJob2D.initPrintJob2D(PrintJob2D.java:310)
              at sun.print.PrintJob2D.<init>(PrintJob2D.java:294)
              at sun.awt.X11.XToolkit.getPrintJob(XToolkit.java:977)
              at QuoteAndBackslashTestFrame.actionPerformed(QuoteAndBackslashTest.java:43)
              at java.awt.Button.processActionEvent(Button.java:392)
              at java.awt.Button.processEvent(Button.java:360)
              at java.awt.Component.dispatchEventImpl(Component.java:4410)
              at java.awt.Component.dispatchEvent(Component.java:4240)
              at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
              at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273)
              at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183)
              at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173)
              at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160) at java.awt.EventDispatchThread.run(EventDispatchThread.java:121)

      Attached is the test case:
      /**
       * @(#)QuoteAndBackslashTest.java 1.2 98/07/20
       * @bug 4040668
       * @summary Checks that banner titles which contain double quotation marks
       * or backslashes still print correctly.
       * @author dpm
       */

      import java.awt.*;
      import java.awt.event.*;
      import java.applet.Applet;

      public class QuoteAndBackslashTest extends Applet {
          public static void main(String[] args) {
              new QuoteAndBackslashTest().start();
          }
          public void start() {
              new QuoteAndBackslashTestFrame();
          }
      }

      class QuoteAndBackslashTestFrame extends Frame implements ActionListener {
          PrintCanvas canvas;

          public QuoteAndBackslashTestFrame () {
              super("QuoteAndBackslashTest");
      canvas = new PrintCanvas ();
      add("Center", canvas);

      Button b = new Button("Print");
      b.setActionCommand ("print");
      b.addActionListener (this);
      add("South", b);

      pack();
      setVisible(true);
          }


          public void actionPerformed(ActionEvent e) {
              String cmd = e.getActionCommand();
      if (cmd.equals("print")) {
      PrintJob pjob = getToolkit().getPrintJob(this, "\\\"\"\\\"",
      null);
      if (pjob != null) {
      Graphics pg = pjob.getGraphics();

      if (pg != null) {
      canvas.printAll(pg);
      pg.dispose(); //flush page
      }

      pjob.end();
      }
      }
          }
      }

      class PrintCanvas extends Canvas {
          public Dimension getPreferredSize() {
              return new Dimension(659, 792);
          }

          public void paint (Graphics g) {
              setBackground(Color.white);
      g.setColor(Color.blue);
      g.fillRoundRect(50, 50, 100, 200, 50, 50);
          }
      }

      To reproduce the problems:
      1. compile it by java 6u2 or 6u1
      2. appletviewer QuoteAndBackslashTest.html
      3. you will see above problem.

            jgodinez Jennifer Godinez (Inactive)
            ttzhang Tao Zhang
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: