Skip to content

Commit d6d8ea4

Browse files
authored
Merge pull request #3526 from ControlSystemStudio/CSSTUDIO-3406
Fix import of save&restore legacy csv
2 parents 975882b + e79d721 commit d6d8ea4

File tree

1 file changed

+11
-9
lines changed
  • app/save-and-restore/app/src/main/java/org/phoebus/applications/saveandrestore/filehandler/csv

1 file changed

+11
-9
lines changed

app/save-and-restore/app/src/main/java/org/phoebus/applications/saveandrestore/filehandler/csv/CSVParser.java

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -187,17 +187,19 @@ static public CSVParser parse(File csvFile) throws Exception {
187187

188188
csvParser.getTags().add(tag);
189189
}
190-
} else if (!line.startsWith(COMMENT_PREFIX) && csvParser.getColumnHeaders().isEmpty()) {
191-
csvParser.analyzeColumnHeader(line);
192-
} else {
193-
String[] columns = csvParser.split(line);
194-
195-
Map<String, String> entry = new HashMap<>();
196-
for (int index = 0; index < columns.length; index++) {
197-
entry.put(csvParser.getColumnHeaders().get(index), columns[index]);
190+
} else if (!line.startsWith(COMMENT_PREFIX)) {
191+
if(csvParser.getColumnHeaders().isEmpty()){
192+
csvParser.analyzeColumnHeader(line);
198193
}
194+
else {
195+
String[] columns = csvParser.split(line);
199196

200-
csvParser.getEntries().add(entry);
197+
Map<String, String> entry = new HashMap<>();
198+
for (int index = 0; index < columns.length; index++) {
199+
entry.put(csvParser.getColumnHeaders().get(index), columns[index]);
200+
}
201+
csvParser.getEntries().add(entry);
202+
}
201203
}
202204
}
203205

0 commit comments

Comments
 (0)