UrlDecoder { public String decode(final String s, final Charset enc) { return decode(s, enc.name()); } private  UrlDecoder(final boolean decodePlus); String decode(final String s, final Charset enc); String decode(final String s, final String enc); static final UrlDecoder QUERY_INSTANCE; static final UrlDecoder PATH_INSTANCE; }
@Test public void mustNotEmitNullByteForQuery() throws Exception { String evil = "http: String decoded = UrlDecoder.QUERY_INSTANCE.decode(evil, "UTF-8"); assertEquals(-1, decoded.indexOf('\0')); assertEquals("http: }
@Test public void badUrlEntities() throws Exception { String url = "http: String decoded = UrlDecoder.QUERY_INSTANCE.decode(url, "UTF-8"); assertEquals("http: url = "http: decoded = UrlDecoder.QUERY_INSTANCE.decode(url, "UTF-8"); assertEquals("http: url = "http: decoded = UrlDecoder.QUERY_INSTANCE.decode(url, "UTF-8"); assertEquals("http: }
@Test public void mustNotEmitNullByteForPath() throws Exception { String evil = "http: String decoded = UrlDecoder.PATH_INSTANCE.decode(evil, "UTF-8"); assertEquals(-1, decoded.indexOf('\0')); assertEquals("http: }