18
18
import java .io .IOException ;
19
19
import java .io .InputStream ;
20
20
import java .io .InputStreamReader ;
21
+ import java .io .Reader ;
21
22
import java .io .StringReader ;
23
+ import java .nio .charset .Charset ;
22
24
import java .util .Set ;
23
25
import java .util .TreeSet ;
24
26
@@ -3407,7 +3409,8 @@ private void realWorld(final String resourceName, final int rules, final int pro
3407
3409
public void unicodeInputByteStream () throws Exception {
3408
3410
final String css = "h1:before { content: \" \u04c5 - \u0666 \" }" ;
3409
3411
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 );
3411
3414
final CSSStyleSheetImpl sheet = parse (source , 0 , 0 , 0 );
3412
3415
3413
3416
Assert .assertEquals (css , sheet .toString ());
@@ -3422,8 +3425,8 @@ public void unicodeInputByteStream() throws Exception {
3422
3425
public void unicodeInputByteStreamDefaultEncoding () throws Exception {
3423
3426
final String css = "h1:before { content: \" \u00fe - \u00e4 \" }" ;
3424
3427
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 );
3427
3430
final CSSStyleSheetImpl sheet = parse (source , 0 , 0 , 0 );
3428
3431
3429
3432
Assert .assertEquals (css , sheet .toString ());
@@ -3436,7 +3439,8 @@ public void unicodeInputByteStreamDefaultEncoding() throws Exception {
3436
3439
public void clip () throws Exception {
3437
3440
final String css = "h1 { clip: rect(0px 0px 1px 1px); }" ;
3438
3441
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 );
3440
3444
final CSSStyleSheetImpl sheet = parse (source , 0 , 0 , 0 );
3441
3445
3442
3446
Assert .assertEquals ("h1 { clip: rect(0px, 0px, 1px, 1px) }" , sheet .toString ());
0 commit comments