From 3a10b49b3b29db3fca7c256eef9ecda9edde9fa6 Mon Sep 17 00:00:00 2001 From: Ronald Brill Date: Sun, 11 Aug 2024 09:46:23 +0200 Subject: [PATCH] remove a bunch of deprecated stuff --- src/changes/changes.xml | 23 ++++++ .../htmlunit/DefaultCredentialsProvider.java | 81 ------------------- .../java/org/htmlunit/WebClientOptions.java | 52 ------------ .../java/org/htmlunit/css/CssStyleSheet.java | 37 --------- .../java/org/htmlunit/html/HtmlFileInput.java | 18 ----- .../HtmlUnitUsernamePasswordCredentials.java | 13 --- .../javascript/AbstractJavaScriptEngine.java | 43 ---------- .../javascript/host/css/CSSStyleSheet.java | 21 ----- 8 files changed, 23 insertions(+), 265 deletions(-) diff --git a/src/changes/changes.xml b/src/changes/changes.xml index 5fbf4046ec0..b27794885c0 100644 --- a/src/changes/changes.xml +++ b/src/changes/changes.xml @@ -8,6 +8,29 @@ + + Deprecated method CssStyleSheet.parseMedia(CSSErrorHandler, String) removed. + Deprecated method CSSStyleSheet.validateSelectors(SelectorList, int, DomNode) removed. + Deprecated method HtmlFileInput.setValueAttribute(String) removed. + Deprecated ctor HtmlUnitUsernamePasswordCredentials.HtmlUnitUsernamePasswordCredentials(String, String) removed. + + + Deprecated methods compile(HtmlPage, String, String, int), execute(HtmlPage, SCRIPT), and + execute(HtmlPage, String, String, int) removed from AbstractJavaScriptEngine. + + + Deprecated methods setSSLClientCertificate(URL, String, String), and + setSSLClientCertificate(InputStream, String, String) removed from WebClientOptions. + + + Deprecated methods addCredentials(String, String), .addCredentials(String, String, String, int, String), + addNTLMCredentials(String, String, String, int, String, String), and + addSocksCredentials(String, String, String, int) removed from DefaultCredentialsProvider. + + + Method CSSStyleSheet.validateSelectors(SelectorList, int, DomNode) is deprecated; please use method + CSSStyleSheet.validateSelectors(SelectorList, DomNode) instead. + core-js: Error with yield in ComputedPropertyName fixed. diff --git a/src/main/java/org/htmlunit/DefaultCredentialsProvider.java b/src/main/java/org/htmlunit/DefaultCredentialsProvider.java index fb81569e953..59012821abe 100644 --- a/src/main/java/org/htmlunit/DefaultCredentialsProvider.java +++ b/src/main/java/org/htmlunit/DefaultCredentialsProvider.java @@ -85,22 +85,6 @@ protected PasswordAuthentication getPasswordAuthentication() { } } - /** - * Adds credentials for the specified username/password for any host/port/realm combination. - * The credentials may be for any authentication scheme, including NTLM, digest and basic - * HTTP authentication. If you are using sensitive username/password information, please do - * NOT use this method. If you add credentials using this method, any server that requires - * authentication may receive the specified username and password. - * @param username the username for the new credentials - * @param password the password for the new credentials - * - * @deprecated as of version 3.4.0; use addCredentials(String, char[]) instead - */ - @Deprecated - public void addCredentials(final String username, final String password) { - addCredentials(username, password, ANY_HOST, ANY_PORT, ANY_REALM); - } - /** * Adds credentials for the specified username/password for any host/port/realm combination. * The credentials may be for any authentication scheme, including NTLM, digest and basic @@ -114,28 +98,6 @@ public void addCredentials(final String username, final char[] password) { addCredentials(username, password, ANY_HOST, ANY_PORT, ANY_REALM); } - /** - * Adds credentials for the specified username/password on the specified host/port for the - * specified realm. The credentials may be for any authentication scheme, including NTLM, - * digest and basic HTTP authentication. - * @param username the username for the new credentials - * @param password the password for the new credentials - * @param host the host to which to the new credentials apply ({@code null} if applicable to any host) - * @param port the port to which to the new credentials apply (negative if applicable to any port) - * @param realm the realm to which to the new credentials apply ({@code null} if applicable to any realm) - * - * @deprecated as of version 3.4.0; - * use DefaultCredentialsProvider.addCredentials(String, char[], String, int, String) instead - */ - @Deprecated - public void addCredentials(final String username, final String password, final String host, - final int port, final String realm) { - final AuthScope authscope = new AuthScope(host, port, realm, ANY_SCHEME); - final HtmlUnitUsernamePasswordCredentials credentials = - new HtmlUnitUsernamePasswordCredentials(username, password.toCharArray()); - setCredentials(authscope, credentials); - } - /** * Adds credentials for the specified username/password on the specified host/port for the * specified realm. The credentials may be for any authentication scheme, including NTLM, @@ -154,28 +116,6 @@ public void addCredentials(final String username, final char[] password, final S setCredentials(authscope, credentials); } - /** - * Adds NTLM credentials for the specified username/password on the specified host/port. - * @param username the username for the new credentials; should not include the domain to authenticate with; - * for example: "user" is correct whereas "DOMAIN\\user" is not - * @param password the password for the new credentials - * @param host the host to which to the new credentials apply ({@code null} if applicable to any host) - * @param port the port to which to the new credentials apply (negative if applicable to any port) - * @param workstation The workstation the authentication request is originating from. - * Essentially, the computer name for this machine. - * @param domain the domain to authenticate within - * - * @deprecated as of version 3.4.0; - * use DefaultCredentialsProvider.addNTLMCredentials(String, char[], String, int, String, String) instead - */ - @Deprecated - public void addNTLMCredentials(final String username, final String password, final String host, - final int port, final String workstation, final String domain) { - final AuthScope authscope = new AuthScope(host, port, ANY_REALM, ANY_SCHEME); - final NTCredentials credentials = new NTCredentials(username, password, workstation, domain); - setCredentials(authscope, credentials); - } - /** * Adds NTLM credentials for the specified username/password on the specified host/port. * @param username the username for the new credentials; should not include the domain to authenticate with; @@ -194,27 +134,6 @@ public void addNTLMCredentials(final String username, final char[] password, fin setCredentials(authscope, credentials); } - /** - * Adds Socks credentials for the specified username/password on the specified host/port. - * @param username the username for the new credentials - * @param password the password for the new credentials - * @param host the host to which to the new credentials apply ({@code null} if applicable to any host) - * @param port the port to which to the new credentials apply (negative if applicable to any port) - * - * @deprecated as of version 3.4.0; - * use DefaultCredentialsProvider.addSocksCredentials(String, char[], String, int) instead - */ - @Deprecated - public void addSocksCredentials(final String username, final String password, final String host, - final int port) { - final AuthScope authscope = new AuthScope(host, port, ANY_REALM, ANY_SCHEME); - final HtmlUnitUsernamePasswordCredentials credentials = - new HtmlUnitUsernamePasswordCredentials(username, password.toCharArray()); - setCredentials(authscope, credentials); - - initSocksAuthenticatorIfNeeded(this); - } - /** * Adds Socks credentials for the specified username/password on the specified host/port. * @param username the username for the new credentials diff --git a/src/main/java/org/htmlunit/WebClientOptions.java b/src/main/java/org/htmlunit/WebClientOptions.java index ab9af01a55a..772907227c2 100644 --- a/src/main/java/org/htmlunit/WebClientOptions.java +++ b/src/main/java/org/htmlunit/WebClientOptions.java @@ -174,27 +174,6 @@ public void setSSLClientCertificateKeyStore(final KeyStore keyStore, final char[ sslClientCertificatePassword_ = keyStorePassword; } - /** - * Sets the SSL client certificate to use. - * The needed parameters are used to construct a {@link java.security.KeyStore}. - *

- * If the web server requires Renegotiation, you have to set system property - * "sun.security.ssl.allowUnsafeRenegotiation" to true, as hinted in - * - * TLS Renegotiation Issue. - * - * @param certificateUrl the URL which locates the certificate - * @param certificatePassword the certificate password - * @param certificateType the type of certificate, usually {@code jks} or {@code pkcs12} - * - * @deprecated as of version 3.10.0; use {@link #setSSLClientCertificateKeyStore(URL, String, String)} instead - */ - @Deprecated - public void setSSLClientCertificate(final URL certificateUrl, final String certificatePassword, - final String certificateType) { - setSSLClientCertificateKeyStore(certificateUrl, certificatePassword, certificateType); - } - /** * Sets the SSL client certificate to use. * The needed parameters are used to construct a {@link java.security.KeyStore}. @@ -220,37 +199,6 @@ public void setSSLClientCertificateKeyStore(final URL keyStoreUrl, final String } } - /** - * Sets the SSL client certificate to use. The needed parameters are used to - * construct a {@link java.security.KeyStore}. - *

- * If the web server requires Renegotiation, you have to set system property - * "sun.security.ssl.allowUnsafeRenegotiation" to true, as hinted in - * - * TLS Renegotiation Issue. - *

- * In some cases the impl seems to pick old certificats from the KeyStore. To avoid - * that, wrap your keystore inside your own KeyStore impl and filter out outdated - * certificates. Provide the Keystore to the options instead of the input stream. - * - * @param certificateInputStream the input stream which represents the certificate - * @param certificatePassword the certificate password - * @param certificateType the type of certificate, usually {@code jks} or {@code pkcs12} - * - * @deprecated as of version 3.10.0; - * use {@link #setSSLClientCertificateKeyStore(InputStream, String, String)} instead - */ - @Deprecated - public void setSSLClientCertificate(final InputStream certificateInputStream, final String certificatePassword, - final String certificateType) { - try { - setSSLClientCertificateKeyStore(certificateInputStream, certificatePassword, certificateType); - } - catch (final Exception e) { - throw new RuntimeException(e); - } - } - /** * Sets the SSL client certificate {@link KeyStore} to use. The parameters are used to * construct the {@link KeyStore}. diff --git a/src/main/java/org/htmlunit/css/CssStyleSheet.java b/src/main/java/org/htmlunit/css/CssStyleSheet.java index a2ac13ac9d9..dbf90147dfe 100644 --- a/src/main/java/org/htmlunit/css/CssStyleSheet.java +++ b/src/main/java/org/htmlunit/css/CssStyleSheet.java @@ -72,7 +72,6 @@ import org.htmlunit.cssparser.parser.condition.Condition; import org.htmlunit.cssparser.parser.condition.Condition.ConditionType; import org.htmlunit.cssparser.parser.condition.NotPseudoClassCondition; -import org.htmlunit.cssparser.parser.javacc.CSS3Parser; import org.htmlunit.cssparser.parser.media.MediaQuery; import org.htmlunit.cssparser.parser.selector.ChildSelector; import org.htmlunit.cssparser.parser.selector.DescendantSelector; @@ -1021,42 +1020,6 @@ public static MediaListImpl parseMedia(final String mediaString, final WebClient return media; } - /** - * Parses the given media string. If anything at all goes wrong, this - * method returns an empty MediaList list. - * - * @param mediaString the source from which to retrieve the media to be parsed - * @param errorHandler the {@link CSSErrorHandler} to be used - * @return the media parsed from the specified input source - * - * @deprecated as of version 3.8.0; use {@link #parseMedia(String, WebClient)} instead - */ - @Deprecated - public static MediaListImpl parseMedia(final CSSErrorHandler errorHandler, final String mediaString) { - MediaListImpl media = MEDIA.get(mediaString); - if (media != null) { - return media; - } - - try { - final CSSOMParser parser = new CSSOMParser(new CSS3Parser()); - parser.setErrorHandler(errorHandler); - - media = new MediaListImpl(parser.parseMedia(mediaString)); - MEDIA.put(mediaString, media); - return media; - } - catch (final Exception e) { - if (LOG.isErrorEnabled()) { - LOG.error("Error parsing CSS media from '" + mediaString + "': " + e.getMessage(), e); - } - } - - media = new MediaListImpl(null); - MEDIA.put(mediaString, media); - return media; - } - /** * Returns the contents of the specified input source, ignoring any {@link IOException}s. * @param source the input source from which to read diff --git a/src/main/java/org/htmlunit/html/HtmlFileInput.java b/src/main/java/org/htmlunit/html/HtmlFileInput.java index 5a8a2578ea3..cb53def554a 100644 --- a/src/main/java/org/htmlunit/html/HtmlFileInput.java +++ b/src/main/java/org/htmlunit/html/HtmlFileInput.java @@ -176,24 +176,6 @@ public void setDefaultValue(final String defaultValue) { } } - /** - * {@inheritDoc} - * @deprecated as of version 3.0.0; use {@link #setValue(String)} instead - */ - @Deprecated - @Override - public void setValueAttribute(final String newValue) { - // make sure to remove setDefaultValue() also when removing this - super.setValueAttribute(newValue); - - if (StringUtils.isEmpty(newValue)) { - files_ = new File[0]; - return; - } - - files_ = new File[] {normalizeFile(new File(newValue))}; - } - /** * {@inheritDoc} */ diff --git a/src/main/java/org/htmlunit/httpclient/HtmlUnitUsernamePasswordCredentials.java b/src/main/java/org/htmlunit/httpclient/HtmlUnitUsernamePasswordCredentials.java index 69eafea0701..4502bcbc49d 100644 --- a/src/main/java/org/htmlunit/httpclient/HtmlUnitUsernamePasswordCredentials.java +++ b/src/main/java/org/htmlunit/httpclient/HtmlUnitUsernamePasswordCredentials.java @@ -31,19 +31,6 @@ public class HtmlUnitUsernamePasswordCredentials implements Credentials, Seriali private final UsernamePasswordCredentials httpClientUsernamePasswordCredentials_; - /** - * The constructor with the username and password arguments. - * - * @param userName the user name - * @param password the password - * - * @deprecated as of version 3.4.0; use HtmlUnitUsernamePasswordCredentials(String, char[]) instead - */ - @Deprecated - public HtmlUnitUsernamePasswordCredentials(final String userName, final String password) { - httpClientUsernamePasswordCredentials_ = new UsernamePasswordCredentials(userName, password); - } - /** * The constructor with the username and password arguments. * diff --git a/src/main/java/org/htmlunit/javascript/AbstractJavaScriptEngine.java b/src/main/java/org/htmlunit/javascript/AbstractJavaScriptEngine.java index 144aabf2a73..1a36e9ecbc4 100644 --- a/src/main/java/org/htmlunit/javascript/AbstractJavaScriptEngine.java +++ b/src/main/java/org/htmlunit/javascript/AbstractJavaScriptEngine.java @@ -122,20 +122,6 @@ public interface AbstractJavaScriptEngine