From 4837fe1057ace5286de8fb0c21edb3ac0fc93d37 Mon Sep 17 00:00:00 2001 From: Vilius Sutkus Date: Fri, 10 Jan 2020 16:21:17 +0000 Subject: [PATCH] Fix error in NoForkingMode. Previous commit threw exception if conversion is running for a second time. Exception is supposed to be thrown if conversion is running for a second time in no forking mode. --- .../com/viliussutkus89/android/pdf2htmlex/pdf2htmlEX.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/pdf2htmlEX/src/main/java/com/viliussutkus89/android/pdf2htmlex/pdf2htmlEX.java b/pdf2htmlEX/src/main/java/com/viliussutkus89/android/pdf2htmlex/pdf2htmlEX.java index 9a0bfe3a..bc06135e 100644 --- a/pdf2htmlEX/src/main/java/com/viliussutkus89/android/pdf2htmlex/pdf2htmlEX.java +++ b/pdf2htmlEX/src/main/java/com/viliussutkus89/android/pdf2htmlex/pdf2htmlEX.java @@ -43,6 +43,7 @@ public final class pdf2htmlEX { private String p_ownerPassword = ""; private String p_userPassword = ""; + private boolean m_isNoForking = false; private boolean m_noForkingConversionAlreadyDone = false; public static class ConversionFailedException extends Exception { @@ -112,10 +113,11 @@ public pdf2htmlEX setUserPassword(@NonNull String userPassword) { return this; } - public pdf2htmlEX setNoForking(@NonNull boolean iDoUnderstandThatIWillHaveToRestartTheAppBeforeICanRunConversionForTheSecondTime) throws IllegalArgumentException { + public pdf2htmlEX setNoForking(boolean iDoUnderstandThatIWillHaveToRestartTheAppBeforeICanRunConversionForTheSecondTime) throws IllegalArgumentException { if (!iDoUnderstandThatIWillHaveToRestartTheAppBeforeICanRunConversionForTheSecondTime) { throw new IllegalArgumentException(); } + this.m_isNoForking = true; setNoForking(); return this; } @@ -149,7 +151,9 @@ public File convert() throws IOException, ConversionFailedException { this.p_ownerPassword, this.p_userPassword ); - this.m_noForkingConversionAlreadyDone = true; + if (this.m_isNoForking) { + this.m_noForkingConversionAlreadyDone = true; + } if (0 != retVal) { outputHtml.delete();