From 942089c82521b924b73a398498e48a3cc1828633 Mon Sep 17 00:00:00 2001 From: NJ Date: Fri, 4 Oct 2024 20:33:12 +0530 Subject: [PATCH] issue #29780: reintroduce fix for GVT failure by setting default locale to utf8 the original fix was reverted due to failure in zos, fixed by adding guard code for zos --- .../topology/impl/LibertyFileManager.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/dev/fattest.simplicity/src/componenttest/topology/impl/LibertyFileManager.java b/dev/fattest.simplicity/src/componenttest/topology/impl/LibertyFileManager.java index 2c17fcf0dac..fec9b7675c8 100644 --- a/dev/fattest.simplicity/src/componenttest/topology/impl/LibertyFileManager.java +++ b/dev/fattest.simplicity/src/componenttest/topology/impl/LibertyFileManager.java @@ -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; @@ -267,7 +269,14 @@ static LogSearchResult findStringsInFileCommon(List 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