Permalink
Browse files

ZSTD-3950 Error during application update when there is no "/" at the

end of base URL
  • Loading branch information...
1 parent 6f7cf1b commit 50aa1d1a32a66d703e6eba75cd15cc0f0c98c12a @wgalanciak wgalanciak committed Feb 26, 2014
@@ -47,7 +47,14 @@ protected IStatus run(IProgressMonitor monitor) {
ApplicationsList list = app.getStatus(helper.getTargetId());
List<ApplicationInfo> infos = list.getApplicationsInfo();
if (infos != null) {
- URL baseURL = helper.getBaseURL();
+ String urlString = helper.getBaseURL().toString();
+ urlString = removeSlash(urlString);
+ URL baseURL = null;
+ try {
+ baseURL = new URL(urlString);
+ } catch (MalformedURLException e) {
+ // cannot occur
+ }
possibleURLs.add(baseURL);
initLocalUrls(baseURL);
if (helper.isDefaultServer()) {
@@ -63,17 +70,22 @@ protected IStatus run(IProgressMonitor monitor) {
}
}
for (ApplicationInfo info : infos) {
- URL baseUrl = null;
- try {
- baseUrl = new URL(info.getBaseUrl());
- } catch (MalformedURLException e) {
- // / ignore
- }
- for (URL url : possibleURLs) {
- if (compareURLs(url, baseUrl)) {
- helper.setAppId(info.getId());
- helper.setInstalledLocation(info.getInstalledLocation());
- return new SdkStatus(listener.getStatus());
+ String appUrl = info.getBaseUrl();
+ if (appUrl != null) {
+ appUrl = removeSlash(appUrl);
+ URL baseUrl = null;
+ try {
+ baseUrl = new URL(appUrl);
+ } catch (MalformedURLException e) {
+ // / ignore
+ }
+ for (URL url : possibleURLs) {
+ if (compareURLs(url, baseUrl)) {
+ helper.setAppId(info.getId());
+ helper.setInstalledLocation(info
+ .getInstalledLocation());
+ return new SdkStatus(listener.getStatus());
+ }
}
}
}
@@ -124,4 +136,11 @@ private boolean compareURLs(URL current, URL url) {
return false;
}
+ private String removeSlash(String url) {
+ if (url.endsWith("/")) { //$NON-NLS-1$
+ return url.substring(0, url.length() - 1);
+ }
+ return url;
+ }
+
}

0 comments on commit 50aa1d1

Please sign in to comment.