Handle case were Cli params provider finds empty org and space in target

This commit is contained in:
Kris De Volder
2017-02-02 13:17:29 -08:00
parent 4eaf945629
commit c24b4be073

View File

@@ -29,7 +29,7 @@ import com.fasterxml.jackson.databind.ObjectMapper;
*/
public class CfCliParamsProvider implements ClientParamsProvider {
public static final String TARGET = "Target";
public static final String REFRESH_TOKEN = "RefreshToken";
public static final String ORGANIZATION_FIELDS = "OrganizationFields";
@@ -66,6 +66,9 @@ public class CfCliParamsProvider implements ClientParamsProvider {
if (target != null && orgFields != null && spaceFields != null) {
String orgName = (String) orgFields.get(NAME);
String spaceName = (String) spaceFields.get(NAME);
if (!StringUtil.hasText(orgName) || !StringUtil.hasText(spaceName)) {
throw new NoTargetsException("No org/space selected: Use CF CLI to login");
}
params.add(new CFClientParams(target, null, credentials, orgName, spaceName, sslDisabled));
}
}