Merge pull request #18 from bsinno/fix-sonar-issues

ok 👍  Fix sonar issue in UI file read
This commit is contained in:
Michael Hirsch
2016-02-03 10:12:42 +01:00

View File

@@ -207,16 +207,26 @@ public class BulkUploadHandler extends CustomComponent
@Override
public void run() {
long innerCounter = 0;
String line;
if (tempFile == null) {
return;
}
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(
new InputStreamReader(tempStream, Charset.defaultCharset()))) {
LOG.info("Bulk file upload started");
long innerCounter = 0;
final double totalFileSize = getTotalNumberOfLines();
/**
@@ -240,12 +250,6 @@ public class BulkUploadHandler extends CustomComponent
resetCounts();
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() {