fixing bug 2320 by modifying how race board links require URL escaping of race names containing an ampersand

This commit is contained in:
Axel Uhl committed 2014-09-21 12:16:32 +02:00
1 parent 80aeb41a6e
commit da0bb59a08
2 files changed
+12 -8

No files matched your search

@@ -5,14 +5,14 @@ import com.sap.sailing.domain.common.impl.MeterDistance;
public enum BoatClassMasterdata {
_2_4M ("2.4 Meter", true, 4.11, 0.81, BoatHullType.MONOHULL, "2.4M", "2.4mR"),
_5O5 ("5O5", true, 5.03, 1.88, BoatHullType.MONOHULL, "505", "5o5", "505er", "5o5er"),
_5O5 ("5O5", true, 5.03, 1.88, BoatHullType.MONOHULL, "505", "5o5", "505er", "5o5er", "505-er"),
_12M ("12 Meter", true, 5.97, 1.43, BoatHullType.MONOHULL, "12M", "12mR", "12SQM"),
_29ER ("29er", true, 4.45, 1.70, BoatHullType.MONOHULL),
_29ER ("29er", true, 4.45, 1.70, BoatHullType.MONOHULL, "29-er"),
_29ERXX ("29erXX", true, 4.45, 1.77, BoatHullType.MONOHULL, "29XX"),
_49ER ("49er", true, 4.88, 1.93, BoatHullType.MONOHULL),
_49ER ("49er", true, 4.88, 1.93, BoatHullType.MONOHULL, "49-er"),
_49ERFX ("49erFX", true, 4.88, 1.93, BoatHullType.MONOHULL, "49FX"),
_420 ("420", true, 4.20, 1.65, BoatHullType.MONOHULL, "420er", "420M", "420W"),
_470 ("470", true, 4.70, 1.68, BoatHullType.MONOHULL, "470er", "470M", "470W"),
_420 ("420", true, 4.20, 1.65, BoatHullType.MONOHULL, "420er", "420M", "420W", "420-er"),
_470 ("470", true, 4.70, 1.68, BoatHullType.MONOHULL, "470er", "470M", "470W", "470-er"),
A_CAT ("A-Catamaran", true, 5.49, 2.30, BoatHullType.CATAMARAN, "A-Cat", "ACat", "A-Class Catamaran"),
ALBIN_EXPRESS ("Albin Express", true, 7.77, 2.50, BoatHullType.MONOHULL),
B_ONE ("B/ONE", true, 7.80, 2.49, BoatHullType.MONOHULL, "B-ONE"),
@@ -30,7 +30,7 @@ public class EntryPointLinkFactory {
int i = 1;
for (Entry<String, String> entry: parameters.entrySet()) {
link.append(i == 1 ? "?" : "&");
link.append(entry.getKey() + "=" + entry.getValue());
link.append(entry.getKey() + "=" + replaceAmpersand(URLEncoder.encode(entry.getValue())));
i++;
}
if (debugParam != null && !debugParam.isEmpty()) {
@@ -43,8 +43,12 @@ public class EntryPointLinkFactory {
}
if (documentAndFragment.length > 1) {
link.append('#');
link.append(documentAndFragment[1]); // append the fragment following the "#" again
link.append(URLEncoder.encode(documentAndFragment[1])); // append the fragment following the "#" again
}
return URLEncoder.encode(link.toString());
return link.toString();
}
private static String replaceAmpersand(String param) {
return param.replaceAll("&", "%26");
}
}