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

Removed thrown Exception declarations #1673

Merged
merged 1 commit into from
Aug 4, 2016
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
2 changes: 1 addition & 1 deletion src/jmh/java/net/sf/jabref/benchmarks/Benchmarks.java
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ public boolean keywordGroupContains() throws ParseException {
}

@Benchmark
public boolean keywordGroupContainsWord() throws ParseException {
public boolean keywordGroupContainsWord() {
return KeywordGroup.containsWord("testWord", "Some longer test string containing testWord the test word");
}

Expand Down
4 changes: 0 additions & 4 deletions src/main/java/net/sf/jabref/gui/help/HelpAction.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,12 @@
import net.sf.jabref.logic.l10n.Localization;
import net.sf.jabref.preferences.JabRefPreferences;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

/**
* This Action keeps a reference to a URL. When activated, it shows the help
* Dialog unless it is already visible, and shows the URL in it.
*/
public class HelpAction extends MnemonicAwareAction {

private static final Log LOGGER = LogFactory.getLog(HelpAction.class);
private HelpFile helpPage;


Expand Down
2 changes: 1 addition & 1 deletion src/main/java/net/sf/jabref/gui/openoffice/OOBibBase.java
Original file line number Diff line number Diff line change
Expand Up @@ -799,7 +799,7 @@ private List<String> getSortedReferenceMarks(final XNameAccess nameAccess)
}

public void rebuildBibTextSection(List<BibDatabase> databases, OOBibStyle style)
throws IOException, NoSuchElementException, WrappedTargetException, IllegalArgumentException,
throws NoSuchElementException, WrappedTargetException, IllegalArgumentException,
CreationException, PropertyVetoException, UnknownPropertyException, UndefinedParagraphFormatException {
List<String> cited = findCitedKeys();
Map<String, BibDatabase> linkSourceBase = new HashMap<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ private void parseAndAddEntry(String type) {
}
}

private void parseJabRefComment(Map<String, String> meta) throws IOException {
private void parseJabRefComment(Map<String, String> meta) {
StringBuilder buffer = null;
try {
buffer = parseBracketedTextExactly();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
import java.util.List;
import java.util.Optional;

import net.sf.jabref.importer.fileformat.ParseException;
import net.sf.jabref.logic.l10n.Localization;
import net.sf.jabref.model.entry.BibEntry;

Expand All @@ -33,7 +32,7 @@ public AllEntriesGroup() {
super(Localization.lang("All entries"), GroupHierarchyType.INDEPENDENT);
}

public static AbstractGroup fromString(String s) throws ParseException {
public static AbstractGroup fromString(String s) {
if (!s.startsWith(AllEntriesGroup.ID)) {
throw new IllegalArgumentException("AllEntriesGroup cannot be created from \"" + s + "\".");
}
Expand Down
5 changes: 0 additions & 5 deletions src/main/java/net/sf/jabref/model/database/EntrySorter.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,8 @@

import net.sf.jabref.model.entry.BibEntry;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

public class EntrySorter {

private static final Log LOGGER = LogFactory.getLog(EntrySorter.class);

// guarded by itself
private final List<BibEntry> entries;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package net.sf.jabref.importer.fileformat;

import java.io.IOException;
import java.net.URISyntaxException;
import java.nio.charset.Charset;
import java.nio.file.Path;
Expand Down Expand Up @@ -30,8 +29,7 @@ public void testGetDescription() {
}

@Test
public void doesNotHandleEncryptedPdfs() throws IOException, URISyntaxException {
PdfContentImporter importer = new PdfContentImporter();
public void doesNotHandleEncryptedPdfs() throws URISyntaxException {
Path file = Paths.get(PdfContentImporter.class.getResource("/pdfs/encrypted.pdf").toURI());
List<BibEntry> result = importer.importDatabase(file, Charset.defaultCharset()).getDatabase().getEntries();
assertEquals(Collections.emptyList(), result);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,14 @@ public void testGetDescription() {
}

@Test
public void importEncryptedFileReturnsError() throws IOException, URISyntaxException {
public void importEncryptedFileReturnsError() throws URISyntaxException {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In tests it is preferable to mention only the generic Exception (since then test code is more stable when the code-under-test throws a different kind of exception).

Path file = Paths.get(PdfXmpImporterTest.class.getResource("/pdfs/encrypted.pdf").toURI());
ParserResult result = importer.importDatabase(file, Charset.defaultCharset());
Assert.assertTrue(result.hasWarnings());
}

@Test
public void testImportEntries() throws IOException, URISyntaxException {
public void testImportEntries() throws URISyntaxException {
Path file = Paths.get(PdfXmpImporterTest.class.getResource("annotated.pdf").toURI());
List<BibEntry> bibEntries = importer.importDatabase(file, Charset.defaultCharset()).getDatabase().getEntries();

Expand Down