Comments (2)
For that specific example I think creating something like a ProbeDefinitionException
class would make sense, and then just wrap the implementation with a try/catch
that catches all those other types of exception and wraps them into a ProbeDefinitionException
. In other places just replacing the throws
clause on the method with an expanded list of the checked exception types is probably more suitable, it'll just have to be decided on a case-by-case basis.
from cryostat-core.
Seems like the update is causing a lot of new THROWS_METHOD_THROWS_CLAUSE_BASIC_EXCEPTION / RUNTIME
spotbugs errors https://spotbugs.readthedocs.io/en/stable/bugDescriptions.html#throws-method-lists-exception-in-its-throws-clause-throws-method-throws-clause-basic-exception. Around 35-40 in -core. Other repos in other orgs have issues with false positives with Junit 5 AssertThrowables and other issues, but I don't think we have that here.
e.g.
INFO] BugInstance size is 43
[INFO] Error size is 0
[INFO] Total bugs: 43
[ERROR] Medium: io.cryostat.core.agent.AgentJMXHelper.getMBeanServerConnection() may expose internal representation by returning AgentJMXHelper.mbsc [io.cryostat.core.agent.AgentJMXHelper] At AgentJMXHelper.java:[line 73] EI_EXPOSE_REP
[ERROR] Medium: Method lists Exception in its throws clause. [io.cryostat.core.agent.AgentJMXHelper] At AgentJMXHelper.java:[lines 118-125] THROWS_METHOD_THROWS_CLAUSE_BASIC_EXCEPTION
[ERROR] Medium: Method lists Exception in its throws clause. [io.cryostat.core.agent.AgentJMXHelper] At AgentJMXHelper.java:[lines 78-81] THROWS_METHOD_THROWS_CLAUSE_BASIC_EXCEPTION
[ERROR] Medium: Method lists Exception in its throws clause. [io.cryostat.core.agent.AgentJMXHelper] At AgentJMXHelper.java:[lines 103-112] THROWS_METHOD_THROWS_CLAUSE_BASIC_EXCEPTION
[ERROR] Medium: Method lists Exception in its throws clause. [io.cryostat.core.agent.AgentJMXHelper] At AgentJMXHelper.java:[lines 87-97] THROWS_METHOD_THROWS_CLAUSE_BASIC_EXCEPTION
[ERROR] Medium: new io.cryostat.core.agent.LocalProbeTemplateService(FileSystem, Environment) may expose internal representation by storing an externally mutable object into LocalProbeTemplateService.fs [io.cryostat.core.agent.LocalProbeTemplateService] At LocalProbeTemplateService.java:[line 64] EI_EXPOSE_REP2
[ERROR] Medium: Method lists Exception in its throws clause. [io.cryostat.core.agent.LocalProbeTemplateService] At LocalProbeTemplateService.java:[lines 89-105] THROWS_METHOD_THROWS_CLAUSE_BASIC_EXCEPTION
[ERROR] Medium: Method lists Exception in its throws clause. [io.cryostat.core.agent.LocalProbeTemplateService] At LocalProbeTemplateService.java:[lines 108-112] THROWS_METHOD_THROWS_CLAUSE_BASIC_EXCEPTION
[ERROR] Medium: Method lists Exception in its throws clause. [io.cryostat.core.agent.LocalProbeTemplateService] At LocalProbeTemplateService.java:[lines 115-118] THROWS_METHOD_THROWS_CLAUSE_BASIC_EXCEPTION
[ERROR] Medium: Method intentionally throws RuntimeException. [io.cryostat.core.agent.ProbeTemplate] At ProbeTemplate.java:[lines 174-196] THROWS_METHOD_THROWS_RUNTIMEEXCEPTION
[ERROR] Medium: Method intentionally throws RuntimeException. [io.cryostat.core.agent.ProbeTemplate] At ProbeTemplate.java:[lines 95-147] THROWS_METHOD_THROWS_RUNTIMEEXCEPTION
[ERROR] Medium: Method intentionally throws RuntimeException. [io.cryostat.core.agent.ProbeTemplate] At ProbeTemplate.java:[lines 150-170] THROWS_METHOD_THROWS_RUNTIMEEXCEPTION
[ERROR] Medium: Method lists Exception in its throws clause. [io.cryostat.core.agent.ProbeTemplateService] In ProbeTemplateService.java THROWS_METHOD_THROWS_CLAUSE_BASIC_EXCEPTION
[ERROR] Medium: Method lists Exception in its throws clause. [io.cryostat.core.net.JFRConnection] At JFRConnection.java:[lines 96-97] THROWS_METHOD_THROWS_CLAUSE_BASIC_EXCEPTION
[ERROR] Medium: Method lists Exception in its throws clause. [io.cryostat.core.net.JFRConnection] At JFRConnection.java:[lines 85-92] THROWS_METHOD_THROWS_CLAUSE_BASIC_EXCEPTION
[ERROR] Medium: Method lists Exception in its throws clause. [io.cryostat.core.net.JFRConnection] At JFRConnection.java:[lines 206-215] THROWS_METHOD_THROWS_CLAUSE_BASIC_EXCEPTION
[ERROR] Medium: Method lists Exception in its throws clause. [io.cryostat.core.net.JFRConnection] At JFRConnection.java:[lines 162-182] THROWS_METHOD_THROWS_CLAUSE_BASIC_EXCEPTION
[ERROR] Medium: Method lists Exception in its throws clause. [io.cryostat.core.net.JFRConnection] At JFRConnection.java:[lines 104-114] THROWS_METHOD_THROWS_CLAUSE_BASIC_EXCEPTION
[ERROR] Medium: Method intentionally throws RuntimeException. [io.cryostat.core.net.JFRConnection] At JFRConnection.java:[line 220] THROWS_METHOD_THROWS_RUNTIMEEXCEPTION
[ERROR] Medium: new io.cryostat.core.net.JFRConnectionToolkit(ClientWriter, FileSystem, Environment) may expose internal representation by storing an externally mutable object into JFRConnectionToolkit.fs [io.cryostat.core.net.JFRConnectionToolkit] At JFRConnectionToolkit.java:[line 66] EI_EXPOSE_REP2
[ERROR] Medium: Method lists Exception in its throws clause. [io.cryostat.core.net.JFRConnectionToolkit] At JFRConnectionToolkit.java:[line 71] THROWS_METHOD_THROWS_CLAUSE_BASIC_EXCEPTION
[ERROR] Medium: Method lists Exception in its throws clause. [io.cryostat.core.net.JFRConnectionToolkit] At JFRConnectionToolkit.java:[line 75] THROWS_METHOD_THROWS_CLAUSE_BASIC_EXCEPTION
[ERROR] Medium: Method lists Exception in its throws clause. [io.cryostat.core.net.JFRConnectionToolkit] At JFRConnectionToolkit.java:[lines 80-88] THROWS_METHOD_THROWS_CLAUSE_BASIC_EXCEPTION
[ERROR] Medium: new io.cryostat.core.reports.InterruptibleReportGenerator(Logger, Set, ExecutorService) may expose internal representation by storing an externally mutable object into InterruptibleReportGenerator.transformers [io.cryostat.core.reports.InterruptibleReportGenerator] At InterruptibleReportGenerator.java:[line 105] EI_EXPOSE_REP2
[ERROR] Medium: Method lists Exception in its throws clause. [io.cryostat.core.reports.InterruptibleReportGenerator] At InterruptibleReportGenerator.java:[lines 340-352] THROWS_METHOD_THROWS_CLAUSE_BASIC_EXCEPTION
[ERROR] Medium: Method lists Exception in its throws clause. [io.cryostat.core.reports.InterruptibleReportGenerator] At InterruptibleReportGenerator.java:[lines 174-191] THROWS_METHOD_THROWS_CLAUSE_BASIC_EXCEPTION
[ERROR] Medium: Method lists Exception in its throws clause. [io.cryostat.core.reports.InterruptibleReportGenerator] At InterruptibleReportGenerator.java:[lines 123-154] THROWS_METHOD_THROWS_CLAUSE_BASIC_EXCEPTION
[ERROR] Medium: Method lists Exception in its throws clause. [io.cryostat.core.templates.AbstractTemplateService] In AbstractTemplateService.java THROWS_METHOD_THROWS_CLAUSE_BASIC_EXCEPTION
[ERROR] Medium: Method lists Exception in its throws clause. [io.cryostat.core.templates.AbstractTemplateService] At AbstractTemplateService.java:[line 51] THROWS_METHOD_THROWS_CLAUSE_BASIC_EXCEPTION
[ERROR] Medium: new io.cryostat.core.templates.LocalStorageTemplateService(FileSystem, Environment) may expose internal representation by storing an externally mutable object into LocalStorageTemplateService.fs [io.cryostat.core.templates.LocalStorageTemplateService] At LocalStorageTemplateService.java:[line 81] EI_EXPOSE_REP2
[ERROR] Medium: Method lists Exception in its throws clause. [io.cryostat.core.templates.LocalStorageTemplateService] At LocalStorageTemplateService.java:[line 72] THROWS_METHOD_THROWS_CLAUSE_BASIC_EXCEPTION
[ERROR] Medium: Method lists Exception in its throws clause. [io.cryostat.core.templates.MergedTemplateService] At MergedTemplateService.java:[lines 88-94] THROWS_METHOD_THROWS_CLAUSE_BASIC_EXCEPTION
[ERROR] Medium: Method lists Exception in its throws clause. [io.cryostat.core.templates.MergedTemplateService] At MergedTemplateService.java:[lines 67-70] THROWS_METHOD_THROWS_CLAUSE_BASIC_EXCEPTION
[ERROR] Medium: Method lists Exception in its throws clause. [io.cryostat.core.templates.MergedTemplateService] At MergedTemplateService.java:[lines 75-81] THROWS_METHOD_THROWS_CLAUSE_BASIC_EXCEPTION
[ERROR] Medium: Method lists Exception in its throws clause. [io.cryostat.core.templates.RemoteTemplateService] At RemoteTemplateService.java:[lines 106-110] THROWS_METHOD_THROWS_CLAUSE_BASIC_EXCEPTION
[ERROR] Medium: Method lists Exception in its throws clause. [io.cryostat.core.templates.RemoteTemplateService] At RemoteTemplateService.java:[line 132] THROWS_METHOD_THROWS_CLAUSE_BASIC_EXCEPTION
[ERROR] Medium: Method lists Exception in its throws clause. [io.cryostat.core.templates.RemoteTemplateService] At RemoteTemplateService.java:[line 62] THROWS_METHOD_THROWS_CLAUSE_BASIC_EXCEPTION
[ERROR] Medium: Method lists Exception in its throws clause. [io.cryostat.core.templates.RemoteTemplateService] At RemoteTemplateService.java:[lines 77-80] THROWS_METHOD_THROWS_CLAUSE_BASIC_EXCEPTION
[ERROR] Medium: Method lists Exception in its throws clause. [io.cryostat.core.templates.TemplateService] At TemplateService.java:[line 59] THROWS_METHOD_THROWS_CLAUSE_BASIC_EXCEPTION
[ERROR] Medium: Method lists Exception in its throws clause. [io.cryostat.core.templates.TemplateService] In TemplateService.java THROWS_METHOD_THROWS_CLAUSE_BASIC_EXCEPTION
[ERROR] Medium: Method lists Exception in its throws clause. [io.cryostat.core.templates.TemplateService] In TemplateService.java THROWS_METHOD_THROWS_CLAUSE_BASIC_EXCEPTION
[ERROR] Medium: Method lists Exception in its throws clause. [io.cryostat.core.templates.TemplateService] At TemplateService.java:[line 53] THROWS_METHOD_THROWS_CLAUSE_BASIC_EXCEPTION
[ERROR] Medium: Method lists Exception in its throws clause. [io.cryostat.core.templates.TemplateService] In TemplateService.java THROWS_METHOD_THROWS_CLAUSE_BASIC_EXCEPTION
For example this method
throws a general
Exception
exception. To 'solve' the bug, it could be replaced with
throws InstanceNotFoundException, MalformedObjectNameException, MBeanException, ReflectionException, IOException
And I'm not sure if that's what we want. I could also look into replacing the exception with a new class of exception, or just suppress them all together, @andrewazores WDYT?
from cryostat-core.
Related Issues (20)
- Remove report transformer API
- [Task] `InvalidEventTemplateException` constructor should be public
- [Bug] pom.xml specifies particular SLF4J provider
- [Task] CI on push to `main`
- [Bug] Duplicate CI publication workflows
- [Bug] Excessive/duplicate CI runs
- [Task] Add status checks for new workflows
- Spotless fails build after update to 4.8.1 HOT 2
- Rename AgentJmxHelper to reflect *JMC* Agent more accurately
- [Task] Replace JSoup with Jackson HOT 2
- [Bug] On release, duplicate attempts to build and publish mvn package HOT 1
- [Bug] JMC and `jdk.jfr` models of `RecordingState` differ
- [Bug] CI is not correctly caching the PR's -core version HOT 1
- [Task] CI should build cryostat3 as well as cryostat (2.x)
- [Task] CI should publish test images of 3.0
- [Bug] CI failing to build Cryostat3
- [Task] Remove `LocalStorageTemplateService`
- [Task] CI should build Cryostat 3.0, not 2.x HOT 1
- [Task] Add Jandex plugin to build
- [Task] Define bean type to replace `java.lang.management.MemoryUsage`
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cryostat-core.