From: <asa...@us...> - 2017-07-20 10:22:29
|
Revision: 14678 http://sourceforge.net/p/htmlunit/code/14678 Author: asashour Date: 2017-07-20 10:22:26 +0000 (Thu, 20 Jul 2017) Log Message: ----------- Remove deprecated HtmlFileInput.setValueAttribute(String[]), HtmlInput.click(int,int), SgmlPage.getPageEncoding(), WebRequest.setCharset(String) and WebResponse.getContentAsString(String). Modified Paths: -------------- trunk/htmlunit/src/changes/changes.xml trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/SgmlPage.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/StringWebResponse.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/WebRequest.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/WebResponse.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlFileInput.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlImageInput.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlInput.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/util/WebResponseWrapper.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/CacheTest.java Modified: trunk/htmlunit/src/changes/changes.xml =================================================================== --- trunk/htmlunit/src/changes/changes.xml 2017-07-20 10:07:12 UTC (rev 14677) +++ trunk/htmlunit/src/changes/changes.xml 2017-07-20 10:22:26 UTC (rev 14678) @@ -8,6 +8,10 @@ <body> <release version="2.28" date="???" description="Bugfixes"> + <action type="remove" dev="asashour"> + Remove deprecated HtmlFileInput.setValueAttribute(String[]), HtmlInput.click(int,int), + SgmlPage.getPageEncoding(), WebRequest.setCharset(String) and WebResponse.getContentAsString(String). + </action> <action type="fix" dev="asashour" issue="1898"> Fix Location header if it has non-ASCII characters. </action> Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/SgmlPage.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/SgmlPage.java 2017-07-20 10:07:12 UTC (rev 14677) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/SgmlPage.java 2017-07-20 10:22:26 UTC (rev 14678) @@ -194,17 +194,6 @@ public abstract Element createElementNS(String namespaceURI, String qualifiedName); /** - * Returns the page encoding. - * @return the page encoding - * @deprecated as of 2.25, please use {@link #getCharset()} instead - */ - @Deprecated - public String getPageEncoding() { - final Charset charset = getCharset(); - return charset == null ? null : charset.name(); - } - - /** * Returns the encoding. * @return the encoding */ Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/StringWebResponse.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/StringWebResponse.java 2017-07-20 10:07:12 UTC (rev 14677) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/StringWebResponse.java 2017-07-20 10:22:26 UTC (rev 14678) @@ -54,19 +54,7 @@ * @param content the content to return * @param charset the charset used to convert the content * @param originatingURL the URL that this should be associated with - * @deprecated as of 2.25, please use {@link #StringWebResponse(String, Charset, URL)} */ - @Deprecated - public StringWebResponse(final String content, final String charset, final URL originatingURL) { - this(content, Charset.forName(charset), originatingURL); - } - - /** - * Creates an instance associated with the specified originating URL. - * @param content the content to return - * @param charset the charset used to convert the content - * @param originatingURL the URL that this should be associated with - */ public StringWebResponse(final String content, final Charset charset, final URL originatingURL) { super(getWebResponseData(content, charset), buildWebRequest(originatingURL, charset), 0); } Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/WebRequest.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/WebRequest.java 2017-07-20 10:07:12 UTC (rev 14677) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/WebRequest.java 2017-07-20 10:22:26 UTC (rev 14678) @@ -423,17 +423,6 @@ /** * Sets the character set to use to perform the request. The default value * is {@link java.nio.charset.StandardCharsets#ISO_8859_1}. - * @param charsetName the character set to use to perform the request - * @deprecated as of 2.25, please use {@link #setCharset(Charset)} - */ - @Deprecated - public void setCharset(final String charsetName) { - charset_ = Charset.forName(charsetName); - } - - /** - * Sets the character set to use to perform the request. The default value - * is {@link java.nio.charset.StandardCharsets#ISO_8859_1}. * @param charset the character set to use to perform the request */ public void setCharset(final Charset charset) { Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/WebResponse.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/WebResponse.java 2017-07-20 10:07:12 UTC (rev 14677) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/WebResponse.java 2017-07-20 10:22:26 UTC (rev 14678) @@ -201,48 +201,6 @@ } /** - * Returns the response content as a string, using the specified charset/encoding, - * rather than the charset/encoding specified in the server response. If the specified - * charset/encoding is not supported then the default system encoding is used. - * @param encoding the charset/encoding to use to convert the response content into a string - * @return the response content as a string or null if the content retrieval was failing - * @deprecated as of 2.25, please use {@link #getContentAsString(Charset)} instead - */ - @Deprecated - public String getContentAsString(final String encoding) { - return getContentAsString(encoding, null); - } - - /** - * Returns the response content as a string, using the specified charset/encoding, - * rather than the charset/encoding specified in the server response. If the specified - * charset/encoding is not supported then the provided default encoding is used. - * @param encoding the charset/encoding to use to convert the response content into a string - * @param defaultEncoding the default encoding to use if the specified {@code encode} is not supported - * @return the response content as a string or null if the content retrieval was failing - * @deprecated as of 2.25, please use {@link #getContentAsString(Charset)} instead - */ - @Deprecated - public String getContentAsString(final String encoding, final String defaultEncoding) { - Charset charset; - // first verify the charset because we can't read the - // input stream twice - try { - charset = Charset.forName(encoding); - } - catch (final Exception e) { - if (encoding.equals(defaultEncoding)) { - LOG.warn(e); - return ""; - } - charset = defaultEncoding != null ? Charset.forName(defaultEncoding) : getContentCharset(); - LOG.warn("Attempted to use unsupported encoding '" - + encoding + "'; using default content charset ('" + charset + "')."); - } - return getContentAsString(charset); - } - - /** * Returns the response content as a string, using the specified charset, * rather than the charset/encoding specified in the server response. * If there is a bom header the charset parameter will be overwritten by the bom. Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlFileInput.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlFileInput.java 2017-07-20 10:07:12 UTC (rev 14677) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlFileInput.java 2017-07-20 10:22:26 UTC (rev 14678) @@ -21,7 +21,6 @@ import java.util.ArrayList; import java.util.List; import java.util.Map; -import java.util.stream.Stream; import org.apache.commons.lang3.StringUtils; @@ -149,21 +148,6 @@ } /** - * Used to specify <code>multiple</code> paths to upload. - * - * The current implementation splits the value based on '§'. - * We may follow WebDriver solution, once made, - * see https://code.google.com/p/selenium/issues/detail?id=2239 - * @param files the list of paths of the files to upload - * @deprecated as of 2.25, please use {@link #setFiles(File...)} instead - */ - @Deprecated - public void setValueAttribute(final String[] files) { - final File[] array = Stream.of(files).map(p -> new File(p)).toArray(File[]::new); - setFiles(array); - } - - /** * Used to specify {@code multiple} files to upload. * * We may follow WebDriver solution, once made, Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlImageInput.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlImageInput.java 2017-07-20 10:07:12 UTC (rev 14677) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlImageInput.java 2017-07-20 10:22:26 UTC (rev 14678) @@ -137,10 +137,7 @@ * @return the page that is loaded after the click has taken place * @exception IOException If an IO error occurs * @exception ElementNotFoundException If a particular XML element could not be found in the DOM model - * @deprecated as of 2.25, please use {@link #click()} */ - @Override - @Deprecated public <P extends Page> P click(final int x, final int y) throws IOException, ElementNotFoundException { wasPositionSpecified_ = true; xPosition_ = x; Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlInput.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlInput.java 2017-07-20 10:07:12 UTC (rev 14677) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlInput.java 2017-07-20 10:22:26 UTC (rev 14678) @@ -18,13 +18,11 @@ import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.EVENT_MOUSE_ON_DISABLED; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.HTMLINPUT_DOES_NOT_CLICK_SURROUNDING_ANCHOR; -import java.io.IOException; import java.util.Collection; import java.util.Collections; import java.util.HashSet; import java.util.Map; -import com.gargoylesoftware.htmlunit.ElementNotFoundException; import com.gargoylesoftware.htmlunit.Page; import com.gargoylesoftware.htmlunit.ScriptResult; import com.gargoylesoftware.htmlunit.SgmlPage; @@ -486,26 +484,6 @@ } /** - * Simulate clicking this input with a pointing device. The x and y coordinates - * of the pointing device will be sent to the server. - * - * @param <P> the page type - * @param x the x coordinate of the pointing device at the time of clicking - * @param y the y coordinate of the pointing device at the time of clicking - * @return the page that is loaded after the click has taken place - * @exception IOException If an IO error occurs - * @exception ElementNotFoundException If a particular XML element could not be found in the DOM model - * @deprecated as of 2.25, please use {@link #click()} - */ - @SuppressWarnings("unchecked") - @Deprecated - public <P extends Page> P click(final int x, final int y) - throws IOException, ElementNotFoundException { - // By default this is no different than a click without coordinates. - return (P) click(); - } - - /** * {@inheritDoc} */ @Override Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/util/WebResponseWrapper.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/util/WebResponseWrapper.java 2017-07-20 10:07:12 UTC (rev 14677) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/util/WebResponseWrapper.java 2017-07-20 10:22:26 UTC (rev 14678) @@ -69,25 +69,6 @@ /** * {@inheritDoc} - * The default behavior of this method is to return getContentAsString(String) on the wrapped webResponse object. - */ - @Override - @Deprecated - public String getContentAsString(final String encoding) { - return wrappedWebResponse_.getContentAsString(encoding); - } - - /** - * {@inheritDoc} - */ - @Override - @Deprecated - public String getContentAsString(final String encoding, final String defaultEncoding) { - return wrappedWebResponse_.getContentAsString(encoding, defaultEncoding); - } - - /** - * {@inheritDoc} * The default behavior of this method is to return getContentAsString(Charset) on the wrapped webResponse object. */ @Override Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/CacheTest.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/CacheTest.java 2017-07-20 10:07:12 UTC (rev 14677) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/CacheTest.java 2017-07-20 10:22:26 UTC (rev 14678) @@ -436,11 +436,6 @@ } @Override - public String getContentAsString(final String encoding) { - throw new RuntimeException("not implemented"); - } - - @Override public Charset getContentCharset() { throw new RuntimeException("not implemented"); } |