Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use less deprecated methods #827

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/main/java/org/htmlunit/WebResponseData.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
* @author Daniel Gredler
* @author Ahmed Ashour
* @author Ronald Brill
* @author Sven Strickroth
*/
public class WebResponseData implements Serializable {
private static final Log LOG = LogFactory.getLog(WebResponseData.class);
Expand Down Expand Up @@ -123,7 +124,7 @@ private InputStream getStream(final ByteOrderMark... bomHeaders) throws IOExcept
+ "</html>", ISO_8859_1);
}
if (stream != null && bomHeaders != null) {
stream = new BOMInputStream(stream, bomHeaders);
stream = BOMInputStream.builder().setInputStream(stream).setByteOrderMarks(bomHeaders).get();
}
return stream;
}
Expand Down Expand Up @@ -168,7 +169,7 @@ private InputStream getStream(final ByteOrderMark... bomHeaders) throws IOExcept
}

if (stream != null && bomHeaders != null) {
stream = new BOMInputStream(stream, bomHeaders);
stream = BOMInputStream.builder().setInputStream(stream).setByteOrderMarks(bomHeaders).get();
}
return stream;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
*
* @author Ahmed Ashour
* @author Ronald Brill
* @author Sven Strickroth
*/
@JsxClass(value = {CHROME, EDGE}, className = "v8BreakIterator")
public class V8BreakIterator extends HtmlUnitScriptable {
Expand All @@ -58,16 +59,16 @@ public class V8BreakIterator extends HtmlUnitScriptable {
@JsxConstructor
public static Scriptable jsConstructor(final Context cx, final Scriptable scope,
final Object[] args, final Function ctorObj, final boolean inNewExpr) {
Locale locale = new Locale("en", "US");
Locale locale = new Locale.Builder().setLanguage("en").setRegion("US").build();
if (args.length != 0) {
final Object locales = args[0];
if (locales instanceof NativeArray) {
if (((NativeArray) locales).getLength() != 0) {
locale = new Locale(((NativeArray) locales).get(0).toString());
locale = new Locale.Builder().setLanguage(((NativeArray) locales).get(0).toString()).build();
}
}
else if (locales instanceof String) {
locale = new Locale(locales.toString());
locale = new Locale.Builder().setLanguage(locales.toString()).build();
}
else if (!JavaScriptEngine.isUndefined(locales)) {
throw JavaScriptEngine.throwAsScriptRuntimeEx(
Expand Down