Skip to content

Commit 87f83ff

Browse files
2b3c5112b3c511
authored andcommitted
Description add the file name when importing file exception (#15237)
* description add the file name when importing file exception * description add the file name when importing file exception * description add the file name when importing file exception --------- Co-authored-by: 2b3c511 <rong.li@timecho.com> (cherry picked from commit 4350a56)
1 parent 944d85a commit 87f83ff

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

iotdb-client/cli/src/main/java/org/apache/iotdb/tool/data/AbstractImportData.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,18 +44,19 @@ public abstract void init()
4444

4545
@Override
4646
public void run() {
47-
String filePath;
47+
String filePath = "";
48+
File file = null;
4849
try {
4950
if (Constants.TSFILE_SUFFIXS.equalsIgnoreCase(fileType)) {
5051
while ((filePath = ImportTsFileScanTool.pollFromQueue()) != null) {
51-
File file = new File(filePath);
52+
file = new File(filePath);
5253
if (file.getName().endsWith(Constants.TSFILE_SUFFIXS)) {
5354
importFromTsFile(file);
5455
}
5556
}
5657
} else {
5758
while ((filePath = ImportDataScanTool.pollFromQueue()) != null) {
58-
File file = new File(filePath);
59+
file = new File(filePath);
5960
if (file.getName().endsWith(Constants.SQL_SUFFIXS)) {
6061
importFromSqlFile(file);
6162
} else {
@@ -64,7 +65,8 @@ public void run() {
6465
}
6566
}
6667
} catch (Exception e) {
67-
ioTPrinter.println("Unexpected error occurred: " + e.getMessage());
68+
ioTPrinter.println(
69+
String.format("[%s] - Unexpected error occurred: %s", file.getName(), e.getMessage()));
6870
}
6971
}
7072

0 commit comments

Comments
 (0)