Skip to content
Open
Show file tree
Hide file tree
Changes from all 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 @@ -128,6 +128,7 @@ private static String[] getWebsocketUrls(Config cfg) {
if (cfg.hasPath(oldKey)) {
String[] as = getCSV(cfg.getString(oldKey));
if (as != null) {
log.warn("'{}' is deprecated, use 'server.websocketUrl' instead", oldKey);
return as;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,9 @@ public class RunnerJobExecutor implements JobExecutor {

private static final Logger log = LoggerFactory.getLogger(RunnerJobExecutor.class);

private static final int PERSIST_DIR_MODE = 0755;
private static final int PERSIST_FILE_MODE = 0644;

protected final DependencyManager dependencyManager;

private final RunnerJobExecutorConfiguration cfg;
Expand Down Expand Up @@ -252,9 +255,9 @@ private void persistWorkDir(UUID instanceId, Path src) {
walk.forEach(f -> {
try {
if (Files.isDirectory(f)) {
Files.setPosixFilePermissions(f, Posix.posix(0755));
Files.setPosixFilePermissions(f, Posix.posix(PERSIST_DIR_MODE));
} else if (Files.isRegularFile(f)) {
Files.setPosixFilePermissions(f, Posix.posix(0644));
Files.setPosixFilePermissions(f, Posix.posix(PERSIST_FILE_MODE));
}
} catch (IOException e) {
log.warn("persistWorkDir -> can't update permissions for {}: {}", f, e.getMessage());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public static <T> T withRetry(int retryCount, long retryInterval, Callable<T> c,
tryCount++;
}
if (exception == null) {
return null; // TODO: throw exception?
throw new InterruptedException("Retry interrupted");
}
throw exception;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.Arrays;
Expand Down Expand Up @@ -59,7 +60,7 @@ public ResourceTaskCommon(Path workDir, FileService fileService, Evaluator evalu

public String asString(String path) throws IOException {
byte[] ab = Files.readAllBytes(normalizePath(path));
return new String(ab);
return new String(ab, StandardCharsets.UTF_8);
}

public Object asJson(String path) throws IOException {
Expand Down Expand Up @@ -159,13 +160,13 @@ public String writeAsJson(Object content, String path) throws IOException {

public String writeAsString(String content) throws IOException {
Path tmpFile = fileService.createTempFile(RESOURCE_PREFIX, TEXT_FILE_SUFFIX);
Files.write(tmpFile, content.getBytes());
Files.write(tmpFile, content.getBytes(StandardCharsets.UTF_8));
return workDir.relativize(tmpFile.toAbsolutePath()).toString();
}

public String writeAsString(String content, String path) throws IOException {
Path dst = assertWorkDirPath(path);
Files.write(dst, content.getBytes());
Files.write(dst, content.getBytes(StandardCharsets.UTF_8));
return workDir.relativize(dst.toAbsolutePath()).toString();
}

Expand Down