Skip to content

Commit 56b98c8

Browse files
authored
Merge pull request #1062 from jlerbsc/master
Fix Sonar S1130 throws declarations should not be superfluous
2 parents d09477e + 86307e9 commit 56b98c8

File tree

26 files changed

+97
-97
lines changed

26 files changed

+97
-97
lines changed

biojava-aa-prop/src/main/java/org/biojava/nbio/aaproperties/xml/AminoAcidCompositionTable.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ public void computeMolecularWeight(ElementTable eTable){
132132
* @throws NullPointerException
133133
* thrown if AminoAcidCompositionTable.computeMolecularWeight(ElementTable) is not called before this method
134134
*/
135-
public double getMolecularWeight(Character aaSymbol) throws NullPointerException{
135+
public double getMolecularWeight(Character aaSymbol) {
136136
if(this.aaSymbol2MolecularWeight == null){
137137
throw new NullPointerException("Please call AminoAcidCompositionTable.computeMolecularWeight(ElementTable) before this method");
138138
}

biojava-alignment/src/main/java/org/biojava/nbio/alignment/io/StockholmFileParser.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ public class StockholmFileParser {
283283
* @throws ParserException
284284
* if unexpected format is encountered
285285
*/
286-
public StockholmStructure parse(String filename) throws IOException, ParserException {
286+
public StockholmStructure parse(String filename) throws IOException {
287287
InputStream inStream = new InputStreamProvider().getInputStream(filename);
288288
StockholmStructure structure = parse(inStream);
289289
inStream.close();
@@ -307,7 +307,7 @@ public StockholmStructure parse(String filename) throws IOException, ParserExcep
307307
* @throws ParserException
308308
* if unexpected format is encountered
309309
*/
310-
public List<StockholmStructure> parse(String filename, int max) throws IOException, ParserException {
310+
public List<StockholmStructure> parse(String filename, int max) throws IOException {
311311
InputStreamProvider isp = new InputStreamProvider();
312312
InputStream inStream = isp.getInputStream(filename);
313313
return parse(inStream, max);
@@ -325,7 +325,7 @@ public List<StockholmStructure> parse(String filename, int max) throws IOExcepti
325325
* @throws IOException
326326
* @throws ParserException
327327
*/
328-
public StockholmStructure parse(InputStream inStream) throws ParserException, IOException {
328+
public StockholmStructure parse(InputStream inStream) throws IOException {
329329
return parse(inStream, 1).get(0);
330330
}
331331

@@ -391,7 +391,7 @@ public List<StockholmStructure> parseNext(int max) throws IOException {
391391
* @throws IOException
392392
* @throws Exception
393393
*/
394-
StockholmStructure parse(Scanner scanner) throws ParserException, IOException {
394+
StockholmStructure parse(Scanner scanner) throws IOException {
395395
if (scanner == null) {
396396
if (internalScanner != null) {
397397
scanner = internalScanner;
@@ -528,7 +528,7 @@ StockholmStructure parse(Scanner scanner) throws ParserException, IOException {
528528
* the line to be parsed
529529
* @throws Exception
530530
*/
531-
private void handleSequenceLine(String line) throws ParserException {
531+
private void handleSequenceLine(String line) {
532532
String[] lineContent = line.split("\\s+");
533533
if (lineContent.length != 2) {
534534
throw new ParserException("Could not split sequence line into sequence name and sequence:\n" + line);

biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/GenericGenbankHeaderParser.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ private void reset() {
165165
* {@inheritDoc}
166166
* The last accession passed to this routine will always be the one used.
167167
*/
168-
public void setVersion(int version) throws ParserException {
168+
public void setVersion(int version) {
169169
if (this.versionSeen) throw new ParserException("Current BioEntry already has a version");
170170
else {
171171
try {
@@ -182,23 +182,23 @@ public void setVersion(int version) throws ParserException {
182182
* {@inheritDoc}
183183
* The last accession passed to this routine will always be the one used.
184184
*/
185-
public void setAccession(String accession) throws ParserException {
185+
public void setAccession(String accession) {
186186
if (accession==null) throw new ParserException("Accession cannot be null");
187187
this.accession = accession;
188188
}
189189

190190
/**
191191
* {@inheritDoc}
192192
*/
193-
public void setDescription(String description) throws ParserException {
193+
public void setDescription(String description) {
194194
if (this.description!=null) throw new ParserException("Current BioEntry already has a description");
195195
this.description = description;
196196
}
197197

198198
/**
199199
* {@inheritDoc}
200200
*/
201-
public void setIdentifier(String identifier) throws ParserException {
201+
public void setIdentifier(String identifier) {
202202
if (identifier==null) throw new ParserException("Identifier cannot be null");
203203
if (this.identifier!=null) throw new ParserException("Current BioEntry already has a identifier");
204204
this.identifier = identifier;
@@ -207,7 +207,7 @@ public void setIdentifier(String identifier) throws ParserException {
207207
/**
208208
* {@inheritDoc}
209209
*/
210-
public void setName(String name) throws ParserException {
210+
public void setName(String name) {
211211
if (name==null) throw new ParserException("Name cannot be null");
212212
if (this.name!=null) throw new ParserException("Current BioEntry already has a name");
213213
this.name = name;
@@ -216,7 +216,7 @@ public void setName(String name) throws ParserException {
216216
/**
217217
* {@inheritDoc}
218218
*/
219-
public void setComment(String comment) throws ParserException {
219+
public void setComment(String comment) {
220220
if (comment==null) throw new ParserException("Comment cannot be null");
221221
this.comments.add(comment);
222222
}

biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/IUPACParser.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ public String getName() {
242242
* {@link #getCodons(CompoundSet, CompoundSet)} was not called first.
243243
*/
244244
@Override
245-
public boolean isStart(AminoAcidCompound compound) throws IllegalStateException {
245+
public boolean isStart(AminoAcidCompound compound) {
246246
if(this.codons.isEmpty()) {
247247
throw new IllegalStateException("Codons are empty; please request getCodons() fist before asking this");
248248
}

biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/util/IOUtils.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ public static void copy(InputStream input, OutputStream output)
8787
* @param processor The processor to invoke on all lines
8888
* @throws ParserException Can throw this if we cannot parse the given reader
8989
*/
90-
public static void processReader(BufferedReader br, ReaderProcessor processor) throws ParserException {
90+
public static void processReader(BufferedReader br, ReaderProcessor processor) {
9191
String line;
9292
try {
9393
while( (line = br.readLine()) != null ) {
@@ -109,7 +109,7 @@ public static void processReader(BufferedReader br, ReaderProcessor processor) t
109109
* @return List of Strings
110110
* @throws ParserException Can throw this if we cannot parse the given reader
111111
*/
112-
public static List<String> getList(BufferedReader br) throws ParserException {
112+
public static List<String> getList(BufferedReader br) {
113113
final List<String> list = new ArrayList<String>();
114114
processReader(br, new ReaderProcessor() {
115115
@Override
@@ -130,7 +130,7 @@ public void process(String line) {
130130
* @throws ParserException Can throw this if the file is not a file or we
131131
* cannot parse it
132132
*/
133-
public static List<String> getList(InputStream is) throws ParserException {
133+
public static List<String> getList(InputStream is) {
134134
return getList(new BufferedReader(new InputStreamReader(is)));
135135
}
136136

biojava-core/src/main/java/org/biojava/nbio/core/sequence/loader/UniprotProxySequenceReader.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -638,7 +638,7 @@ private StringBuilder fetchUniprotXML(String uniprotURL)
638638
* @throws IOException
639639
*/
640640
private StringBuilder fetchFromCache(String key)
641-
throws FileNotFoundException, IOException {
641+
throws IOException {
642642
int index;
643643
File f = new File(uniprotDirectoryCache + File.separatorChar + key + ".xml");
644644
StringBuilder sb = new StringBuilder();

biojava-core/src/main/java/org/biojava/nbio/core/sequence/location/InsdcParser.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ public void setSequenceLength(long sequenceLength) {
131131
* @return The parsed location
132132
* @throws ParserException thrown in the event of any error during parsing
133133
*/
134-
public Location parse(String locationString) throws ParserException {
134+
public Location parse(String locationString) {
135135
featureGlobalStart = Integer.MAX_VALUE;
136136
featureGlobalEnd = 1;
137137

@@ -151,7 +151,7 @@ public Location parse(String locationString) throws ParserException {
151151
return l;
152152
}
153153

154-
private List<Location> parseLocationString(String string, int versus) throws ParserException {
154+
private List<Location> parseLocationString(String string, int versus) {
155155
Matcher m;
156156
List<Location> boundedLocationsCollection = new ArrayList<Location>();
157157

biojava-core/src/main/java/org/biojava/nbio/core/sequence/storage/BitSequenceReader.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ public C getCompoundAt(int position) {
368368
* @return Byte representation of the compound
369369
* @throws IllegalStateException Done whenever this method is invoked
370370
*/
371-
protected byte processUnknownCompound(C compound, int position) throws IllegalStateException {
371+
protected byte processUnknownCompound(C compound, int position) {
372372
throw new IllegalStateException("Do not know how to translate the compound " + compound + " to a " + bitsPerCompound() + "bit representation");
373373
}
374374

biojava-core/src/main/java/org/biojava/nbio/core/sequence/storage/JoiningSequenceReader.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ public C next() {
263263

264264

265265
@Override
266-
public void remove() throws UnsupportedOperationException {
266+
public void remove() {
267267
throw new UnsupportedOperationException("Cannot remove from this Sequence");
268268
}
269269
};
@@ -289,7 +289,7 @@ public int countCompounds(C... compounds) {
289289

290290

291291
@Override
292-
public AccessionID getAccession() throws UnsupportedOperationException {
292+
public AccessionID getAccession() {
293293
throw new UnsupportedOperationException();
294294
}
295295

biojava-ontology/src/main/java/org/biojava/nbio/ontology/IntegerOntology.java

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ public void remove() {
9696
}
9797

9898
@Override
99-
public Term getTerm(String s) throws NoSuchElementException {
99+
public Term getTerm(String s) {
100100
int val = Integer.parseInt(s);
101101
return resolveInt(val);
102102
}
@@ -117,37 +117,37 @@ public Set getRemoteTerms() {
117117
}
118118

119119
@Override
120-
public Term createTerm(String name) throws AlreadyExistsException, IllegalArgumentException {
120+
public Term createTerm(String name) throws AlreadyExistsException {
121121
throw new IllegalArgumentException(getName() + " is immutable");
122122
}
123123

124124
@Override
125125
public Term createTerm(String name, String description)
126126
throws
127-
AlreadyExistsException,
127+
AlreadyExistsException
128128

129-
IllegalArgumentException
130-
{
129+
130+
{
131131
throw new IllegalArgumentException(getName() + " is immutable");
132132
}
133133

134134
@Override
135135
public Term createTerm(String name, String description, Object[] synonyms)
136136
throws
137-
AlreadyExistsException,
137+
AlreadyExistsException
138138

139-
IllegalArgumentException
140-
{
139+
140+
{
141141
throw new IllegalArgumentException(getName() + " is immutable");
142142
}
143143

144144
@Override
145145
public Variable createVariable(String name, String description)
146146
throws
147-
AlreadyExistsException,
147+
AlreadyExistsException
148148

149-
IllegalArgumentException
150-
{
149+
150+
{
151151
throw new IllegalArgumentException(getName() + " is immutable");
152152
}
153153

0 commit comments

Comments
 (0)