Acceptance-tests: Don't assume UTF-8 system wide encoding
Change-Id: I9a166277a7f8a711ad9b6301600bee3e1d6e9093
This commit is contained in:
parent
f059d55920
commit
241b7b343e
@ -46,8 +46,10 @@ import org.eclipse.jgit.util.FS;
|
||||
|
||||
import java.io.BufferedWriter;
|
||||
import java.io.File;
|
||||
import java.io.FileWriter;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStreamWriter;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.List;
|
||||
import java.util.Properties;
|
||||
|
||||
@ -128,8 +130,9 @@ public class GitUtil {
|
||||
if (!p.exists() && !p.mkdirs()) {
|
||||
throw new IOException("failed to create dir: " + p.getAbsolutePath());
|
||||
}
|
||||
FileWriter w = new FileWriter(f);
|
||||
BufferedWriter out = new BufferedWriter(w);
|
||||
FileOutputStream s = new FileOutputStream(f);
|
||||
BufferedWriter out = new BufferedWriter(
|
||||
new OutputStreamWriter(s, StandardCharsets.UTF_8));
|
||||
try {
|
||||
out.write(content);
|
||||
} finally {
|
||||
|
@ -72,6 +72,7 @@ import org.junit.Test;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.atomic.AtomicLong;
|
||||
@ -656,21 +657,21 @@ public class ChangeEditIT extends AbstractDaemonTest {
|
||||
private String newChange(Git git, PersonIdent ident) throws Exception {
|
||||
PushOneCommit push =
|
||||
pushFactory.create(db, ident, PushOneCommit.SUBJECT, FILE_NAME,
|
||||
new String(CONTENT_OLD));
|
||||
new String(CONTENT_OLD, StandardCharsets.UTF_8));
|
||||
return push.to(git, "refs/for/master").getChangeId();
|
||||
}
|
||||
|
||||
private String amendChange(Git git, PersonIdent ident, String changeId) throws Exception {
|
||||
PushOneCommit push =
|
||||
pushFactory.create(db, ident, PushOneCommit.SUBJECT, FILE_NAME2,
|
||||
new String(CONTENT_NEW2), changeId);
|
||||
new String(CONTENT_NEW2, StandardCharsets.UTF_8), changeId);
|
||||
return push.to(git, "refs/for/master").getChangeId();
|
||||
}
|
||||
|
||||
private String newChange2(Git git, PersonIdent ident) throws Exception {
|
||||
PushOneCommit push =
|
||||
pushFactory.create(db, ident, PushOneCommit.SUBJECT, FILE_NAME,
|
||||
new String(CONTENT_OLD));
|
||||
new String(CONTENT_OLD, StandardCharsets.UTF_8));
|
||||
return push.rm(git, "refs/for/master").getChangeId();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user