Skip to content

Commit

Permalink
Improve condition (#12469)
Browse files Browse the repository at this point in the history
  • Loading branch information
koppor authored Feb 6, 2025
1 parent 1a9af9a commit 9e9b961
Showing 1 changed file with 8 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -354,21 +354,18 @@ private void parseJabRefComment(Map<String, String> meta) {
// We remove all line breaks in the metadata
// These have been inserted to prevent too long lines when the file was saved, and are not part of the data.
String comment = buffer.toString().replaceAll("[\\x0d\\x0a]", "");
if (MetaData.META_FLAG.equals(comment.substring(0, Math.min(comment.length(), MetaData.META_FLAG.length())))) {
if (comment.startsWith(MetaData.META_FLAG)) {
String rest = comment.substring(MetaData.META_FLAG.length());
if (comment.startsWith(MetaData.META_FLAG)) {
String rest = comment.substring(MetaData.META_FLAG.length());

int pos = rest.indexOf(':');
int pos = rest.indexOf(':');

if (pos > 0) {
meta.put(rest.substring(0, pos), rest.substring(pos + 1));
if (pos > 0) {
meta.put(rest.substring(0, pos), rest.substring(pos + 1));

// meta comments are always re-written by JabRef and not stored in the file
dumpTextReadSoFarToString();
}
// meta comments are always re-written by JabRef and not stored in the file
dumpTextReadSoFarToString();
}
} else if (MetaData.ENTRYTYPE_FLAG
.equals(comment.substring(0, Math.min(comment.length(), MetaData.ENTRYTYPE_FLAG.length())))) {
} else if (comment.startsWith(MetaData.ENTRYTYPE_FLAG)) {
// A custom entry type can also be stored in a
// "@comment"
Optional<BibEntryType> typ = MetaDataParser.parseCustomEntryType(comment);
Expand Down

0 comments on commit 9e9b961

Please sign in to comment.