Validating that URIUtil.decodePath() can handle null characters

This commit is contained in:
Joakim Erdfelt 2012-11-29 10:20:41 -07:00
parent e1fb49d4d7
commit 916097f787
1 changed files with 4 additions and 0 deletions

View File

@ -60,6 +60,10 @@ public class URITest
assertEquals("foo%23;,:=b a r=",URIUtil.decodePath("xxxfoo%2523%3b%2c:%3db%20a%20r%3Dxxx;rubbish".getBytes(),3,30)); assertEquals("foo%23;,:=b a r=",URIUtil.decodePath("xxxfoo%2523%3b%2c:%3db%20a%20r%3Dxxx;rubbish".getBytes(),3,30));
assertEquals("fää%23;,:=b a r=",URIUtil.decodePath("fää%2523%3b%2c:%3db%20a%20r%3D")); assertEquals("fää%23;,:=b a r=",URIUtil.decodePath("fää%2523%3b%2c:%3db%20a%20r%3D"));
assertEquals("f\u0629\u0629%23;,:=b a r",URIUtil.decodePath("f%d8%a9%d8%a9%2523%3b%2c:%3db%20a%20r")); assertEquals("f\u0629\u0629%23;,:=b a r",URIUtil.decodePath("f%d8%a9%d8%a9%2523%3b%2c:%3db%20a%20r"));
// Test for null character (real world ugly test case)
byte odd[] = { '/', 0x00, '/' };
assertEquals(new String(odd),URIUtil.decodePath("/%00/"));
} }
/* ------------------------------------------------------------ */ /* ------------------------------------------------------------ */