Skip to content

Commit

Permalink
issue #29780: reintroduce fix for GVT failure by setting default loca…
Browse files Browse the repository at this point in the history
…le to utf8

the original fix was reverted due to failure in zos, fixed by adding guard code for zos
  • Loading branch information
NJ committed Oct 4, 2024
1 parent 989b00b commit 942089c
Showing 1 changed file with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
import java.io.BufferedInputStream;
import java.io.FileNotFoundException;
import java.io.InputStream;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
Expand Down Expand Up @@ -267,7 +269,14 @@ static LogSearchResult findStringsInFileCommon(List<String> regexpList,
totalSkipped += skipped;
}

UnbufferedInputStreamReader rawReader = new UnbufferedInputStreamReader(input, fileToSearch.getEncoding());
// UTF-8 by default so that GVT tests doesn't fail in non English locale
OperatingSystem os = fileToSearch.getMachine().getOperatingSystem();
Charset fileEncoding = StandardCharsets.UTF_8;
if (os == OperatingSystem.ZOS) {
fileEncoding = fileToSearch.getEncoding();
}

UnbufferedInputStreamReader rawReader = new UnbufferedInputStreamReader(input, fileEncoding);
reader = new LineReader(rawReader);

Log.finer(CLASS, method, "Now looking for strings " + regexpList
Expand Down

0 comments on commit 942089c

Please sign in to comment.