MCPcopy Create free account
hub / github.com/apache/tomcat / unescape

Method unescape

java/org/apache/catalina/connector/Request.java:2864–2885  ·  view source on GitHub ↗

Unescape a string. @param s the string to unescape @return the unescaped string

(String s)

Source from the content-addressed store, hash-verified

2862 * @return the unescaped string
2863 */
2864 protected String unescape(String s) {
2865 if (s == null) {
2866 return null;
2867 }
2868 if (s.indexOf('\\') == -1) {
2869 return s;
2870 }
2871 StringBuilder buf = new StringBuilder();
2872 for (int i = 0; i < s.length(); i++) {
2873 char c = s.charAt(i);
2874 if (c != '\\') {
2875 buf.append(c);
2876 } else {
2877 if (++i >= s.length()) {
2878 throw new IllegalArgumentException();// invalid escape, hence invalid cookie
2879 }
2880 c = s.charAt(i);
2881 buf.append(c);
2882 }
2883 }
2884 return buf.toString();
2885 }
2886
2887 private CookieProcessor getCookieProcessor() {
2888 Context context = getContext();

Callers 1

convertCookiesMethod · 0.95

Calls 5

lengthMethod · 0.80
charAtMethod · 0.80
toStringMethod · 0.65
indexOfMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected