liuruiyiyang commented on a change in pull request #38: Fix sonar by Yanzhe An
URL: https://github.com/apache/incubator-iotdb/pull/38#discussion_r253023921
##########
File path: iotdb-cli/src/main/java/org/apache/iotdb/cli/tool/ExportCsv.java
##########
@@ -240,19 +245,19 @@ private static void dumpFromSqlFile(String filePath)
throws IOException {
*/
private static void dumpResult(String sql, int index)
throws SQLException {
- BufferedWriter writer = null;
+ FileWriter fw = null;
+ BufferedWriter bw = null;
final String path = targetDirectory + DUMP_FILE_NAME + index + ".csv";
try {
File tf = new File(path);
- if (!tf.exists()) {
- if (!tf.createNewFile()) {
- System.out.println("[ERROR] Could not create target file for sql
statement: " + sql);
+ if (!tf.exists() && !tf.createNewFile()) {
+ LOGGER.error("[ERROR] Could not create target file for sql
statement: " + sql);
Review comment:
format specifier should be used instead of string concatenation, compliant
solution:
LOGGER.error("[ERROR] Could not create target file for sql statement: {}",
sql);
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services