Skip to content

Commit

Permalink
fixing saving without saveActions
Browse files Browse the repository at this point in the history
  • Loading branch information
matthiasgeiger committed Jan 27, 2016
1 parent 3d7d02f commit 01b4255
Showing 1 changed file with 15 additions and 10 deletions.
25 changes: 15 additions & 10 deletions src/main/java/net/sf/jabref/exporter/SaveActions.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,23 @@ public class SaveActions {

public SaveActions(MetaData metaData) {
actions = new HashMap<>();
List<String> formatters = metaData.getData(META_KEY);
setAvailableFormatters();

for (int i = 0; i < formatters.size(); i += 2) {
try {
String field = formatters.get(i);
Formatter formatter = getFormatterFromString(formatters.get(i + 1));

actions.put(field, formatter);
} catch(IndexOutOfBoundsException e){
// the meta data string in the file is broken. -> Ignore the last item
break;
List<String> formatters = metaData.getData(META_KEY);
if(formatters==null) {
// no save actions defined in the meta data
return;
} else {
for (int i = 0; i < formatters.size(); i += 2) {
try {
String field = formatters.get(i);
Formatter formatter = getFormatterFromString(formatters.get(i + 1));

actions.put(field, formatter);
} catch (IndexOutOfBoundsException e) {
// the meta data string in the file is broken. -> Ignore the last item
break;
}
}
}

Expand Down

0 comments on commit 01b4255

Please sign in to comment.