Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -122,13 +122,14 @@ public String getScript() {
if(os == OsType.ZOS) {
Charset zOSSystemEncodingCharset = Charset.forName(ws.act(new getIBMzOsEncoding()));
if(SYSTEM_DEFAULT_CHARSET.equals(getCharset())) {
// Setting default charset to IBM z/OS default EBCDIC charset on z/OS if no encoding specified on sh step
charset(zOSSystemEncodingCharset);
// Setting default charset to IBM z/OS default EBCDIC charset on z/OS if no encoding specified on sh step
charset(zOSSystemEncodingCharset);
}
scriptEncodingCharset = zOSSystemEncodingCharset != null ? zOSSystemEncodingCharset.name() : scriptEncodingCharset;
scriptEncodingCharset = zOSSystemEncodingCharset.name();
}

ShellController c = new ShellController(ws);
c.isZos = (os == OsType.ZOS);
FilePath shf = c.getScriptFile(ws);

shf.write(script, scriptEncodingCharset);
Expand Down Expand Up @@ -214,6 +215,9 @@ public String getScript() {
/** Last-observed modification time of {@link getLogFile} on remote computer, in milliseconds. */
private transient long checkedTimestamp;

/** Caching zOS flag to avoid round trip calls in exitStatus() */
private boolean isZos;

private ShellController(FilePath ws) throws IOException, InterruptedException {
super(ws);
}
Expand All @@ -228,9 +232,8 @@ private FilePath pidFile(FilePath ws) throws IOException, InterruptedException {
}

@Override protected Integer exitStatus(FilePath workspace, TaskListener listener) throws IOException, InterruptedException {
Integer status = null;
OsType os = workspace.act(new getOsType());
if(os == OsType.ZOS) {
Integer status;
if(isZos) {
// We need to transcode status file from EBCDIC only on z/OS platform
FilePath statusFile = getResultFile(workspace);
status = statusFile.act(new StatusCheckWithEncoding(getCharset()));
Expand Down Expand Up @@ -323,7 +326,7 @@ static class StatusCheckWithEncoding extends MasterToSlaveFileCallable<Integer>
public Integer invoke(File f, VirtualChannel channel) throws IOException, InterruptedException {
if (f.exists() && f.length() > 0) {
try {
String fileString = Files.readFirstLine(f, Charset.forName(charset) != null ? Charset.forName(charset) : Charset.defaultCharset());
String fileString = Files.readFirstLine(f, Charset.forName(charset));
if (fileString == null || fileString.isEmpty()) {
return null;
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ protected FileMonitoringController launchWithCookie(FilePath workspace, Launcher
charset = SYSTEM_DEFAULT_CHARSET;
}

@CheckForNull public final String getCharset()
@CheckForNull final String getCharset()
{
return charset;
}
Expand Down Expand Up @@ -166,7 +166,7 @@ protected static class FileMonitoringController extends Controller { // TODO imp
/** @see FileMonitoringTask#charset */
private @CheckForNull String charset;

protected String getCharset() {
String getCharset() {
return charset;
}

Expand Down