8085948: [Regression] Few Swing, AWT and 2D case fails with Decoder isn't implemented for WingDings Charset error on Windows

Reviewed-by: prr, serb
This commit is contained in:
Semyon Sadetsky 2015-07-21 08:34:01 +03:00
parent 5cea10f338
commit f38b5fcc14

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1996, 2014, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1996, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -24,8 +24,8 @@
*/ */
package sun.awt; package sun.awt;
import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream;
import java.io.InputStreamReader; import java.io.OutputStreamWriter;
import java.io.IOException;; import java.io.IOException;;
import java.nio.charset.Charset; import java.nio.charset.Charset;
import java.nio.charset.CharsetEncoder; import java.nio.charset.CharsetEncoder;
@ -54,10 +54,9 @@ public class FontDescriptor implements Cloneable {
// The following looks odd but its the only public way to get the // The following looks odd but its the only public way to get the
// historical name if one exists and the canonical name otherwise. // historical name if one exists and the canonical name otherwise.
try { try {
ByteArrayInputStream bais = new ByteArrayInputStream(new byte[8]); OutputStreamWriter osw = new OutputStreamWriter(new ByteArrayOutputStream(), cs);
InputStreamReader isr = new InputStreamReader(bais, cs); this.charsetName = osw.getEncoding();
this.charsetName = isr.getEncoding(); osw.close();
isr.close();
} catch (IOException ioe) { } catch (IOException ioe) {
} }
} }