Java Solaris Communities Sun Store Join SDN My Profile Why Join?
 
Bug Database
Bug Detail
Quick Lists
Top 25 Bugs
Top 25 RFE's
Recently Closed Bugs
Printable Page Printable Page


Bug Database
Bug ID: 4293262
Votes 0
Synopsis printing works fine on NT but gives a JVM.dll error on W98
Category java:classes_2d
Reported Against 1.2.2
Release Fixed
State 11-Closed, duplicate of 4274071, bug
Priority: 4-Low
Related Bugs 4274071
Submit Date 22-NOV-1999
Description

java version "1.2.2"
Classic VM (build JDK-1.2.2-W, native threads, symcjit)

printing a concept map (consists of nodes and links)works fine in NT4.0 machine
but give a "caused an exception IOH on module JVM.DLL at 0177:504dcbf6" error.

code call printing:
 public void run() {
         MapView view=(MapView)getDesktop().getMapView ();//MapView:view is the
//printable
         PageFormat pf=new PageFormat();
         PrinterJob pj=PrinterJob.getPrinterJob();
         pj.setPrintable(view,pf);
        if( pj.printDialog()){
                Cursor cursor = view.getCursor();
                try{
                   view.getController().stopBlinkingTextCursor();
                   view.setDoubleBuffering(false);
view.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
                   view.getToolkit().sync();
                   pj.print();
                  }catch (Exception PrintException) {
                          ServerSingleton.log(PrintException);
                  } finally{
                      //Get rid of the print Job Object.
                        if (pj != null)
                            pj=null;
                        view.setCursor(cursor);
                        view.getToolkit().sync();
                        view.setDoubleBuffering(true);
                        view.getController().resumeBlinkingTextCursor();
                  }
        }
   }

print method in MapView:
public int print(Graphics g, PageFormat pf, int pageIndex) throws
PrinterException {
         //find the area that actually has the objects.
          if(m_mapBounds==null){
               m_mapBounds = getMinBoundingRect();
          }
          //get the label that should be the title of this page
          if(m_pageLabel==null){
               getPageLabel();
          }
           Graphics2D g2 = (Graphics2D) g;
            g2.setColor(Color.black);
          //get footer height
           	int fontHeight=g2.getFontMetrics().getHeight();
          //	int fontDesent=g2.getFontMetrics().getDescent();


           //calculate the total num of pages
              //the paper size
           double height=pf.getImageableHeight()-fontHeight;
           double width=pf.getImageableWidth()+60;
              //the columns
              int nw=(int)Math.ceil(m_mapBounds.width/width);
              //the rows
              int ny=(int)Math.ceil((m_mapBounds.height)/height);
           int totalPages=nw*ny;

           //start to render the pages
           if(pageIndex>=totalPages) {
                      return NO_SUCH_PAGE;
          	}

        //	 g2.translate(pf.getImageableX(),pf.getImageableY());

          //this section'postiton, index from 0
               int rowIndex=(int)Math.floor(pageIndex/nw);
               int colIndex= pageIndex-nw*(rowIndex);
           //draw footer
           String footer=m_pageLabel+": page "+ (rowIndex+1)+"-"+(colIndex+1);
     	     g2.drawString(footer,
                      (int)width/2-g2.getFontMetrics().stringWidth(footer)/2,
                      (int)(height+fontHeight)+15);//bottom center


           //draw the map area
              //clip a section from map
               //set the beginning position
                g2.translate(-m_mapBounds.x,-(m_mapBounds.y));
                g2.translate(-colIndex*width,-rowIndex*height);
               //clip the section
                 int sx=(int)Math.ceil(m_mapBounds.x+colIndex*width);
                 int sy=(int)Math.ceil(m_mapBounds.y+height*rowIndex);
                 int rx=(int)Math.ceil(width);
                 int ry=(int)Math.ceil(height);
                 g2.setClip (sx,sy,rx,ry);

                 paint (g2);
           return Printable.PAGE_EXISTS;

   }
the paint method will cause all the components (nodes and links on the map
(inside the clip error)to paint)
(Review ID: 97234) 
======================================================================


Subject: RE: java bug 4293262 - printing 
Date: Tue, 23 Nov 1999 14:17:50 -0700

1) My Printable is quite big so I am afraid that I cannot provide you
with a complete runnable code.
2) I have traced the bug to the statement "g2.drawString(..)". (inorder
to draw the page title). Without this statement, the printing method
works fine on both NT and win9x. (somehow, adding a component with label
can be the work arround to this problem, but not all components works).
3) The printer is a HPLaserJet 4000N and the driver is HP LaserJet 4000
Series PCL6.
4) The 1.3 beta works the same way as 1.2.2.

 xxxxx@xxxxx  1999-11-23
======================================================================
Work Around
N/A
Evaluation
The information provided in the description points to a problem described
in bugs 4289503, 4248233, 4242594 with the way that the common dialogs were
loaded (note these are loaded even if not made visible in the application).
I have an HP 5000 which used to cause crashes all the time under win9x.
This has stopped happening since the underlying problem was fixed as bug
4274071
Comments
  
  Include a link with my name & email   

Submitted On 17-AUG-2000
DeepaK
I got a simliar error. I thought the problem was related to the Windows 95 but it worked on some Windows 95 PCs 
and not on the others. I got similar results from Windows 98 and Windows NT.  The problem was that I hadn't set 
up the printer properties correctly on some of the pcs. It was solved when I captured printer port and printed to it. 

Follow the steps below:
Start->settings-> printers->
Select your printer . Go to properties->Details
Click on 'Capture Printer Port' button. Set the port to LPT1. If it is already in use some other port. Set path to the 
path to your printer. Go to the 'Print to' selection box and choose the port that you just captured.



PLEASE NOTE: JDK6 is formerly known as Project Mustang