From 9d538e634c47754f976e6503ed7e427f92802ec2 Mon Sep 17 00:00:00 2001 From: Jonathan Hedley Date: Sat, 14 Aug 2021 13:03:45 +1000 Subject: [PATCH] Annotate some nullables --- src/main/java/org/jsoup/helper/DataUtil.java | 8 ++++---- src/main/java/org/jsoup/internal/StringUtil.java | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/java/org/jsoup/helper/DataUtil.java b/src/main/java/org/jsoup/helper/DataUtil.java index a111a4e6ef..3b0a2b12ed 100644 --- a/src/main/java/org/jsoup/helper/DataUtil.java +++ b/src/main/java/org/jsoup/helper/DataUtil.java @@ -80,25 +80,25 @@ public static Document load(File in, @Nullable String charsetName, String baseUr /** * Parses a Document from an input steam. * @param in input stream to parse. The stream will be closed after reading. - * @param charsetName character set of input + * @param charsetName character set of input (optional) * @param baseUri base URI of document, to resolve relative links against * @return Document * @throws IOException on IO error */ - public static Document load(InputStream in, String charsetName, String baseUri) throws IOException { + public static Document load(InputStream in, @Nullable String charsetName, String baseUri) throws IOException { return parseInputStream(in, charsetName, baseUri, Parser.htmlParser()); } /** * Parses a Document from an input steam, using the provided Parser. * @param in input stream to parse. The stream will be closed after reading. - * @param charsetName character set of input + * @param charsetName character set of input (optional) * @param baseUri base URI of document, to resolve relative links against * @param parser alternate {@link Parser#xmlParser() parser} to use. * @return Document * @throws IOException on IO error */ - public static Document load(InputStream in, String charsetName, String baseUri, Parser parser) throws IOException { + public static Document load(InputStream in, @Nullable String charsetName, String baseUri, Parser parser) throws IOException { return parseInputStream(in, charsetName, baseUri, parser); } diff --git a/src/main/java/org/jsoup/internal/StringUtil.java b/src/main/java/org/jsoup/internal/StringUtil.java index f51fc2cfa9..08352253fa 100644 --- a/src/main/java/org/jsoup/internal/StringUtil.java +++ b/src/main/java/org/jsoup/internal/StringUtil.java @@ -260,7 +260,7 @@ public static boolean isAscii(String string) { return true; } - private static Pattern extraDotSegmentsPattern = Pattern.compile("^/((\\.{1,2}/)+)"); + private static final Pattern extraDotSegmentsPattern = Pattern.compile("^/((\\.{1,2}/)+)"); /** * Create a new absolute URL, from a provided existing absolute URL and a relative URL component. * @param base the existing absolute base URL