1818import java .io .IOException ;
1919import java .io .InputStream ;
2020import java .io .InputStreamReader ;
21+ import java .io .Reader ;
2122import java .io .StringReader ;
23+ import java .nio .charset .Charset ;
2224import java .util .Set ;
2325import java .util .TreeSet ;
2426
@@ -3407,7 +3409,8 @@ private void realWorld(final String resourceName, final int rules, final int pro
34073409 public void unicodeInputByteStream () throws Exception {
34083410 final String css = "h1:before { content: \" \u04c5 - \u0666 \" }" ;
34093411
3410- final InputSource source = new InputSource (new ByteArrayInputStream (css .getBytes ("UTF-8" )), "UTF-8" );
3412+ final Reader reader = new InputStreamReader (new ByteArrayInputStream (css .getBytes ("UTF-8" )), "UTF-8" );
3413+ final InputSource source = new InputSource (reader );
34113414 final CSSStyleSheetImpl sheet = parse (source , 0 , 0 , 0 );
34123415
34133416 Assert .assertEquals (css , sheet .toString ());
@@ -3422,8 +3425,8 @@ public void unicodeInputByteStream() throws Exception {
34223425 public void unicodeInputByteStreamDefaultEncoding () throws Exception {
34233426 final String css = "h1:before { content: \" \u00fe - \u00e4 \" }" ;
34243427
3425- final InputSource source = new InputSource (new ByteArrayInputStream (css .getBytes ()), null );
3426-
3428+ final Reader reader = new InputStreamReader (new ByteArrayInputStream (css .getBytes ()), Charset . defaultCharset () );
3429+ final InputSource source = new InputSource ( reader );
34273430 final CSSStyleSheetImpl sheet = parse (source , 0 , 0 , 0 );
34283431
34293432 Assert .assertEquals (css , sheet .toString ());
@@ -3436,7 +3439,8 @@ public void unicodeInputByteStreamDefaultEncoding() throws Exception {
34363439 public void clip () throws Exception {
34373440 final String css = "h1 { clip: rect(0px 0px 1px 1px); }" ;
34383441
3439- final InputSource source = new InputSource (new ByteArrayInputStream (css .getBytes ()), null );
3442+ final Reader reader = new InputStreamReader (new ByteArrayInputStream (css .getBytes ()), Charset .defaultCharset ());
3443+ final InputSource source = new InputSource (reader );
34403444 final CSSStyleSheetImpl sheet = parse (source , 0 , 0 , 0 );
34413445
34423446 Assert .assertEquals ("h1 { clip: rect(0px, 0px, 1px, 1px) }" , sheet .toString ());
0 commit comments