Title: Suggestion: Sonar S2129 Constructors should not be used to instantiate "String", "BigInteger", "BigDecimal" and primitive-wrapper classes · Issue #1066 · biojava/biojava · GitHub
Open Graph Title: Suggestion: Sonar S2129 Constructors should not be used to instantiate "String", "BigInteger", "BigDecimal" and primitive-wrapper classes · Issue #1066 · biojava/biojava
X Title: Suggestion: Sonar S2129 Constructors should not be used to instantiate "String", "BigInteger", "BigDecimal" and primitive-wrapper classes · Issue #1066 · biojava/biojava
Description: While analyzing your project using our Automatic bug fixing software, i noticed that sonar rule S2129 was sometimes violated. If you wish, I can offer you a correction in the form of a PR. https://sonarcloud.io/organizations/default/rule...
Open Graph Description: While analyzing your project using our Automatic bug fixing software, i noticed that sonar rule S2129 was sometimes violated. If you wish, I can offer you a correction in the form of a PR. https://...
X Description: While analyzing your project using our Automatic bug fixing software, i noticed that sonar rule S2129 was sometimes violated. If you wish, I can offer you a correction in the form of a PR. https://...
Opengraph URL: https://github.com/biojava/biojava/issues/1066
X: @github
Domain: patch-diff.githubusercontent.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Suggestion: Sonar S2129 Constructors should not be used to instantiate \"String\", \"BigInteger\", \"BigDecimal\" and primitive-wrapper classes","articleBody":"\r\nWhile analyzing your project using our Automatic bug fixing software, i noticed that sonar rule S2129 was sometimes violated. If you wish, I can offer you a correction in the form of a PR.\r\n\r\nhttps://sonarcloud.io/organizations/default/rules?open=java%3AS2129\u0026q=S2129\r\n\"Calling constructors for String, BigInteger, BigDecimal and the objects used to wrap primitives is less efficient and less clear than relying on autoboxing or valueOf.\r\nConsider simplifying when possible for more efficient and cleaner code.\"\r\n\r\nBelow are examples of the changes made by our software to correct this rule.\r\n\r\n diff --git a/biojava-alignment/src/main/java/org/biojava/nbio/alignment/io/StockholmStructure.java b/biojava-alignment/src/main/java/org/biojava/nbio/alignment/io /StockholmStructure.java\r\n index 97261433b..22783b43c 100644\r\n --- a/biojava-alignment/src/main/java/org/biojava/nbio/alignment/io/StockholmStructure.java\r\n +++ b/biojava-alignment/src/main/java/org/biojava/nbio/alignment/io/StockholmStructure.java\r\n @@ -256.9 +256.8 @@ public class StockholmStructure {\r\n }\r\n String[] seqDetails = splitSeqName(sequencename);\r\n seq.setDescription(seqDetails[0]);\r\n - seq.setBioBegin((seqDetails[1] == null || seqDetails[1].trim().equals(\"\") ? null: new Integer(\r\n - seqDetails[1])));\r\n - seq.setBioEnd((seqDetails[2] == null || seqDetails[2].trim().equals(\"\") ? null: new Integer(seqDetails[2])));\r\n + seq.setBioBegin((seqDetails[1] == null || seqDetails[1].trim().equals(\"\") ? null : Integer.valueOf(seqDetails[1])));\r\n + seq.setBioEnd((seqDetails[2] == null || seqDetails[2].trim().equals(\"\") ? null: Integer.valueOf(seqDetails[2])));\r\n\r\n seqs.add(seq);\r\n }\r\n\r\n","author":{"url":"https://github.com/jlerbsc","@type":"Person","name":"jlerbsc"},"datePublished":"2023-06-25T19:19:48.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":2},"url":"https://github.com/1066/biojava/issues/1066"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:81ec41f9-c2f7-306e-cde4-8c00cd04e823 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | CC40:2AED63:5108D9:67C7B0:69744434 |
| html-safe-nonce | 836689e7480fa13a7ffe1f51a9e5f3e0d456713d7b009284a2c0890d4bf3d1f7 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDQzQwOjJBRUQ2Mzo1MTA4RDk6NjdDN0IwOjY5NzQ0NDM0IiwidmlzaXRvcl9pZCI6IjUyNjU3OTEzNTAxOTA5MTY2NjAiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | fb168df92121272c37dee92c44f61f20c6bd2cf920794872c07187fceb08e7f8 |
| hovercard-subject-tag | issue:1773446357 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/biojava/biojava/1066/issue_layout |
| twitter:image | https://opengraph.githubassets.com/05ad0ecd17a96d4984182eaa3be3e1542a4e076ec50bf21354e6e23034da26b4/biojava/biojava/issues/1066 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/05ad0ecd17a96d4984182eaa3be3e1542a4e076ec50bf21354e6e23034da26b4/biojava/biojava/issues/1066 |
| og:image:alt | While analyzing your project using our Automatic bug fixing software, i noticed that sonar rule S2129 was sometimes violated. If you wish, I can offer you a correction in the form of a PR. https://... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | jlerbsc |
| hostname | github.com |
| expected-hostname | github.com |
| None | e0b95d743b7672c9ac0e1032d5f117950182dc164a83434a7db86510e8f0b37c |
| turbo-cache-control | no-preview |
| go-import | github.com/biojava/biojava git https://github.com/biojava/biojava.git |
| octolytics-dimension-user_id | 237402 |
| octolytics-dimension-user_login | biojava |
| octolytics-dimension-repository_id | 9199359 |
| octolytics-dimension-repository_nwo | biojava/biojava |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 9199359 |
| octolytics-dimension-repository_network_root_nwo | biojava/biojava |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 56fe7e2e8de6e57740bca50402351ea656f7a4bf |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width