pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From til...@apache.org
Subject svn commit: r1801500 - /pdfbox/branches/2.0/debugger/src/main/java/org/apache/pdfbox/debugger/PDFDebugger.java
Date Mon, 10 Jul 2017 17:06:16 GMT
Author: tilman
Date: Mon Jul 10 17:06:16 2017
New Revision: 1801500

URL: http://svn.apache.org/viewvc?rev=1801500&view=rev
Log:
PDFBOX-3863: sonar fix

Modified:
    pdfbox/branches/2.0/debugger/src/main/java/org/apache/pdfbox/debugger/PDFDebugger.java

Modified: pdfbox/branches/2.0/debugger/src/main/java/org/apache/pdfbox/debugger/PDFDebugger.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/2.0/debugger/src/main/java/org/apache/pdfbox/debugger/PDFDebugger.java?rev=1801500&r1=1801499&r2=1801500&view=diff
==============================================================================
--- pdfbox/branches/2.0/debugger/src/main/java/org/apache/pdfbox/debugger/PDFDebugger.java
(original)
+++ pdfbox/branches/2.0/debugger/src/main/java/org/apache/pdfbox/debugger/PDFDebugger.java
Mon Jul 10 17:06:16 2017
@@ -1087,40 +1087,42 @@ public class PDFDebugger extends JFrame
 
     private void printMenuItemActionPerformed(ActionEvent evt)
     {
-        if( document != null )
+        if (document == null)
         {
-            try
+            return;
+        }
+
+        try
+        {
+            PrinterJob job = PrinterJob.getPrinterJob();
+            job.setPageable(new PDFPageable(document));
+            PrintRequestAttributeSet pras = new HashPrintRequestAttributeSet();
+            PDViewerPreferences vp = document.getDocumentCatalog().getViewerPreferences();
+            if (vp != null && vp.getDuplex() != null)
             {
-                PrinterJob job = PrinterJob.getPrinterJob();
-                job.setPageable(new PDFPageable(document));
-                PrintRequestAttributeSet pras = new HashPrintRequestAttributeSet();
-                PDViewerPreferences vp = document.getDocumentCatalog().getViewerPreferences();
-                if (vp != null && vp.getDuplex() != null)
+                String dp = vp.getDuplex();
+                if (PDViewerPreferences.DUPLEX.DuplexFlipLongEdge.toString().equals(dp))
                 {
-                    String dp = vp.getDuplex();
-                    if (PDViewerPreferences.DUPLEX.DuplexFlipLongEdge.toString().equals(dp))
-                    {
-                        pras.add(Sides.TWO_SIDED_LONG_EDGE);
-                    }
-                    else if (PDViewerPreferences.DUPLEX.DuplexFlipShortEdge.toString().equals(dp))
-                    {
-                        pras.add(Sides.TWO_SIDED_SHORT_EDGE);
-                    }
-                    else if (PDViewerPreferences.DUPLEX.Simplex.toString().equals(dp))
-                    {
-                        pras.add(Sides.ONE_SIDED);
-                    }                    
+                    pras.add(Sides.TWO_SIDED_LONG_EDGE);
                 }
-                if (job.printDialog(pras))
+                else if (PDViewerPreferences.DUPLEX.DuplexFlipShortEdge.toString().equals(dp))
                 {
-                    job.print(pras);
+                    pras.add(Sides.TWO_SIDED_SHORT_EDGE);
+                }
+                else if (PDViewerPreferences.DUPLEX.Simplex.toString().equals(dp))
+                {
+                    pras.add(Sides.ONE_SIDED);
                 }
             }
-            catch (PrinterException e)
+            if (job.printDialog(pras))
             {
-                throw new RuntimeException(e);
+                job.print(pras);
             }
         }
+        catch (PrinterException e)
+        {
+            throw new RuntimeException(e);
+        }
     }
     
     /**



Mime
View raw message