mirror of
https://github.com/zxing/zxing.git
synced 2024-11-09 20:44:03 -08:00
Deal with case of no block list
This commit is contained in:
parent
5a6982f301
commit
62cf0ade90
|
@ -57,10 +57,10 @@ import java.net.MalformedURLException;
|
|||
import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
import java.net.URL;
|
||||
import java.net.URLConnection;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.EnumMap;
|
||||
import java.util.EnumSet;
|
||||
import java.util.Map;
|
||||
|
@ -115,14 +115,18 @@ public final class DecodeServlet extends HttpServlet {
|
|||
diskFileItemFactory = new DiskFileItemFactory(1 << 16, repository);
|
||||
diskFileItemFactory.setFileCleaningTracker(fileCleaningTracker);
|
||||
|
||||
URL blockURL = context.getClassLoader().getResource("/private/uri-block-substrings.txt");
|
||||
if (blockURL == null) {
|
||||
blockedURLSubstrings = Collections.emptyList();
|
||||
} else {
|
||||
try {
|
||||
blockedURLSubstrings =
|
||||
Resources.readLines(Resources.getResource("/private/uri-block-substrings.txt"), StandardCharsets.UTF_8);
|
||||
blockedURLSubstrings = Resources.readLines(blockURL, StandardCharsets.UTF_8);
|
||||
} catch (IOException ioe) {
|
||||
throw new ServletException(ioe);
|
||||
}
|
||||
log.info("Blocking URIs containing: " + blockedURLSubstrings);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doGet(HttpServletRequest request,
|
||||
|
|
Loading…
Reference in a new issue