Skip to content
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

BugFix for "#960 FileNotFoundException in Journal abbreviations window" #14

Merged
merged 2 commits into from
Aug 5, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
- Support FindFullText with ACS DOIs (pull request #9)
- Fixes groups and adds optional 2.9.2 save ordering (pull request #10)
- Fixes bug 880 "PubMed Import broken" (pull request #11 by vegeziel)
- Fixes bug #959 "StringIndexOutOfBoundsException with invalid Preview text" (pull request #12 by IngvarJackal)
- Fixes bug #959 "StringIndexOutOfBoundsException with invalid Preview text" (pull request #13 by IngvarJackal)
- Fixes bug #960 "FileNotFoundException in Journal abbreviations window" (pull request #13 by IngvarJackal)
2.10
- Made IEEEXploreFetcher author parsing work again.
- Added a few more characters in the HTML/Unicode to LaTeX conversion.
Expand Down
7 changes: 4 additions & 3 deletions src/main/java/net/sf/jabref/JabRef.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (C) 2003-2011 JabRef contributors.
/* Copyright (C) 2003-2014 JabRef contributors.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
Expand Down Expand Up @@ -166,12 +166,13 @@ protected JabRef(String[] args) {
* journal names and abbreviations to the list:
*/
String personalJournalList = prefs.get("personalJournalList");
if (personalJournalList != null) {
if (personalJournalList != null && !personalJournalList.isEmpty()) {
try {
Globals.journalAbbrev.readJournalList(new File(
personalJournalList));
} catch (FileNotFoundException e) {
e.printStackTrace();
JOptionPane.showMessageDialog(null, Globals.lang("Journal file not found") + ": " + e.getMessage(), Globals.lang("Error opening file"), JOptionPane.ERROR_MESSAGE);
Globals.prefs.put("personalJournalList", "");
}
}

Expand Down
15 changes: 11 additions & 4 deletions src/main/java/net/sf/jabref/journals/ManageJournalsPanel.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (C) 2003-2011 JabRef contributors.
/* Copyright (C) 2003-2014 JabRef contributors.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
Expand Down Expand Up @@ -202,8 +202,12 @@ public void actionPerformed(ActionEvent e) {
ok.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
if (readyToClose()) {
storeSettings();
dialog.dispose();
try {
storeSettings();
dialog.dispose();
} catch (FileNotFoundException ex) {
JOptionPane.showMessageDialog(null, Globals.lang("Error opening file") + ": " + ex.getMessage(), Globals.lang("Error opening file"), JOptionPane.ERROR_MESSAGE);
}
}
}
});
Expand Down Expand Up @@ -340,7 +344,7 @@ public boolean readyToClose() {
return true;
}

public void storeSettings() {
public void storeSettings() throws FileNotFoundException {
File f = null;
if (newFile.isSelected()) {
if (newNameTf.getText().length() > 0) {
Expand All @@ -352,6 +356,9 @@ public void storeSettings() {
f = new File(personalFile.getText());

if (f != null) {
if (!f.exists()) {
throw new FileNotFoundException(f.getAbsolutePath());
}
FileWriter fw = null;
try {
fw = new FileWriter(f, false);
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/resource/JabRef_da.properties
Original file line number Diff line number Diff line change
Expand Up @@ -1670,3 +1670,4 @@ Save_fields_as_user_defined_order=
Parsing_error=
illegal_backslash_expression=
Backslash_parsing_error_near=
Journal_file_not_found=
1 change: 1 addition & 0 deletions src/main/resources/resource/JabRef_de.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2427,3 +2427,4 @@ Save_fields_as_user_defined_order=
Parsing_error=
illegal_backslash_expression=
Backslash_parsing_error_near=
Journal_file_not_found=
1 change: 1 addition & 0 deletions src/main/resources/resource/JabRef_en.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2415,3 +2415,4 @@ Save_fields_as_user_defined_order=Save_fields_as_user_defined_order
Parsing_error=Parsing_error
illegal_backslash_expression=illegal_backslash_expression
Backslash_parsing_error_near=Backslash_parsing_error_near
Journal_file_not_found=Journal_file_not_found
1 change: 1 addition & 0 deletions src/main/resources/resource/JabRef_es.properties
Original file line number Diff line number Diff line change
Expand Up @@ -1562,3 +1562,4 @@ Save_fields_as_user_defined_order=
Parsing_error=
illegal_backslash_expression=
Backslash_parsing_error_near=
Journal_file_not_found=
1 change: 1 addition & 0 deletions src/main/resources/resource/JabRef_fr.properties
Original file line number Diff line number Diff line change
Expand Up @@ -1608,3 +1608,4 @@ Save_fields_as_user_defined_order=
Parsing_error=
illegal_backslash_expression=
Backslash_parsing_error_near=
Journal_file_not_found=
1 change: 1 addition & 0 deletions src/main/resources/resource/JabRef_in.properties
Original file line number Diff line number Diff line change
Expand Up @@ -1581,3 +1581,4 @@ Save_fields_as_user_defined_order=
Parsing_error=
illegal_backslash_expression=
Backslash_parsing_error_near=
Journal_file_not_found=
1 change: 1 addition & 0 deletions src/main/resources/resource/JabRef_it.properties
Original file line number Diff line number Diff line change
Expand Up @@ -1692,3 +1692,4 @@ Save_fields_as_user_defined_order=
Parsing_error=
illegal_backslash_expression=
Backslash_parsing_error_near=
Journal_file_not_found=
1 change: 1 addition & 0 deletions src/main/resources/resource/JabRef_ja.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2412,3 +2412,4 @@ Save_fields_as_user_defined_order=
Parsing_error=
illegal_backslash_expression=
Backslash_parsing_error_near=
Journal_file_not_found=
1 change: 1 addition & 0 deletions src/main/resources/resource/JabRef_nl.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2413,3 +2413,4 @@ Save_fields_as_user_defined_order=
Parsing_error=
illegal_backslash_expression=
Backslash_parsing_error_near=
Journal_file_not_found=
1 change: 1 addition & 0 deletions src/main/resources/resource/JabRef_no.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2879,3 +2879,4 @@ Save_fields_as_user_defined_order=
Parsing_error=
illegal_backslash_expression=
Backslash_parsing_error_near=
Journal_file_not_found=
1 change: 1 addition & 0 deletions src/main/resources/resource/JabRef_pt_BR.properties
Original file line number Diff line number Diff line change
Expand Up @@ -1577,3 +1577,4 @@ Save_fields_as_user_defined_order=
Parsing_error=
illegal_backslash_expression=
Backslash_parsing_error_near=
Journal_file_not_found=
1 change: 1 addition & 0 deletions src/main/resources/resource/JabRef_ru.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2414,3 +2414,4 @@ Save_fields_as_user_defined_order=
Parsing_error=
illegal_backslash_expression=
Backslash_parsing_error_near=
Journal_file_not_found=
1 change: 1 addition & 0 deletions src/main/resources/resource/JabRef_tr.properties
Original file line number Diff line number Diff line change
Expand Up @@ -1599,3 +1599,4 @@ Save_fields_as_user_defined_order=
Parsing_error=
illegal_backslash_expression=
Backslash_parsing_error_near=
Journal_file_not_found=
1 change: 1 addition & 0 deletions src/main/resources/resource/JabRef_vi.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2409,3 +2409,4 @@ Save_fields_as_user_defined_order=
Parsing_error=
illegal_backslash_expression=
Backslash_parsing_error_near=
Journal_file_not_found=
1 change: 1 addition & 0 deletions src/main/resources/resource/JabRef_zh.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2402,3 +2402,4 @@ Save_fields_as_user_defined_order=
Parsing_error=
illegal_backslash_expression=
Backslash_parsing_error_near=
Journal_file_not_found=