From 232d517650c1107f9e168574a9043f0f55af792b Mon Sep 17 00:00:00 2001 From: Youri970410 <62531040+Youri970410@users.noreply.github.com> Date: Tue, 2 Mar 2021 13:19:04 +0800 Subject: [PATCH] Fix issue for PVS-Studio (#14371) --- .../HDInsight/JobCommands/InvokeHiveCommand.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/HDInsight/HDInsight/JobCommands/InvokeHiveCommand.cs b/src/HDInsight/HDInsight/JobCommands/InvokeHiveCommand.cs index 35ae4ac34742..22dfa623c0fa 100644 --- a/src/HDInsight/HDInsight/JobCommands/InvokeHiveCommand.cs +++ b/src/HDInsight/HDInsight/JobCommands/InvokeHiveCommand.cs @@ -109,12 +109,6 @@ public override void ExecuteCmdlet() var resourceGroup = SessionState.PSVariable.Get(UseAzureHDInsightClusterCommand.CurrentResourceGroup).Value.ToString(); - _credential = new BasicAuthenticationCloudCredentials - { - Username = clusterCred.UserName, - Password = clusterCred.Password.ConvertToString() - }; - if (clusterConnection == null || clusterCred == null) { throw new NullReferenceException( @@ -122,6 +116,12 @@ public override void ExecuteCmdlet() "The cluster or resource group specified is null. Please use the Use-AzHDInsightCluster command to connect to a cluster.")); } + _credential = new BasicAuthenticationCloudCredentials + { + Username = clusterCred.UserName, + Password = clusterCred.Password.ConvertToString() + }; + //get hive job var hivejob = hiveJobDefinitionCommand.GetHiveJob();