Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Suggestion: Sonar S1130 "throws" declarations should not be superfluous #1061

@jlerbsc

Description

@jlerbsc

Hi,

After suggesting that you correct this type of defect automatically (#1051 ), we are offering another code smell correction.

In your project it seems that some methods throw runtime exceptions that it is not useful to declare because it inherits for example from the RuntimeException class.

https://rules.sonarsource.com/java/RSPEC-1130

If this is of interest to you we can push code changes to you in the form of a PR.

Below are examples of the changes made by our software to correct this rule.

org\biojava\nbio\aaproperties\xml\AminoAcidCompositionTable.java
@@ -133,5  +133,5 @@
 * 	thrown if AminoAcidCompositionTable.computeMolecularWeight(ElementTable) is not called before this method
 */
-	public double getMolecularWeight(Character aaSymbol) throws NullPointerException{
+	public double getMolecularWeight(Character aaSymbol) {
	if(this.aaSymbol2MolecularWeight == null){
		throw new NullPointerException("Please call AminoAcidCompositionTable.computeMolecularWeight(ElementTable) before this method");

org\biojava\nbio\alignment\io\StockholmFileParser.java
@@ -284,5  +284,5 @@
 *             if unexpected format is encountered
 */
-	public StockholmStructure parse(String filename) throws IOException, ParserException {
+	public StockholmStructure parse(String filename) throws IOException {
	InputStream inStream = new InputStreamProvider().getInputStream(filename);
	StockholmStructure structure = parse(inStream);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions