Skip to content

Commit 33493fa

Browse files
committed
charset cannot be null
1 parent 747227d commit 33493fa

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

  • sources/net.sf.j2s.java.core/src/javajs/util

sources/net.sf.j2s.java.core/src/javajs/util/Rdr.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ public static Map<String, Object> readCifData(GenericCifDataParser parser, Buffe
107107
* Read a UTF-8 byte array fully, converting it to a String.
108108
* Called by Jmol's XMLReaders
109109
*
110-
* @param bis
110+
* @param bytes
111111
* @return a UTF-8 string
112112
*/
113113
public static String bytesToUTF8String(byte[] bytes) {
@@ -154,7 +154,7 @@ public static BufferedReader getBufferedReader(BufferedInputStream bis, String c
154154
* This method is specifically for strings that are marked for UTF 8 or 16.
155155
*
156156
* @param bytes
157-
* @return
157+
* @return UTF-decoded bytes
158158
*/
159159
public static String fixUTF(byte[] bytes) {
160160
Encoding encoding = getUTFEncoding(bytes);
@@ -596,7 +596,9 @@ public static String getZipRoot(String fileName) {
596596

597597
public static BufferedWriter getBufferedWriter(OutputStream os, String charSetName) {
598598
OutputStreamWriter osw = (OutputStreamWriter) Interface.getInstanceWithParams("java.io.OutputStreamWriter",
599-
new Class<?>[] { java.io.OutputStream.class, String.class }, new Object[] {os, charSetName});
599+
new Class<?>[] { java.io.OutputStream.class, String.class },
600+
new Object[] { os, charSetName == null ? "UTF-8" : charSetName }
601+
);
600602
/**
601603
* @j2sNative
602604
* return osw.getBufferedWriter();

0 commit comments

Comments
 (0)