Skip to content

Commit a0af970

Browse files
committed
Fixes issue #65. Always ignore empty strings for appendages.
1 parent f82d789 commit a0af970

File tree

1 file changed

+16
-9
lines changed
  • com.googlecode.cppcheclipse.core/src/com/googlecode/cppcheclipse/core

1 file changed

+16
-9
lines changed

com.googlecode.cppcheclipse.core/src/com/googlecode/cppcheclipse/core/Appendages.java

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
import com.google.common.base.Joiner;
1212
import com.google.common.base.Splitter;
13+
import com.google.common.base.Strings;
1314
import com.googlecode.cppcheclipse.core.utils.SerializeHelper;
1415

1516
public class Appendages implements TableModel<File> {
@@ -26,13 +27,18 @@ public Appendages(IPreferenceStore preferenceStore) {
2627
}
2728

2829
private void load() {
29-
Iterable<String> values = Splitter.on(DELIMITER).split(preferenceStore
30-
.getString(IPreferenceConstants.P_APPENDAGES));
30+
Iterable<String> values = Splitter
31+
.on(DELIMITER)
32+
.omitEmptyStrings()
33+
.split(preferenceStore
34+
.getString(IPreferenceConstants.P_APPENDAGES));
3135
for (String file : values) {
3236
try {
3337
files.add((File) SerializeHelper.fromString(file));
3438
} catch (Exception e) {
35-
CppcheclipsePlugin.logWarning("Error reading filename of appendage", e);
39+
CppcheclipsePlugin.logWarning(
40+
"Error reading filename of appendages. Stored appendage file '"
41+
+ file + "'", e);
3642
}
3743
}
3844
}
@@ -43,29 +49,30 @@ public void save() throws IOException {
4349
for (File file : files) {
4450
values.add(SerializeHelper.toString(file));
4551
}
46-
preferenceStore.setValue(IPreferenceConstants.P_APPENDAGES, Joiner.on(DELIMITER).join(values));
52+
preferenceStore.setValue(IPreferenceConstants.P_APPENDAGES,
53+
Joiner.on(DELIMITER).join(values));
4754
}
48-
55+
4956
public void removeAll() {
5057
files.clear();
5158
}
52-
59+
5360
public void add(File file) {
5461
files.add(file);
5562
}
56-
63+
5764
public void remove(File file) {
5865
files.remove(file);
5966
}
6067

6168
public Iterator<File> iterator() {
6269
return files.iterator();
6370
}
64-
71+
6572
public boolean isEmpty() {
6673
return files.isEmpty();
6774
}
68-
75+
6976
public File[] toArray() {
7077
return files.toArray(new File[files.size()]);
7178
}

0 commit comments

Comments
 (0)