Fix sonar issue

This commit is contained in:
Kai Zimmermann
2016-02-02 10:19:37 +01:00
parent 4df411b97f
commit bc46bac2ac

View File

@@ -207,16 +207,26 @@ public class BulkUploadHandler extends CustomComponent
@Override @Override
public void run() { public void run() {
long innerCounter = 0;
String line;
if (tempFile == null) { if (tempFile == null) {
return; return;
} }
try (InputStream tempStream = new FileInputStream(tempFile)) { try (InputStream tempStream = new FileInputStream(tempFile)) {
readFileStream(tempStream);
} catch (final FileNotFoundException e) {
LOG.error("Temporary file not found with name {}", tempFile.getName(), e);
} catch (final IOException e) {
LOG.error("Error while opening temorary file ", e);
}
}
private void readFileStream(final InputStream tempStream) {
String line;
try (BufferedReader reader = new BufferedReader( try (BufferedReader reader = new BufferedReader(
new InputStreamReader(tempStream, Charset.defaultCharset()))) { new InputStreamReader(tempStream, Charset.defaultCharset()))) {
LOG.info("Bulk file upload started"); LOG.info("Bulk file upload started");
long innerCounter = 0;
final double totalFileSize = getTotalNumberOfLines(); final double totalFileSize = getTotalNumberOfLines();
/** /**
@@ -240,12 +250,6 @@ public class BulkUploadHandler extends CustomComponent
resetCounts(); resetCounts();
deleteFile(); deleteFile();
} }
} catch (final FileNotFoundException e) {
LOG.error("Temporary file not found with name {}", tempFile.getName(), e);
} catch (final IOException e) {
LOG.error("Error while opening temorary file ", e);
}
} }
private void doAssignments() { private void doAssignments() {