diff --git a/core/core-awt/src/main/java/org/icepdf/core/exceptions/PdfSecurityException.java b/core/core-awt/src/main/java/org/icepdf/core/exceptions/PDFSecurityException.java similarity index 90% rename from core/core-awt/src/main/java/org/icepdf/core/exceptions/PdfSecurityException.java rename to core/core-awt/src/main/java/org/icepdf/core/exceptions/PDFSecurityException.java index c16802add..f46045c49 100644 --- a/core/core-awt/src/main/java/org/icepdf/core/exceptions/PdfSecurityException.java +++ b/core/core-awt/src/main/java/org/icepdf/core/exceptions/PDFSecurityException.java @@ -21,13 +21,13 @@ * @since 1.0 */ @SuppressWarnings("serial") -public class PdfSecurityException extends Exception { +public class PDFSecurityException extends Exception { /** * Constructs an instance of PDFException with the specified detail message. * * @param msg the detail message */ - public PdfSecurityException(String msg) { + public PDFSecurityException(String msg) { super(msg); } } diff --git a/core/core-awt/src/main/java/org/icepdf/core/pobjects/Document.java b/core/core-awt/src/main/java/org/icepdf/core/pobjects/Document.java index 29d670e85..98ebec81f 100644 --- a/core/core-awt/src/main/java/org/icepdf/core/pobjects/Document.java +++ b/core/core-awt/src/main/java/org/icepdf/core/pobjects/Document.java @@ -17,7 +17,7 @@ import org.icepdf.core.SecurityCallback; import org.icepdf.core.application.ProductInfo; -import org.icepdf.core.exceptions.PdfSecurityException; +import org.icepdf.core.exceptions.PDFSecurityException; import org.icepdf.core.pobjects.acroform.FieldDictionary; import org.icepdf.core.pobjects.acroform.InteractiveForm; import org.icepdf.core.pobjects.annotations.AbstractWidgetAnnotation; @@ -181,12 +181,12 @@ private String getDocumentCachedFilePath() { * Load a PDF file from the given path and initiates the document's Catalog. * * @param filepath path of PDF document. - * @throws PdfSecurityException if a security provider cannot be found + * @throws PDFSecurityException if a security provider cannot be found * or there is an error decrypting the file. * @throws IOException if a problem setting up, or parsing the file. */ public void setFile(String filepath) - throws PdfSecurityException, IOException { + throws PDFSecurityException, IOException { setDocumentOrigin(filepath); File file = new File(filepath); @@ -208,12 +208,12 @@ public void setFile(String filepath) * be stored in memory. * * @param url location of file. - * @throws PdfSecurityException if a security provider can not be found + * @throws PDFSecurityException if a security provider can not be found * or there is an error decrypting the file. * @throws IOException if a problem downloading, setting up, or parsing the file. */ public void setUrl(URL url) - throws PdfSecurityException, IOException { + throws PDFSecurityException, IOException { InputStream in = null; try { // make a connection @@ -240,12 +240,12 @@ public void setUrl(URL url) * * @param inputStream input stream containing PDF data * @param pathOrURL value assigned to document origin - * @throws PdfSecurityException if a security provider can not be found + * @throws PDFSecurityException if a security provider can not be found * or there is an error decrypting the file. * @throws IOException if a problem setting up, or parsing the SeekableInput. */ public void setInputStream(InputStream inputStream, String pathOrURL) - throws PdfSecurityException, IOException { + throws PDFSecurityException, IOException { setDocumentOrigin(pathOrURL); if (!isCachingEnabled) { @@ -290,12 +290,12 @@ public void setInputStream(InputStream inputStream, String pathOrURL) * @param offset the index into the byte array where the PDF data begins * @param length the number of bytes in the byte array belonging to the PDF data * @param pathOrURL value assigned to document origin - * @throws PdfSecurityException if a security provider can not be found + * @throws PDFSecurityException if a security provider can not be found * or there is an error decrypting the file. * @throws IOException if a problem setting up, or parsing the SeekableInput. */ public void setByteArray(byte[] data, int offset, int length, String pathOrURL) - throws PdfSecurityException, IOException { // security, state, io? + throws PDFSecurityException, IOException { // security, state, io? setDocumentOrigin(pathOrURL); if (!isCachingEnabled) { @@ -336,11 +336,11 @@ public void setByteArray(byte[] data, int offset, int length, String pathOrURL) * Sets the input stream of the PDF file to be rendered. * * @param input ByteBuffer containing PDF data stream - * @throws PdfSecurityException security error + * @throws PDFSecurityException security error * @throws IOException io error during stream handling */ private void setInputStream(ByteBuffer input) - throws PdfSecurityException, IOException, IllegalStateException { + throws PDFSecurityException, IOException, IllegalStateException { try { // load the head header = new Header(); @@ -394,7 +394,7 @@ private void setInputStream(ByteBuffer input) // create new instance of state manager and add it to the library stateManager = new StateManager(crossReferenceRoot); library.setStateManager(stateManager); - } catch (PdfSecurityException | IOException e) { + } catch (PDFSecurityException | IOException e) { dispose(); logger.log(Level.SEVERE, "Failed to load PDF Document.", e); throw e; diff --git a/core/core-awt/src/main/java/org/icepdf/core/pobjects/security/SecurityManager.java b/core/core-awt/src/main/java/org/icepdf/core/pobjects/security/SecurityManager.java index cb601cd02..4ce3ec31d 100644 --- a/core/core-awt/src/main/java/org/icepdf/core/pobjects/security/SecurityManager.java +++ b/core/core-awt/src/main/java/org/icepdf/core/pobjects/security/SecurityManager.java @@ -15,7 +15,7 @@ */ package org.icepdf.core.pobjects.security; -import org.icepdf.core.exceptions.PdfSecurityException; +import org.icepdf.core.exceptions.PDFSecurityException; import org.icepdf.core.pobjects.DictionaryEntries; import org.icepdf.core.pobjects.Reference; import org.icepdf.core.util.Defs; @@ -120,17 +120,17 @@ public void dispose() { * @param library library of documents PDF objects * @param encryptionDictionary encryption dictionary key values * @param fileID fileID of PDF document - * @throws PdfSecurityException if the security provider could not be found + * @throws PDFSecurityException if the security provider could not be found */ public SecurityManager(Library library, DictionaryEntries encryptionDictionary, List fileID) - throws PdfSecurityException { + throws PDFSecurityException { // Check to make sure that if run under JDK 1.3 that the JCE libraries // are installed as extra packages if (!foundJCE) { logger.log(Level.SEVERE, "Sun JCE support was not found on classpath"); - throw new PdfSecurityException("Sun JCE Support Not Found"); + throw new PDFSecurityException("Sun JCE Support Not Found"); } // create dictionary for document @@ -144,7 +144,7 @@ public SecurityManager(Library library, DictionaryEntries encryptionDictionary, // initiate the handler securityHandler.init(); } else { - throw new PdfSecurityException("Security Provider Not Found."); + throw new PDFSecurityException("Security Provider Not Found."); } } diff --git a/core/core-awt/src/main/java/org/icepdf/core/util/Library.java b/core/core-awt/src/main/java/org/icepdf/core/util/Library.java index 9d1b81549..2c4a08462 100644 --- a/core/core-awt/src/main/java/org/icepdf/core/util/Library.java +++ b/core/core-awt/src/main/java/org/icepdf/core/util/Library.java @@ -17,7 +17,7 @@ package org.icepdf.core.util; import org.icepdf.core.SecurityCallback; -import org.icepdf.core.exceptions.PdfSecurityException; +import org.icepdf.core.exceptions.PDFSecurityException; import org.icepdf.core.pobjects.*; import org.icepdf.core.pobjects.acroform.InteractiveForm; import org.icepdf.core.pobjects.acroform.SignatureHandler; @@ -216,9 +216,9 @@ public CrossReferenceRoot getCrossReferenceRoot() { * * @param documentTrailer document trailer * @return true if created, false otherwise - * @throws PdfSecurityException if there is an issue finding encryption libraries. + * @throws PDFSecurityException if there is an issue finding encryption libraries. */ - public boolean makeSecurityManager(PTrailer documentTrailer) throws PdfSecurityException { + public boolean makeSecurityManager(PTrailer documentTrailer) throws PDFSecurityException { /* Before a security manager can be created or needs to be created we need the following @@ -270,9 +270,9 @@ public boolean configurePermissions() { * following method is used with the SecurityCallback to prompt a user for * a password if needed. * - * @throws PdfSecurityException error during authorization manager setup + * @throws PDFSecurityException error during authorization manager setup */ - public void attemptAuthorizeSecurityManager(Document document, SecurityCallback securityCallback) throws PdfSecurityException { + public void attemptAuthorizeSecurityManager(Document document, SecurityCallback securityCallback) throws PDFSecurityException { // check if pdf is password protected, by passing in black // password if (!securityManager.isAuthorized("")) { @@ -289,10 +289,10 @@ public void attemptAuthorizeSecurityManager(Document document, SecurityCallback if (securityCallback != null) { password = securityCallback.requestPassword(document); if (password == null) { - throw new PdfSecurityException("Encryption error"); + throw new PDFSecurityException("Encryption error"); } } else { - throw new PdfSecurityException("Encryption error"); + throw new PDFSecurityException("Encryption error"); } // Verify new password, proceed if authorized, @@ -303,7 +303,7 @@ public void attemptAuthorizeSecurityManager(Document document, SecurityCallback count++; // after 3 tries throw an error. if (count > 3) { - throw new PdfSecurityException("Encryption error"); + throw new PDFSecurityException("Encryption error"); } } } diff --git a/examples/capture/png/src/main/java/org/icepdf/examples/capture/PageCapture.java b/examples/capture/png/src/main/java/org/icepdf/examples/capture/PageCapture.java index 840ede1d0..8f6c4fabe 100644 --- a/examples/capture/png/src/main/java/org/icepdf/examples/capture/PageCapture.java +++ b/examples/capture/png/src/main/java/org/icepdf/examples/capture/PageCapture.java @@ -15,7 +15,7 @@ */ -import org.icepdf.core.exceptions.PdfSecurityException; +import org.icepdf.core.exceptions.PDFSecurityException; import org.icepdf.core.pobjects.Document; import org.icepdf.core.pobjects.PDimension; import org.icepdf.core.pobjects.Page; @@ -78,7 +78,7 @@ public void capturePages(String filePath) { System.out.println("Error parsing PDF document " + e); } catch (ExecutionException e) { System.out.println("Error parsing PDF document " + e); - } catch (PdfSecurityException ex) { + } catch (PDFSecurityException ex) { System.out.println("Error encryption not supported " + ex); } catch (FileNotFoundException ex) { System.out.println("Error file not found " + ex); diff --git a/examples/extraction/barcode/src/main/java/org/icepdf/examples/extraction/BarcodeReader.java b/examples/extraction/barcode/src/main/java/org/icepdf/examples/extraction/BarcodeReader.java index 87b745762..029f1e8a4 100644 --- a/examples/extraction/barcode/src/main/java/org/icepdf/examples/extraction/BarcodeReader.java +++ b/examples/extraction/barcode/src/main/java/org/icepdf/examples/extraction/BarcodeReader.java @@ -20,7 +20,7 @@ import com.google.zxing.common.HybridBinarizer; import com.google.zxing.multi.GenericMultipleBarcodeReader; import com.google.zxing.multi.MultipleBarcodeReader; -import org.icepdf.core.exceptions.PdfSecurityException; +import org.icepdf.core.exceptions.PDFSecurityException; import org.icepdf.core.pobjects.Document; import org.icepdf.core.pobjects.Page; import org.icepdf.core.util.GraphicsRenderingHints; @@ -88,7 +88,7 @@ public static void main(String[] args) { } } - public void findBarcodes(String filePath) throws IOException, PdfSecurityException, + public void findBarcodes(String filePath) throws IOException, PDFSecurityException, InterruptedException, NotFoundException { // open the document. diff --git a/examples/extraction/barcode/src/main/java/org/icepdf/examples/extraction/BarcodeStamper.java b/examples/extraction/barcode/src/main/java/org/icepdf/examples/extraction/BarcodeStamper.java index ffa19f6fe..4da78bddf 100644 --- a/examples/extraction/barcode/src/main/java/org/icepdf/examples/extraction/BarcodeStamper.java +++ b/examples/extraction/barcode/src/main/java/org/icepdf/examples/extraction/BarcodeStamper.java @@ -20,7 +20,7 @@ import com.google.zxing.common.HybridBinarizer; import com.google.zxing.multi.GenericMultipleBarcodeReader; import com.google.zxing.multi.MultipleBarcodeReader; -import org.icepdf.core.exceptions.PdfSecurityException; +import org.icepdf.core.exceptions.PDFSecurityException; import org.icepdf.core.pobjects.Document; import org.icepdf.core.pobjects.Page; import org.icepdf.core.util.GraphicsRenderingHints; @@ -96,7 +96,7 @@ public static void main(String[] args) { } } - public void findBarcodes(String filePath) throws IOException, PdfSecurityException, + public void findBarcodes(String filePath) throws IOException, PDFSecurityException, InterruptedException, NotFoundException { // open the document. diff --git a/examples/pom.xml b/examples/pom.xml index 48f539c6b..0da9e90dc 100644 --- a/examples/pom.xml +++ b/examples/pom.xml @@ -4,7 +4,7 @@ com.github.pcorless.icepdf icepdf - 7.0.0 + 7.1.0-SNAPSHOT org.icepdf.examples examples diff --git a/examples/printservices/src/main/java/org/icepdf/examples/print/PrintServices.java b/examples/printservices/src/main/java/org/icepdf/examples/print/PrintServices.java index 901192ae3..565cba7ea 100644 --- a/examples/printservices/src/main/java/org/icepdf/examples/print/PrintServices.java +++ b/examples/printservices/src/main/java/org/icepdf/examples/print/PrintServices.java @@ -14,7 +14,7 @@ * governing permissions and limitations under the License. */ -import org.icepdf.core.exceptions.PdfSecurityException; +import org.icepdf.core.exceptions.PDFSecurityException; import org.icepdf.core.pobjects.Document; import org.icepdf.core.util.Defs; import org.icepdf.ri.common.print.PrintHelper; @@ -181,7 +181,7 @@ public static void main(String[] args) { logger.log(Level.WARNING, "PDF file not found.", e); } catch (IOException e) { logger.log(Level.WARNING, "Error loading PDF file", e); - } catch (PdfSecurityException e) { + } catch (PDFSecurityException e) { logger.log(Level.WARNING, "PDF security exception, unspported encryption type.", e); } catch (PrintException e) { diff --git a/viewer/viewer-awt/src/main/java/org/icepdf/ri/common/SwingController.java b/viewer/viewer-awt/src/main/java/org/icepdf/ri/common/SwingController.java index 72352ecab..7d5e614bd 100644 --- a/viewer/viewer-awt/src/main/java/org/icepdf/ri/common/SwingController.java +++ b/viewer/viewer-awt/src/main/java/org/icepdf/ri/common/SwingController.java @@ -16,7 +16,7 @@ package org.icepdf.ri.common; import org.icepdf.core.SecurityCallback; -import org.icepdf.core.exceptions.PdfSecurityException; +import org.icepdf.core.exceptions.PDFSecurityException; import org.icepdf.core.io.SizeInputStream; import org.icepdf.core.pobjects.*; import org.icepdf.core.pobjects.actions.Action; @@ -2469,10 +2469,10 @@ protected void refreshRecentFileMenuItem() { * * @param document document to set securityCallback on . * @param securityCallback security callback for prompting users or owner passwords. - * @throws PdfSecurityException security exception likely incorrect user or owner password. + * @throws PDFSecurityException security exception likely incorrect user or owner password. */ protected void setupSecurityHandler(Document document, SecurityCallback securityCallback) throws - PdfSecurityException { + PDFSecurityException { // create default security callback is user has not created one if (securityCallback == null) { document.setSecurityCallback( @@ -2531,7 +2531,7 @@ public void openDocument(String pathname) { setupSecurityHandler(document, documentViewController.getSecurityCallback()); document.setFile(pathname); commonNewDocumentHandling(pathname); - } catch (PdfSecurityException e) { + } catch (PDFSecurityException e) { org.icepdf.ri.util.Resources.showMessageDialog( viewer, JOptionPane.INFORMATION_MESSAGE, @@ -2683,7 +2683,7 @@ protected void done() { } closeDocument(); document = null; - } catch (PdfSecurityException e) { + } catch (PDFSecurityException e) { org.icepdf.ri.util.Resources.showMessageDialog( viewer, JOptionPane.INFORMATION_MESSAGE, @@ -2771,7 +2771,7 @@ public void openDocument(InputStream inputStream, String description, String pat document.setInputStream(inputStream, pathOrURL); commonNewDocumentHandling(description); - } catch (PdfSecurityException e) { + } catch (PDFSecurityException e) { org.icepdf.ri.util.Resources.showMessageDialog( viewer, JOptionPane.INFORMATION_MESSAGE, @@ -2863,7 +2863,7 @@ public void openDocument(byte[] data, int offset, int length, String description document.setByteArray(data, offset, length, pathOrURL); commonNewDocumentHandling(description); - } catch (PdfSecurityException e) { + } catch (PDFSecurityException e) { org.icepdf.ri.util.Resources.showMessageDialog( viewer, JOptionPane.INFORMATION_MESSAGE, diff --git a/viewer/viewer-awt/src/main/java/org/icepdf/ri/common/utility/attachment/AttachmentPanel.java b/viewer/viewer-awt/src/main/java/org/icepdf/ri/common/utility/attachment/AttachmentPanel.java index 8b2016d5d..12c1c62af 100644 --- a/viewer/viewer-awt/src/main/java/org/icepdf/ri/common/utility/attachment/AttachmentPanel.java +++ b/viewer/viewer-awt/src/main/java/org/icepdf/ri/common/utility/attachment/AttachmentPanel.java @@ -1,6 +1,6 @@ package org.icepdf.ri.common.utility.attachment; -import org.icepdf.core.exceptions.PdfSecurityException; +import org.icepdf.core.exceptions.PDFSecurityException; import org.icepdf.core.pobjects.*; import org.icepdf.core.util.Library; import org.icepdf.core.util.Utils; @@ -193,7 +193,7 @@ public void mouseClicked(MouseEvent mouseEvent) { WindowManager.getInstance().newWindow(embeddedDocument, fileName); } catch (IOException e) { logger.log(Level.WARNING, "Error opening PDF file stream " + fileName, e); - } catch( PdfSecurityException e) { + } catch( PDFSecurityException e) { logger.log(Level.WARNING, "Error opening PDF security exception " + fileName, e); } } diff --git a/viewer/viewer-awt/src/main/java/org/icepdf/ri/util/qa/PageCapture.java b/viewer/viewer-awt/src/main/java/org/icepdf/ri/util/qa/PageCapture.java index 5fa7dab9c..c1b0348c3 100644 --- a/viewer/viewer-awt/src/main/java/org/icepdf/ri/util/qa/PageCapture.java +++ b/viewer/viewer-awt/src/main/java/org/icepdf/ri/util/qa/PageCapture.java @@ -15,7 +15,7 @@ */ package org.icepdf.ri.util.qa; -import org.icepdf.core.exceptions.PdfSecurityException; +import org.icepdf.core.exceptions.PDFSecurityException; import org.icepdf.core.pobjects.Document; import org.icepdf.ri.util.FontPropertiesManager; @@ -37,7 +37,7 @@ public int load(Path filePath) { document = new Document(); document.setFile(filePath.toAbsolutePath().toString()); return document.getNumberOfPages(); - } catch (PdfSecurityException | IOException e) { + } catch (PDFSecurityException | IOException e) { e.printStackTrace(); } return 0;