nielsbasjes commented on a change in pull request #174: HTTPCLIENT-2030: Fix
PublicSuffixMatcher::getDomainRoot on invalid hostnames
URL:
https://github.com/apache/httpcomponents-client/pull/174#discussion_r350662284
##########
File path:
httpclient5/src/test/java/org/apache/hc/client5/http/psl/TestPublicSuffixMatcher.java
##########
@@ -46,36 +44,78 @@ public void setUp() throws Exception {
final ClassLoader classLoader = getClass().getClassLoader();
final InputStream in = classLoader.getResourceAsStream(SOURCE_FILE);
Assert.assertNotNull(in);
- final PublicSuffixList suffixList;
- try {
- final PublicSuffixListParser parser = new PublicSuffixListParser();
- suffixList = parser.parse(new InputStreamReader(in,
StandardCharsets.UTF_8));
- } finally {
- in.close();
- }
- matcher = new PublicSuffixMatcher(suffixList.getRules(),
suffixList.getExceptions());
+ matcher = PublicSuffixMatcherLoader.load(in);
}
@Test
- public void testGetDomainRoot() throws Exception {
+ public void testGetDomainRootAnyType() {
+ // Private
Assert.assertEquals("example.xx", matcher.getDomainRoot("example.XX"));
Assert.assertEquals("example.xx",
matcher.getDomainRoot("www.example.XX"));
Assert.assertEquals("example.xx",
matcher.getDomainRoot("www.blah.blah.example.XX"));
- Assert.assertEquals(null, matcher.getDomainRoot("xx"));
- Assert.assertEquals(null, matcher.getDomainRoot("jp"));
- Assert.assertEquals(null, matcher.getDomainRoot("ac.jp"));
- Assert.assertEquals(null, matcher.getDomainRoot("any.tokyo.jp"));
+ // Too short
+ Assert.assertNull(matcher.getDomainRoot("xx"));
Review comment:
I reverted this change to assertNull
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]