Skip to content

Commit 86a41ca

Browse files
authored
fix: #2323 guard against null GPG_SECRING in uploadGpgKey (#2351)
Replace the implicit NullPointerException from String.split with an explicit IOException naming the missing environment variable, so a first-time deployment without GPG_SECRING fails with an actionable diagnostic instead of a stack trace inside String.split. Co-authored-by: edmoffo <9535571+edmoffo@users.noreply.github.com>
1 parent c30e81b commit 86a41ca

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

src/main/java/com/rultor/agents/daemons/StartsDaemon.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,11 @@ public String run(final XML xml) throws IOException {
170170
*/
171171
private void uploadGpgKey(final Shell shell) throws IOException {
172172
final String secring = System.getenv("GPG_SECRING");
173+
if (secring == null) {
174+
throw new IOException(
175+
"GPG_SECRING environment variable is not set"
176+
);
177+
}
173178
if (secring.split("\n").length < 10) {
174179
throw new IOException(
175180
String.format(

0 commit comments

Comments
 (0)