From 0e452e2f714db314e0307895987ed30c440a32c8 Mon Sep 17 00:00:00 2001 From: davidplunkett Date: Thu, 28 Feb 2019 05:51:42 +0000 Subject: [PATCH] fix null string handling and typos Change-Id: I6dff7fcb38a8352b9a70ef246d7943ea69297486 Signed-off-by: davidplunkett --- .../DeployPostVerficationRemoteScriptExecutor.java | 10 +++++----- .../DeployRemoteDeploymentVerificationDelegate.java | 16 ++++++++-------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/akraino/src/main/java/com/akraino/bpm/delegate/DeployPostVerficationRemoteScriptExecutor.java b/akraino/src/main/java/com/akraino/bpm/delegate/DeployPostVerficationRemoteScriptExecutor.java index ac0e438..0faac5b 100644 --- a/akraino/src/main/java/com/akraino/bpm/delegate/DeployPostVerficationRemoteScriptExecutor.java +++ b/akraino/src/main/java/com/akraino/bpm/delegate/DeployPostVerficationRemoteScriptExecutor.java @@ -43,7 +43,7 @@ public class DeployPostVerficationRemoteScriptExecutor implements JavaDelegate { try { String remoteserver =(String) ctx.getVariable("remotserver"); - int portnumner =(Integer)ctx.getVariable("port"); + int portnumber =(Integer)ctx.getVariable("port"); String username =(String) ctx.getVariable("username"); String password =(String) ctx.getVariable("password"); String filename =(String) ctx.getVariable("postverificationscript"); @@ -54,13 +54,13 @@ public class DeployPostVerficationRemoteScriptExecutor implements JavaDelegate { String blueprint =(String) ctx.getVariable("blueprint"); deployResponseSenderService.sendResponse(new BuildResponse("completed", "completed", "completed", "completed","inprogress",sitename,null,null,null)); - logger.debug("task execution started blueprint {}, remoteserver {}, portnumner {}, username {}, password {}, filename {}, fileparams {}, src dir={}, dest dir={}", - blueprint,remoteserver,portnumner,username,password,filename,fileparams,srcdir,destdir); + logger.debug("task execution started blueprint {}, remoteserver {}, portnumber {}, username {}, password {}, filename {}, fileparams {}, src dir={}, dest dir={}", + blueprint, remoteserver, portnumber, username, password, filename, fileparams, srcdir, destdir); String command = String.format("/bin/bash %s/%s %s", destdir, filename, (fileparams!=null?fileparams.replaceAll(",", " "):"")); - if ( !filename.equals("null") || !filename.equals("") ) { + if ( filename != null && !filename.equals("null") && !filename.isEmpty() ) { logger.debug("Execution command {}",command); - remoteScriptExecutionService.executeRemoteScript(remoteserver,username,password,portnumner,filename,fileparams,srcdir,destdir,command); + remoteScriptExecutionService.executeRemoteScript(remoteserver,username,password,portnumber,filename,fileparams,srcdir,destdir,command); } else { logger.debug("Skipping invalid verification command: {}", command); } diff --git a/akraino/src/main/java/com/akraino/bpm/delegate/DeployRemoteDeploymentVerificationDelegate.java b/akraino/src/main/java/com/akraino/bpm/delegate/DeployRemoteDeploymentVerificationDelegate.java index 6d40629..971a670 100644 --- a/akraino/src/main/java/com/akraino/bpm/delegate/DeployRemoteDeploymentVerificationDelegate.java +++ b/akraino/src/main/java/com/akraino/bpm/delegate/DeployRemoteDeploymentVerificationDelegate.java @@ -43,27 +43,27 @@ public class DeployRemoteDeploymentVerificationDelegate implements JavaDelegate try { String remoteserver =(String) ctx.getVariable("remotserver"); - int portnumner =(Integer)ctx.getVariable("port"); + int portnumber =(Integer)ctx.getVariable("port"); String username =(String) ctx.getVariable("username"); String password =(String) ctx.getVariable("password"); - String filename =(String) ctx.getVariable("verifier"); - String fileparams =(String) ctx.getVariable("verifierfileparams"); + String filename =(String) ctx.getVariable("deploymentverifier"); + String fileparams =(String) ctx.getVariable("deploymentverifierfileparams"); String srcdir =(String) ctx.getVariable("srcdir"); String destdir =(String) ctx.getVariable("destdir"); String sitename =(String) ctx.getVariable("sitename"); String blueprint =(String) ctx.getVariable("blueprint"); int waittime =(Integer)ctx.getVariable("waittime"); - int iterations =(Integer)ctx.getVariable("iterations"); + int iterations =(Integer)ctx.getVariable("noofiterations"); deployResponseSenderService.sendResponse(new BuildResponse("completed", "completed", "completed", "inprogress","not started", sitename,null,null,null)); - logger.debug("task execution started blueprint {}, remoteserver {}, portnumner {}, username {}, password {}, filename {}, waittime {}, No of iterations {}", - blueprint,remoteserver,portnumner,username,password,filename,srcdir,destdir,waittime,iterations); + logger.debug("task execution started blueprint {}, remoteserver {}, portnumber {}, username {}, password {}, filename {}, waittime {}, No of iterations {}", + blueprint, remoteserver, portnumber, username, password, filename, waittime, iterations); String command = String.format("/bin/bash %s/%s %s", destdir, filename, (fileparams!=null?fileparams.replaceAll(",", " "):"")); - if ( !filename.equals("null") || !filename.equals("") ) { + if ( filename != null && !filename.equals("null") && !filename.isEmpty() ) { logger.debug("Execution command: {}",command); - remotedeploymentVerificationService.executeScript(remoteserver,username,password,portnumner,filename,fileparams,srcdir,destdir,waittime,iterations,command); + remotedeploymentVerificationService.executeScript(remoteserver,username,password,portnumber,filename,fileparams,srcdir,destdir,waittime,iterations,command); } else { logger.debug("Skipping invalid verification command: {}", command); } -- 2.16.6