Merge remote-tracking branch 'origin/master' into bug2775

This commit is contained in:
Benjamin Barth committed 2016-06-09 16:32:49 +02:00
commit 480544df7a
1787 files changed
+188408 -21549

No files matched your search

@@ -1,22 +1,29 @@
package com.sap.sse.util.impl;
import java.net.MalformedURLException;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.util.logging.Level;
import java.util.logging.Logger;
import com.sap.sse.common.util.UrlHelper;
public enum NonGwtUrlHelper implements UrlHelper {
INSTANCE;
public String encodeUrl(String decodedUrlString) {
private static final Logger logger = Logger.getLogger(NonGwtUrlHelper.class.getName());
@Override
public String encodeQueryString(String queryString) {
try {
URL url = new URL(decodedUrlString);
URI uri = new URI(url.getProtocol(), url.getUserInfo(), url.getHost(), url.getPort(), url.getPath(),
url.getQuery(), url.getRef());
return uri.toString();
} catch (MalformedURLException | URISyntaxException f) {
// TODO See bug3664 => https://bugzilla.sapsailing.com/bugzilla/show_bug.cgi?id=3664
// Because of changes in the query string encoding, the Sail InSight-App for iOS will now have problems
// while parsing the registration URLs, which are sent to invited competitors, if e.g. the leaderboard name
// contains whitespaces. To avoid this problems, we use this temporary fix until a new version of the Sail
// InSight-App for iOS is rolled out. Afterwards this fix must be replaced by the line below.
return URLEncoder.encode(queryString, "UTF-8").replace("+", "%20");
// return URLEncoder.encode(queryString, "UTF-8");
} catch (UnsupportedEncodingException e) {
logger.log(Level.WARNING, "problem encoding URL query string "+queryString, e);
return null;
}
}