提交 9441d4c6 authored 作者: Stefan Bodewig's avatar Stefan Bodewig

honor quiet in ChangeFileEncryption progress logging

上级 979ad281
...@@ -186,15 +186,15 @@ public class ChangeFileEncryption extends Tool { ...@@ -186,15 +186,15 @@ public class ChangeFileEncryption extends Tool {
for (String fileName : files) { for (String fileName : files) {
// don't process a lob directory, just the files in the directory. // don't process a lob directory, just the files in the directory.
if (!FileUtils.isDirectory(fileName)) { if (!FileUtils.isDirectory(fileName)) {
change.process(fileName); change.process(fileName, quiet);
} }
} }
} }
private void process(String fileName) { private void process(String fileName, boolean quiet) {
if (fileName.endsWith(Constants.SUFFIX_MV_FILE)) { if (fileName.endsWith(Constants.SUFFIX_MV_FILE)) {
try { try {
copy(fileName); copy(fileName, quiet);
} catch (IOException e) { } catch (IOException e) {
throw DbException.convertIOException(e, throw DbException.convertIOException(e,
"Error encrypting / decrypting file " + fileName); "Error encrypting / decrypting file " + fileName);
...@@ -209,13 +209,13 @@ public class ChangeFileEncryption extends Tool { ...@@ -209,13 +209,13 @@ public class ChangeFileEncryption extends Tool {
} }
try { try {
in.init(); in.init();
copy(fileName, in, encrypt); copy(fileName, in, encrypt, quiet);
} finally { } finally {
in.closeSilently(); in.closeSilently();
} }
} }
private void copy(String fileName) throws IOException { private void copy(String fileName, boolean quiet) throws IOException {
if (FileUtils.isDirectory(fileName)) { if (FileUtils.isDirectory(fileName)) {
return; return;
} }
...@@ -238,7 +238,7 @@ public class ChangeFileEncryption extends Tool { ...@@ -238,7 +238,7 @@ public class ChangeFileEncryption extends Tool {
long total = remaining; long total = remaining;
long time = System.currentTimeMillis(); long time = System.currentTimeMillis();
while (remaining > 0) { while (remaining > 0) {
if (System.currentTimeMillis() - time > 1000) { if (!quiet && System.currentTimeMillis() - time > 1000) {
out.println(fileName + ": " + (100 - 100 * remaining / total) + "%"); out.println(fileName + ": " + (100 - 100 * remaining / total) + "%");
time = System.currentTimeMillis(); time = System.currentTimeMillis();
} }
...@@ -259,7 +259,7 @@ public class ChangeFileEncryption extends Tool { ...@@ -259,7 +259,7 @@ public class ChangeFileEncryption extends Tool {
FileUtils.move(temp, fileName); FileUtils.move(temp, fileName);
} }
private void copy(String fileName, FileStore in, byte[] key) { private void copy(String fileName, FileStore in, byte[] key, boolean quiet) {
if (FileUtils.isDirectory(fileName)) { if (FileUtils.isDirectory(fileName)) {
return; return;
} }
...@@ -279,7 +279,7 @@ public class ChangeFileEncryption extends Tool { ...@@ -279,7 +279,7 @@ public class ChangeFileEncryption extends Tool {
fileOut.seek(FileStore.HEADER_LENGTH); fileOut.seek(FileStore.HEADER_LENGTH);
long time = System.currentTimeMillis(); long time = System.currentTimeMillis();
while (remaining > 0) { while (remaining > 0) {
if (System.currentTimeMillis() - time > 1000) { if (!quiet && System.currentTimeMillis() - time > 1000) {
out.println(fileName + ": " + (100 - 100 * remaining / total) + "%"); out.println(fileName + ": " + (100 - 100 * remaining / total) + "%");
time = System.currentTimeMillis(); time = System.currentTimeMillis();
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论