if (reader.isOpenedWithFullPermission()) { permissions.setOwnerPassword(password); permissions.setUserPassword(reader.computeUserPassword()); } else { JOptionPane.showMessageDialog(null, "You opened the document using the user password instead of the owner password.");