From 35f6b53e7913238410ff77cbf8d6d561ea6df3d4 Mon Sep 17 00:00:00 2001 From: Greg Wilkins Date: Wed, 30 Mar 2011 04:55:30 +0000 Subject: [PATCH] fixed test to handle different default encodings git-svn-id: svn+ssh://dev.eclipse.org/svnroot/rt/org.eclipse.jetty/jetty/trunk@2928 7e9141cc-0065-0410-87d8-b60c137991c4 --- .../java/org/eclipse/jetty/server/HttpWriterTest.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/jetty-server/src/test/java/org/eclipse/jetty/server/HttpWriterTest.java b/jetty-server/src/test/java/org/eclipse/jetty/server/HttpWriterTest.java index 7afa5bea7f2..1ce59de1019 100644 --- a/jetty-server/src/test/java/org/eclipse/jetty/server/HttpWriterTest.java +++ b/jetty-server/src/test/java/org/eclipse/jetty/server/HttpWriterTest.java @@ -14,6 +14,7 @@ import org.eclipse.jetty.io.ByteArrayBuffer; import org.eclipse.jetty.io.ByteArrayEndPoint; import org.eclipse.jetty.io.SimpleBuffers; import org.eclipse.jetty.util.StringUtil; +import org.eclipse.jetty.util.TypeUtil; import org.junit.Before; import org.junit.Test; @@ -239,13 +240,11 @@ public class HttpWriterTest } String source = sb.toString(); - byte[] bytes = source.getBytes("UTF-8"/* StringUtil.__UTF81 */); + byte[] bytes = source.getBytes(StringUtil.__UTF8); _writer.write(source.toCharArray(),0,source.toCharArray().length); - java.io.ByteArrayOutputStream baos = new -java.io.ByteArrayOutputStream(); - java.io.OutputStreamWriter osw = new java.io.OutputStreamWriter(baos/* -,StringUtil.__UTF8 */); + java.io.ByteArrayOutputStream baos = new java.io.ByteArrayOutputStream(); + java.io.OutputStreamWriter osw = new java.io.OutputStreamWriter(baos,StringUtil.__UTF8); osw.write(source.toCharArray(),0,source.toCharArray().length); osw.flush(); @@ -254,6 +253,8 @@ java.io.ByteArrayOutputStream(); myReportBytes(_bytes.asArray()); assertArrayEquals(bytes,_bytes.asArray()); + System.err.println(TypeUtil.toHexString(baos.toByteArray())); + System.err.println(TypeUtil.toHexString(_bytes.asArray())); assertArrayEquals(baos.toByteArray(),_bytes.asArray()); }