Fix more problems with CF CLI target expired token killing other targets results.

This commit is contained in:
Kris De Volder
2017-07-05 17:37:14 -07:00
parent 4fabf40579
commit eea477aeb6
2 changed files with 56 additions and 27 deletions

View File

@@ -27,16 +27,60 @@ public class ClientParamsCacheKey {
private ClientParamsCacheKey(CFClientParams fullParams) {
this.fullParams = fullParams;
}
// @Override
// public int hashCode() {
// final int prime = 31;
// int result = 1;
// result = prime * result + ((fullParams.getApiUrl() == null) ? 0 : fullParams.getApiUrl().hashCode());
// result = prime * result + ((fullParams.getOrgName() == null) ? 0 : fullParams.getOrgName().hashCode());
// result = prime * result + (fullParams.skipSslValidation() ? 1231 : 1237);
// result = prime * result + ((fullParams.getSpaceName() == null) ? 0 : fullParams.getSpaceName().hashCode());
// result = prime * result + ((fullParams.getUsername() == null) ? 0 : fullParams.getUsername().hashCode());
// return result;
// }
//
// @Override
// public boolean equals(Object obj) {
// if (this == obj)
// return true;
// if (obj == null)
// return false;
// if (getClass() != obj.getClass())
// return false;
// ClientParamsCacheKey other = (ClientParamsCacheKey) obj;
// if (fullParams.getApiUrl() == null) {
// if (other.fullParams.getApiUrl() != null)
// return false;
// } else if (!fullParams.getApiUrl().equals(other.fullParams.getApiUrl()))
// return false;
// if (fullParams.getOrgName() == null) {
// if (other.fullParams.getOrgName() != null)
// return false;
// } else if (!fullParams.getOrgName().equals(other.fullParams.getOrgName()))
// return false;
// if (fullParams.skipSslValidation() != other.fullParams.skipSslValidation())
// return false;
// if (fullParams.getSpaceName() == null) {
// if (other.fullParams.getSpaceName() != null)
// return false;
// } else if (!fullParams.getSpaceName().equals(other.fullParams.getSpaceName()))
// return false;
// if (fullParams.getUsername() == null) {
// if (other.fullParams.getUsername() != null)
// return false;
// } else if (!fullParams.getUsername().equals(other.fullParams.getUsername()))
// return false;
// return true;
// }
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((fullParams.getApiUrl() == null) ? 0 : fullParams.getApiUrl().hashCode());
result = prime * result + ((fullParams.getOrgName() == null) ? 0 : fullParams.getOrgName().hashCode());
result = prime * result + (fullParams.skipSslValidation() ? 1231 : 1237);
result = prime * result + ((fullParams.getSpaceName() == null) ? 0 : fullParams.getSpaceName().hashCode());
result = prime * result + ((fullParams.getUsername() == null) ? 0 : fullParams.getUsername().hashCode());
result = prime * result + ((fullParams == null) ? 0 : fullParams.hashCode());
return result;
}
@@ -49,31 +93,16 @@ public class ClientParamsCacheKey {
if (getClass() != obj.getClass())
return false;
ClientParamsCacheKey other = (ClientParamsCacheKey) obj;
if (fullParams.getApiUrl() == null) {
if (other.fullParams.getApiUrl() != null)
if (fullParams == null) {
if (other.fullParams != null)
return false;
} else if (!fullParams.getApiUrl().equals(other.fullParams.getApiUrl()))
return false;
if (fullParams.getOrgName() == null) {
if (other.fullParams.getOrgName() != null)
return false;
} else if (!fullParams.getOrgName().equals(other.fullParams.getOrgName()))
return false;
if (fullParams.skipSslValidation() != other.fullParams.skipSslValidation())
return false;
if (fullParams.getSpaceName() == null) {
if (other.fullParams.getSpaceName() != null)
return false;
} else if (!fullParams.getSpaceName().equals(other.fullParams.getSpaceName()))
return false;
if (fullParams.getUsername() == null) {
if (other.fullParams.getUsername() != null)
return false;
} else if (!fullParams.getUsername().equals(other.fullParams.getUsername()))
} else if (!fullParams.equals(other.fullParams))
return false;
return true;
}
public static ClientParamsCacheKey from(CFClientParams params) {
return new ClientParamsCacheKey(params);
}

View File

@@ -155,7 +155,7 @@ public class ManifestYamlLanguageServer extends SimpleLanguageServer {
for (ClientParamsProvider provider : providers) {
try {
params.addAll(provider.getParams());
} catch (NoTargetsException e) {
} catch (Exception e) {
// ignore
}
}