Skip to content

Commit

Permalink
[JBWS-4039] Fix code to not use default platform encoding
Browse files Browse the repository at this point in the history
  • Loading branch information
rsvoboda authored and asoldano committed Nov 22, 2016
1 parent 35352a2 commit ae985c8
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
Expand Up @@ -29,6 +29,7 @@
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
Expand Down Expand Up @@ -156,7 +157,7 @@ private void pingServer(URL url)
{
HttpURLConnection connection1 = (HttpURLConnection) url.openConnection();
StringBuilder sb = new StringBuilder();
BufferedReader br = new BufferedReader(new InputStreamReader(connection1.getInputStream()));
BufferedReader br = new BufferedReader(new InputStreamReader(connection1.getInputStream(), StandardCharsets.UTF_8));
String line;
while ((line = br.readLine()) != null) {
sb.append(line);
Expand Down Expand Up @@ -186,7 +187,7 @@ public void handleRequest(HttpServerExchange exchange) throws Exception
count.incrementAndGet();
exchange.setResponseCode(200);
OutputStream os = exchange.getOutputStream();
os.write("Hello".getBytes());
os.write("Hello".getBytes(StandardCharsets.UTF_8));
os.flush();

}
Expand Down
Expand Up @@ -27,7 +27,9 @@
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.nio.charset.StandardCharsets;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
Expand Down Expand Up @@ -190,7 +192,7 @@ private static AppclientProcess newAppclientProcess(final String archive, final
}

private static void printLogTrailer(OutputStream logOutputStreams, String appclientFullName) {
final PrintWriter pw = new PrintWriter(logOutputStreams);
final PrintWriter pw = new PrintWriter(new OutputStreamWriter(logOutputStreams, StandardCharsets.UTF_8));
pw.write("Starting appclient process: " + appclientFullName + "...\n");
pw.flush();
}
Expand Down
Expand Up @@ -30,6 +30,7 @@
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import java.nio.charset.StandardCharsets;

import javax.activation.DataHandler;
import javax.xml.transform.stream.StreamSource;
Expand Down Expand Up @@ -77,7 +78,7 @@ public static Image createTestImage(File imgFile)

public static StreamSource createTestSource()
{
return new StreamSource(new ByteArrayInputStream("<some><nestedXml/></some>".getBytes()));
return new StreamSource(new ByteArrayInputStream("<some><nestedXml/></some>".getBytes(StandardCharsets.UTF_8)));
}

public static DataHandler createDataHandler(File imgFile)
Expand Down

0 comments on commit ae985c8

Please sign in to comment.