Skip to content

Commit

Permalink
remove a bunch of deprecated stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
rbri committed Aug 11, 2024
1 parent 2283bdf commit 3a10b49
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 265 deletions.
23 changes: 23 additions & 0 deletions src/changes/changes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,29 @@

<body>
<release version="4.5.0" date="xxxx, 2024" description="WebWorker, Bugfixes">
<action type="remove" dev="rbri">
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.
</action>
<action type="remove" dev="rbri">
Deprecated methods compile(HtmlPage, String, String, int), execute(HtmlPage, SCRIPT), and
execute(HtmlPage, String, String, int) removed from AbstractJavaScriptEngine.
</action>
<action type="remove" dev="rbri">
Deprecated methods setSSLClientCertificate(URL, String, String), and
setSSLClientCertificate(InputStream, String, String) removed from WebClientOptions.
</action>
<action type="remove" dev="rbri">
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.
</action>
<action type="update" dev="rbri">
Method CSSStyleSheet.validateSelectors(SelectorList, int, DomNode) is deprecated; please use method
CSSStyleSheet.validateSelectors(SelectorList, DomNode) instead.
</action>
<action type="fix" dev="RhinoTeam">
core-js: Error with yield in ComputedPropertyName fixed.
</action>
Expand Down
81 changes: 0 additions & 81 deletions src/main/java/org/htmlunit/DefaultCredentialsProvider.java
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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,
Expand All @@ -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: <code>"user"</code> is correct whereas <code>"DOMAIN\\user"</code> 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;
Expand All @@ -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
Expand Down
52 changes: 0 additions & 52 deletions src/main/java/org/htmlunit/WebClientOptions.java
Original file line number Diff line number Diff line change
Expand Up @@ -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}.
* <p>
* If the web server requires Renegotiation, you have to set system property
* "sun.security.ssl.allowUnsafeRenegotiation" to true, as hinted in
* <a href="http://www.oracle.com/technetwork/java/javase/documentation/tlsreadme2-176330.html">
* TLS Renegotiation Issue</a>.
*
* @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}.
Expand All @@ -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}.
* <p>
* If the web server requires Renegotiation, you have to set system property
* "sun.security.ssl.allowUnsafeRenegotiation" to true, as hinted in
* <a href="http://www.oracle.com/technetwork/java/javase/documentation/tlsreadme2-176330.html">
* TLS Renegotiation Issue</a>.
* <p>
* 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}.
Expand Down
37 changes: 0 additions & 37 deletions src/main/java/org/htmlunit/css/CssStyleSheet.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down
18 changes: 0 additions & 18 deletions src/main/java/org/htmlunit/html/HtmlFileInput.java
Original file line number Diff line number Diff line change
Expand Up @@ -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}
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,20 +122,6 @@ public interface AbstractJavaScriptEngine<SCRIPT> {
*/
SCRIPT compile(HtmlPage owningPage, Scriptable scope, String sourceCode, String sourceName, int startLine);

/**
* Compiles the specified JavaScript code in the context of a given HTML page.
*
* @param page the page that the code will execute within
* @param sourceCode the JavaScript code to execute
* @param sourceName the name that will be displayed on error conditions
* @param startLine the line at which the script source starts
* @return the result of executing the specified code
*
* @deprecated as of version 3.12.0; use {@link #compile(HtmlPage, Scriptable, String, String, int)} instead
*/
@Deprecated
SCRIPT compile(HtmlPage page, String sourceCode, String sourceName, int startLine);

/**
* Executes the specified JavaScript code in the context of a given page.
*
Expand All @@ -146,18 +132,6 @@ public interface AbstractJavaScriptEngine<SCRIPT> {
*/
Object execute(HtmlPage page, Scriptable scope, SCRIPT script);

/**
* Executes the specified JavaScript code in the context of a given page.
*
* @param page the page that the code will execute within
* @param script the script to execute
* @return the result of executing the specified code
*
* @deprecated as of version 3.12.0; use {@link #execute(HtmlPage, Scriptable, Object)} instead
*/
@Deprecated
Object execute(HtmlPage page, SCRIPT script);

/**
* Executes the specified JavaScript code in the context of a given page.
*
Expand All @@ -174,23 +148,6 @@ Object execute(HtmlPage page,
String sourceName,
int startLine);

/**
* Executes the specified JavaScript code in the context of a given page.
*
* @param page the page that the code will execute within
* @param sourceCode the JavaScript code to execute
* @param sourceName the name that will be displayed on error conditions
* @param startLine the line at which the script source starts
* @return the result of executing the specified code
*
* @deprecated as of version 3.12.0; use {@link #execute(HtmlPage, Scriptable, String, String, int)} instead
*/
@Deprecated
Object execute(HtmlPage page,
String sourceCode,
String sourceName,
int startLine);

/**
* @return this JavaScript engine's {@link HtmlUnitContextFactory}
*/
Expand Down
Loading

0 comments on commit 3a10b49

Please sign in to comment.