Skip to content

Commit 28fdf63

Browse files
committed
Ah yes, bad lines are read as empty
1 parent 59957a1 commit 28fdf63

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

storage/smiles/src/main/java/org/openscience/cdk/io/iterator/IteratingSMILESReader.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,6 @@ public boolean hasNext() {
130130
}
131131

132132
hasNext = true;
133-
final String suffix = suffix(line);
134-
135133
nextMolecule = readSmiles(line);
136134
} catch (Exception exception) {
137135
logger.error("Unexpected problem: ", exception.getMessage());
@@ -154,7 +152,9 @@ public boolean hasNext() {
154152
private String suffix(final String line) {
155153
for (int i = 0; i < line.length(); i++) {
156154
char c = line.charAt(i);
157-
if (c == ' ' || c == '\t') return line.substring(i + 1);
155+
if (c == ' ' || c == '\t') {
156+
return line.substring(i + 1);
157+
}
158158
}
159159
return "";
160160
}
@@ -172,6 +172,7 @@ private IAtomContainer readSmiles(final String line) {
172172
logger.error("Error while reading the SMILES from: " + line + ", ", e);
173173
final IAtomContainer empty = builder.newInstance(IAtomContainer.class, 0, 0, 0, 0);
174174
empty.setProperty(BAD_SMILES_INPUT, line);
175+
empty.setTitle(suffix(line));
175176
return empty;
176177
}
177178
}

0 commit comments

Comments
 (0)