Skip to content

Commit

Permalink
Fix error in NoForkingMode.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
ViliusSutkus89 committed Jan 10, 2020
1 parent 35f2f94 commit 4837fe1
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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();
Expand Down

0 comments on commit 4837fe1

Please sign in to comment.