@Test public void openDocumentWrongPassword() throws TaskIOException, IOException { try { File tmp = IOUtils.createTemporaryBufferWithName("dumbo.pdf"); OutputStream out = new FileOutputStream(tmp); InputStream in = getClass().getClassLoader().getResourceAsStream("pdf/encrypted_AES128_user_pwd.pdf"); try { org.apache.commons.io.IOUtils.copy(in, out); } finally { org.sejda.commons.util.IOUtils.closeQuietly(out); org.sejda.commons.util.IOUtils.closeQuietly(in); } new DefaultPdfSourceOpener().open(PdfFileSource.newInstanceWithPassword(tmp, "my source")); fail("Exception expected"); } catch (TaskWrongPasswordException e) { assertEquals("Unable to open 'dumbo.pdf' due to a wrong password.", e.getMessage()); } }
@Override public PDDocumentHandler open(PdfURLSource source) throws TaskIOException { return openGeneric(source); }
DefaultPdfSourceOpener implements PdfSourceOpener<PDDocumentHandler> { @Override public PDDocumentHandler open(PdfURLSource source) throws TaskIOException { return openGeneric(source); } }
DefaultPdfSourceOpener implements PdfSourceOpener<PDDocumentHandler> { @Override public PDDocumentHandler open(PdfURLSource source) throws TaskIOException { return openGeneric(source); }  }
DefaultPdfSourceOpener implements PdfSourceOpener<PDDocumentHandler> { @Override public PDDocumentHandler open(PdfURLSource source) throws TaskIOException { return openGeneric(source); }  @Override PDDocumentHandler open(PdfURLSource source); @Override PDDocumentHandler open(PdfFileSource source); @Override PDDocumentHandler open(PdfStreamSource source); }
DefaultPdfSourceOpener implements PdfSourceOpener<PDDocumentHandler> { @Override public PDDocumentHandler open(PdfURLSource source) throws TaskIOException { return openGeneric(source); }  @Override PDDocumentHandler open(PdfURLSource source); @Override PDDocumentHandler open(PdfFileSource source); @Override PDDocumentHandler open(PdfStreamSource source);  }