Skip to content

Commit 6565e02

Browse files
authored
Use less deprecated methods
Use less deprecated methods
2 parents 848a3d2 + d6cae0b commit 6565e02

2 files changed

Lines changed: 7 additions & 5 deletions

File tree

src/main/java/org/htmlunit/WebResponseData.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
* @author Daniel Gredler
4444
* @author Ahmed Ashour
4545
* @author Ronald Brill
46+
* @author Sven Strickroth
4647
*/
4748
public class WebResponseData implements Serializable {
4849
private static final Log LOG = LogFactory.getLog(WebResponseData.class);
@@ -124,7 +125,7 @@ private InputStream getStream(final ByteOrderMark... bomHeaders) throws IOExcept
124125
</html>""", ISO_8859_1);
125126
}
126127
if (stream != null && bomHeaders != null) {
127-
stream = new BOMInputStream(stream, bomHeaders);
128+
stream = BOMInputStream.builder().setInputStream(stream).setByteOrderMarks(bomHeaders).get();
128129
}
129130
return stream;
130131
}
@@ -170,7 +171,7 @@ private InputStream getStream(final ByteOrderMark... bomHeaders) throws IOExcept
170171
}
171172

172173
if (stream != null && bomHeaders != null) {
173-
stream = new BOMInputStream(stream, bomHeaders);
174+
stream = BOMInputStream.builder().setInputStream(stream).setByteOrderMarks(bomHeaders).get();
174175
}
175176
return stream;
176177
}

src/main/java/org/htmlunit/javascript/host/intl/V8BreakIterator.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
*
3939
* @author Ahmed Ashour
4040
* @author Ronald Brill
41+
* @author Sven Strickroth
4142
*/
4243
@JsxClass(value = {CHROME, EDGE}, className = "v8BreakIterator")
4344
public class V8BreakIterator extends HtmlUnitScriptable {
@@ -58,16 +59,16 @@ public class V8BreakIterator extends HtmlUnitScriptable {
5859
@JsxConstructor
5960
public static Scriptable jsConstructor(final Context cx, final Scriptable scope,
6061
final Object[] args, final Function ctorObj, final boolean inNewExpr) {
61-
Locale locale = new Locale("en", "US");
62+
Locale locale = new Locale.Builder().setLanguage("en").setRegion("US").build();
6263
if (args.length != 0) {
6364
final Object locales = args[0];
6465
if (locales instanceof NativeArray array) {
6566
if (array.getLength() != 0) {
66-
locale = new Locale(array.get(0).toString());
67+
locale = new Locale.Builder().setLanguage(array.get(0).toString()).build();
6768
}
6869
}
6970
else if (locales instanceof String) {
70-
locale = new Locale(locales.toString());
71+
locale = new Locale.Builder().setLanguage(locales.toString()).build();
7172
}
7273
else if (!JavaScriptEngine.isUndefined(locales)) {
7374
throw JavaScriptEngine.throwAsScriptRuntimeEx(

0 commit comments

Comments
 (0)