harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From apavle...@apache.org
Subject svn commit: r595272 - /harmony/enhanced/classlib/trunk/modules/print/src/main/java/windows/org/apache/harmony/x/print/WinPrintJob.java
Date Thu, 15 Nov 2007 11:33:22 GMT
Author: apavlenko
Date: Thu Nov 15 03:33:17 2007
New Revision: 595272

URL: http://svn.apache.org/viewvc?rev=595272&view=rev
Log:
Modified WinPrintJob to perform printing from the calling thread to follow RI's behaviour.

Modified:
    harmony/enhanced/classlib/trunk/modules/print/src/main/java/windows/org/apache/harmony/x/print/WinPrintJob.java

Modified: harmony/enhanced/classlib/trunk/modules/print/src/main/java/windows/org/apache/harmony/x/print/WinPrintJob.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/print/src/main/java/windows/org/apache/harmony/x/print/WinPrintJob.java?rev=595272&r1=595271&r2=595272&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/print/src/main/java/windows/org/apache/harmony/x/print/WinPrintJob.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/print/src/main/java/windows/org/apache/harmony/x/print/WinPrintJob.java
Thu Nov 15 03:33:17 2007
@@ -139,7 +139,7 @@
                 }
 
                 printer = new Printer(doc, attributes);
-                printer.start();
+                printer.print();
             }
         }
     }
@@ -221,12 +221,20 @@
         int                            jobId;
 
         Printer(final Doc doc, final PrintRequestAttributeSet attributes) {
-            super(WinPrintService.DEFAULT_JOB_NAME.getName());
+            super(WinPrintService.DEFAULT_JOB_NAME.getValue());
             this.doc = doc;
             this.attributes = attributes;
         }
-
+        
         public void run() {
+            try {
+                print();
+            } catch (final PrintException ex) {
+                throw new RuntimeException(ex);
+            }
+        }
+
+        public void print() throws PrintException {
             final DocFlavor flavor = doc.getDocFlavor();
             final DevmodeStructWrapper dm = service.getPrinterProps();
 
@@ -260,11 +268,13 @@
 
                 notifyJobListeners(PrintJobEvent.DATA_TRANSFER_COMPLETE);
                 notifyJobListeners(PrintJobEvent.JOB_COMPLETE);
+            } catch (final PrintException ex) {
+                throw ex;
             } catch (final Exception ex) {
                 synchronized (this) {
                     if (jobId != -1) {
                         notifyJobListeners(PrintJobEvent.JOB_FAILED);
-                        throw new RuntimeException(ex);
+                        throw new PrintException(ex);
                     }
                 }
             } finally {



Mime
View raw message