-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixes Texgroup's "Library has been modified by another program" #6584
Fixes Texgroup's "Library has been modified by another program" #6584
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the investigation and the fix! I have a suggestion how to make the code more efficient
@@ -104,6 +100,19 @@ public MetaData parse(MetaData metaData, Map<String, String> data, Character key | |||
metaData.putUnknownMetaDataItem(entry.getKey(), value); | |||
} | |||
} | |||
|
|||
// process GROUPSTREE and GROUPSTREE_LEGACY at the very end (otherwise it may happen that not all dependent data is set) | |||
for (Map.Entry<String, String> entry : data.entrySet()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about converting the whole switch/case to an if else with the group processing at the end and add it to the other?
This way you wont' need to reiterate over the whole map and you can ensure that it's in order.
(A switch case statement does not guarantee any order, e.g. default can be at the top, and it would only be executed if no cases match).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know, my correction is not very beautiful. I shortly thought about other solutions as well. One idea was e.g. to convert data.entrySet()
to a List and then searching for those entries and shifting them to the end. What do you think about that?
I'm not sure, if I understood you correctly. Currently, a set gets iterated, where GROUPSTREE/GROUPSTREE_LEGACY could occur before or after setting the Latex directory. While iterating, the entries would also get processed in the same sequence, even when refactoring it to a whole if-else block, or am I missing something? Nevertheless, I will refactor it to a combined if-else now, because it looks much better.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, I think I misunderstood it a bit., Thanks for your explanation. It's more clear now.
What about using something like: data.entrySet().stream(). filter(entry,getKey() == Groups... .. || entry.getKey() == Groups...
@Siedlerchr Before proceeding, I will wait for your recommendation. |
@Siedlerchr How about this? |
Fixes #6420.
Partially fixes #6585.
jabref/src/main/java/org/jabref/logic/importer/util/MetaDataParser.java
Line 67 in 2eac649
must be called before calling
jabref/src/main/java/org/jabref/logic/importer/util/MetaDataParser.java
Line 109 in 2eac649
so that the latex file directory is set properly.