Skip to content

Commit

Permalink
IndexRebuild task: don't use passphrase if envVar or CmdLine is an em…
Browse files Browse the repository at this point in the history
…pty string
  • Loading branch information
gquerret committed Feb 1, 2023
1 parent 59607ad commit 9cb96f9
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/java/com/phenix/pct/PCTIndexRebuild.java
Original file line number Diff line number Diff line change
Expand Up @@ -163,9 +163,9 @@ private ExecTask idxBuildCmdLine() {
exec.createArg().setValue(cpInternal);
}

if ((passphraseEnvVar != null) || (passphraseCmdLine != null)) {
if (hasCmdLinePassphrase() || hasEnvPassphrase()) {
exec.createArg().setValue("-Passphrase");
if (passphraseEnvVar != null) {
if (hasEnvPassphrase()) {
exec.setInputString(System.getenv(passphraseEnvVar) + System.lineSeparator() + generateInputString());
} else {
exec.setInputString(getPassphraseFromCmdLine(passphraseCmdLine) + System.lineSeparator() + generateInputString());
Expand All @@ -182,4 +182,12 @@ private ExecTask idxBuildCmdLine() {
return exec;
}

private boolean hasCmdLinePassphrase() {
return (passphraseCmdLine != null) && !passphraseCmdLine.trim().isEmpty();
}

private boolean hasEnvPassphrase() {
return (passphraseEnvVar != null) && !passphraseEnvVar.trim().isEmpty();
}

}

0 comments on commit 9cb96f9

Please sign in to comment.