1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
|
{
"rule": {
"key": "squid:S1181",
"repo": "squid",
"name": "Throwable and Error classes should not be caught",
"createdAt": "2013-08-09T14:40:54+0200",
"severity": "BLOCKER",
"status": "READY",
"internalKey": "S1181",
"isTemplate": false,
"tags": [],
"sysTags": [
"error-handling"
],
"lang": "java",
"langName": "Java",
"htmlDesc": "<p>\n<code>Throwable</code> is the superclass of all errors and exceptions in Java.\n<code>Error</code> is the superclass of all errors which are not meant to be caught by applications.\n</p>\n\n<p>\nCatching either <code>Throwable</code> or <code>Error</code> will also catch <code>OutOfMemoryError</code> or <code>InternalError</code> from which an application should not attempt to recover.\n</p>\n\n<p>Only <code>Exception</code> and its subclasses should be caught.</p>\n\n<h2>Noncompliant Code Example</h2>\n\n<pre>\ntry { /* ... */ } catch (Throwable t) { /* ... */ }\ntry { /* ... */ } catch (Error e) { /* ... */ } \n</pre>\n\n<h2>Compliant Solution</h2>\n\n<pre>\ntry { /* ... */ } catch (Exception e) { /* ... */ } \ntry { /* ... */ } catch (RuntimeException e) { /* ... */ } \ntry { /* ... */ } catch (MyException e) { /* ... */ } \n</pre>",
"defaultDebtChar": "RELIABILITY",
"defaultDebtSubChar": "EXCEPTION_HANDLING",
"debtChar": "RELIABILITY",
"debtSubChar": "EXCEPTION_HANDLING",
"debtCharName": "Reliability",
"debtSubCharName": "Exception handling",
"defaultDebtRemFnType": "CONSTANT_ISSUE",
"defaultDebtRemFnOffset": "20min",
"debtOverloaded": true,
"debtRemFnType": "LINEAR",
"debtRemFnCoeff": "20min",
"params": [
{
"key": "max",
"htmlDesc": "Maximum authorized number of parameters",
"type": "INTEGER",
"defaultValue": "7"
}
]
},
"actives": [
{
"qProfile": "java-top-profile-without-formatting-conventions-50037",
"inherit": "NONE",
"severity": "BLOCKER",
"params": []
},
{
"qProfile": "java-default-with-sonarsource-conventions-27339",
"inherit": "INHERITED",
"severity": "BLOCKER",
"params": []
},
{
"qProfile": "java-for-sq-java-plugin-only-92289",
"inherit": "INHERITED",
"severity": "BLOCKER",
"params": []
},
{
"qProfile": "java-for-sq-only-95381",
"inherit": "INHERITED",
"severity": "BLOCKER",
"params": []
},
{
"qProfile": "java-default-with-mojo-conventions-49307",
"inherit": "INHERITED",
"severity": "BLOCKER",
"params": []
},
{
"qProfile": "java-sonar-way-80423",
"inherit": "NONE",
"severity": "BLOCKER",
"params": []
}
]
}
|