zzzk1 commented on code in PR #15276:
URL:
https://github.com/apache/dolphinscheduler/pull/15276#discussion_r1419855540
##########
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/FileUtils.java:
##########
@@ -325,41 +323,23 @@ public static String getFileChecksum(String pathName)
throws IOException {
return crcString;
}
- public static void setFileOwner(Path filePath, String fileOwner) throws
FileOperateException {
- try {
- // We use linux command to set the file owner, since jdk api will
not use sudo.
- String command = String.format("sudo chown %s %s", fileOwner,
filePath.toString());
- Runtime.getRuntime().exec(command);
- Process process = Runtime.getRuntime().exec(command);
- int exitCode = process.waitFor();
- if (0 != exitCode) {
- throw new FileOperateException(
- "Set file: " + filePath + " to owner: " + fileOwner +
" failed, existCode(" + exitCode + ")");
- }
- } catch (FileOperateException ex) {
- throw ex;
- } catch (Exception ex) {
- throw new FileOperateException("Set directory: " + filePath + " to
owner: " + fileOwner + " failed");
-
+ public static void setFileOwner(Path filePath, String fileOwner) throws
InterruptedException, IOException {
Review Comment:

sorry, i made a mess, i need to learn how to use git
##########
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/FileUtils.java:
##########
@@ -325,41 +323,23 @@ public static String getFileChecksum(String pathName)
throws IOException {
return crcString;
}
- public static void setFileOwner(Path filePath, String fileOwner) throws
FileOperateException {
- try {
- // We use linux command to set the file owner, since jdk api will
not use sudo.
- String command = String.format("sudo chown %s %s", fileOwner,
filePath.toString());
- Runtime.getRuntime().exec(command);
- Process process = Runtime.getRuntime().exec(command);
- int exitCode = process.waitFor();
- if (0 != exitCode) {
- throw new FileOperateException(
- "Set file: " + filePath + " to owner: " + fileOwner +
" failed, existCode(" + exitCode + ")");
- }
- } catch (FileOperateException ex) {
- throw ex;
- } catch (Exception ex) {
- throw new FileOperateException("Set directory: " + filePath + " to
owner: " + fileOwner + " failed");
-
+ public static void setFileOwner(Path filePath, String fileOwner) throws
InterruptedException, IOException {
Review Comment:

sorry, i made a mess, i need to learn how to use git
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]