Skip to content

Commit

Permalink
WICKET-6993 - Get rid of unused old escape methods
Browse files Browse the repository at this point in the history
These are not used in the code anymore
  • Loading branch information
Peter Lamby committed Jun 30, 2022
1 parent 8792734 commit 4ce83d5
Showing 1 changed file with 0 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.Locale;
import java.util.regex.Pattern;

import org.apache.wicket.WicketRuntimeException;
import org.apache.wicket.request.Url;
Expand All @@ -44,7 +43,6 @@ public class ResourceUtil
* Used to denote {@code null} in encoded strings.
*/
private static final String NULL_VALUE = "null";
private static final Pattern ESCAPED_ATTRIBUTE_PATTERN = Pattern.compile("(\\w)~(\\w)");

/**
* Reads resource reference attributes (style, locale, variation) encoded in the given string.
Expand Down Expand Up @@ -138,20 +136,6 @@ public static void encodeResourceReferenceAttributes(Url url, ResourceReference
}
}

/**
* Escapes any occurrences of <em>-</em> character in the style and variation
* attributes with <em>~</em>. Any occurrence of <em>~</em> is encoded as <em>~~</em>.
*
* @param attribute
* the attribute to escape
* @return the attribute with escaped separator character
*/
public static CharSequence escapeAttributesSeparator(String attribute)
{
CharSequence tmp = Strings.replaceAll(attribute, "~", "~~");
return Strings.replaceAll(tmp, "-", "~");
}

/**
* Parses the string representation of a {@link java.util.Locale} (for example 'en_GB').
*
Expand Down Expand Up @@ -241,20 +225,6 @@ public static String readString(IResourceStream resourceStream, Charset charset)
}
}

/**
* Reverts the escaping applied by {@linkplain #escapeAttributesSeparator(String)} - unescapes
* occurrences of <em>~</em> character in the style and variation attributes with <em>-</em>.
*
* @param attribute
* the attribute to unescape
* @return the attribute with escaped separator character
*/
public static String unescapeAttributesSeparator(String attribute)
{
String tmp = ESCAPED_ATTRIBUTE_PATTERN.matcher(attribute).replaceAll("$1-$2");
return Strings.replaceAll(tmp, "~~", "~").toString();
}

/**
* Encode the {@code part} in the format <string length encoded in base ten ASCII>~<string data>.
*
Expand Down

0 comments on commit 4ce83d5

Please sign in to comment.