4792 more string builder codacy adjustments

This commit is contained in:
William Schaefer 2019-04-11 17:12:16 -04:00
parent 6c45e32909
commit 1adb0cf1e4
3 changed files with 7 additions and 6 deletions

View File

@ -302,8 +302,8 @@ public class DataContentViewerOtherCases extends JPanel implements DataContentVi
private void writeOtherOccurrencesToFileAsCSV(File destFile) {
try (BufferedWriter writer = Files.newBufferedWriter(destFile.toPath())) {
//write headers
StringBuilder headers = new StringBuilder("");
headers.append('"').append(Bundle.DataContentViewerOtherCasesModel_csvHeader_case())
StringBuilder headers = new StringBuilder("\"");
headers.append(Bundle.DataContentViewerOtherCasesModel_csvHeader_case())
.append("\",\"").append(Bundle.DataContentViewerOtherCasesModel_csvHeader_dataSource())
.append("\",\"").append(Bundle.DataContentViewerOtherCasesModel_csvHeader_attribute())
.append("\",\"").append(Bundle.DataContentViewerOtherCasesModel_csvHeader_value())
@ -1097,7 +1097,7 @@ public class DataContentViewerOtherCases extends JPanel implements DataContentVi
if (EamDb.isEnabled() && filesTable.getSelectedRowCount() == 1) {
int rowIndex = filesTable.getSelectedRow();
List<OtherOccurrenceNodeData> selectedFile = filesTableModel.getListOfNodesForFile(rowIndex);
if (selectedFile.get(0) instanceof OtherOccurrenceNodeInstanceData) {
if (!selectedFile.isEmpty() && selectedFile.get(0) instanceof OtherOccurrenceNodeInstanceData) {
OtherOccurrenceNodeInstanceData instanceData = (OtherOccurrenceNodeInstanceData) selectedFile.get(0);
enableCentralRepoActions = instanceData.isCentralRepoNode();
}

View File

@ -239,8 +239,8 @@ class OtherOccurrenceNodeInstanceData implements OtherOccurrenceNodeData {
* @return a comma separated string representation of the node's data
*/
String toCsvString() {
StringBuilder line = new StringBuilder("");
line.append('"').append(getCaseName()).append("\",\"")
StringBuilder line = new StringBuilder("\"");
line.append(getCaseName()).append("\",\"")
.append(getDataSourceName()).append("\",\"")
.append(getType()).append("\",\"")
.append(getValue()).append("\",\"")

View File

@ -62,9 +62,10 @@ public class OtherOccurrencesFilesTableModel extends AbstractTableModel {
@Override
public Object getValueAt(int rowIdx, int colIdx) {
if (nodeKeys.isEmpty()) {
if (nodeKeys.isEmpty() || nodeMap.get(nodeKeys.get(rowIdx)).isEmpty()) {
return Bundle.OtherOccurrencesFilesTableModel_noData();
}
return FilenameUtils.getName(((OtherOccurrenceNodeInstanceData) nodeMap.get(nodeKeys.get(rowIdx)).get(0)).getFilePath());
}