Skip to content

Commit 648690f

Browse files
committed
Includes a copy of in
https://publicsuffix.org/list/effective_tld_names.dat in httpclient5/src/test/resources/org/publicsuffix/list/effective_tld_names.dat Cleanly separate the concerns of which file to copy and whether to filter it or not by using two <resource> elements: - We want the .properties file copied and filtered. The git master version causes only the properties file to be copied, the .dat file is not copied. - We want to the .dat file copied but not filtered.
1 parent 5b546de commit 648690f

File tree

7 files changed

+15874
-9
lines changed

7 files changed

+15874
-9
lines changed

NOTICE.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,8 @@ Copyright 1999-2023 The Apache Software Foundation
44
This product includes software developed at
55
The Apache Software Foundation (http://www.apache.org/).
66

7+
This product includes a copy of in https://publicsuffix.org/list/effective_tld_names.dat
8+
in httpclient5/src/test/resources/org/publicsuffix/list/effective_tld_names.dat
9+
This Source Code Form is subject to the terms of the Mozilla Public
10+
License, v. 2.0. If a copy of the MPL was not distributed with this
11+
file, You can obtain one at https://mozilla.org/MPL/2.0/.

httpclient5/pom.xml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,12 @@
108108
<include>**/*.properties</include>
109109
</includes>
110110
</resource>
111+
<resource>
112+
<directory>src/main/resources</directory>
113+
<includes>
114+
<include>**/*.dat</include>
115+
</includes>
116+
</resource>
111117
</resources>
112118
<plugins>
113119
<plugin>
@@ -123,8 +129,7 @@
123129
</goals>
124130
<configuration>
125131
<url>https://publicsuffix.org/list/effective_tld_names.dat</url>
126-
<outputDirectory>${project.build.outputDirectory}/mozilla</outputDirectory>
127-
<outputFileName>public-suffix-list.txt</outputFileName>
132+
<outputDirectory>${project.basedir}/src/main/resources/org/publicsuffix/list</outputDirectory>
128133
</configuration>
129134
</execution>
130135
</executions>

httpclient5/src/main/java/org/apache/hc/client5/http/psl/PublicSuffixMatcherLoader.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@
5151
@Contract(threading = ThreadingBehavior.SAFE)
5252
public final class PublicSuffixMatcherLoader {
5353

54+
private static final String PUBLIC_SUFFIX_LIST = "org/publicsuffix/list/effective_tld_names.dat";
55+
5456
private static final Logger LOG = LoggerFactory.getLogger(PublicSuffixMatcherLoader.class);
5557

5658
private static final ReentrantLock lock = new ReentrantLock();
@@ -81,9 +83,8 @@ public static PublicSuffixMatcher getDefault() {
8183
if (DEFAULT_INSTANCE == null) {
8284
lock.lock();
8385
try {
84-
if (DEFAULT_INSTANCE == null){
85-
final URL url = PublicSuffixMatcherLoader.class.getResource(
86-
"/mozilla/public-suffix-list.txt");
86+
if (DEFAULT_INSTANCE == null) {
87+
final URL url = PublicSuffixMatcherLoader.class.getResource(PUBLIC_SUFFIX_LIST);
8788
if (url != null) {
8889
try {
8990
DEFAULT_INSTANCE = load(url);

0 commit comments

Comments
 (0)