diff --git a/java-checks/src/main/resources/org/sonar/l10n/java/rules/java/S100_java.json b/java-checks/src/main/resources/org/sonar/l10n/java/rules/java/S100_java.json index d33ba174073..e5812e15d05 100644 --- a/java-checks/src/main/resources/org/sonar/l10n/java/rules/java/S100_java.json +++ b/java-checks/src/main/resources/org/sonar/l10n/java/rules/java/S100_java.json @@ -12,6 +12,6 @@ "defaultSeverity": "Minor", "ruleSpecification": "RSPEC-100", "sqKey": "S100", - "scope": "Main", + "scope": "All", "quickfix": "unknown" } diff --git a/java-checks/src/main/resources/org/sonar/l10n/java/rules/java/S101_java.json b/java-checks/src/main/resources/org/sonar/l10n/java/rules/java/S101_java.json index a3f372d5ec3..3706fbc91f4 100644 --- a/java-checks/src/main/resources/org/sonar/l10n/java/rules/java/S101_java.json +++ b/java-checks/src/main/resources/org/sonar/l10n/java/rules/java/S101_java.json @@ -12,6 +12,6 @@ "defaultSeverity": "Minor", "ruleSpecification": "RSPEC-101", "sqKey": "S101", - "scope": "Main", + "scope": "All", "quickfix": "unknown" } diff --git a/java-checks/src/main/resources/org/sonar/l10n/java/rules/java/S103_java.json b/java-checks/src/main/resources/org/sonar/l10n/java/rules/java/S103_java.json index 01e4e980438..52d5912389c 100644 --- a/java-checks/src/main/resources/org/sonar/l10n/java/rules/java/S103_java.json +++ b/java-checks/src/main/resources/org/sonar/l10n/java/rules/java/S103_java.json @@ -12,6 +12,6 @@ "defaultSeverity": "Major", "ruleSpecification": "RSPEC-103", "sqKey": "S103", - "scope": "Main", + "scope": "All", "quickfix": "unknown" } diff --git a/java-checks/src/main/resources/org/sonar/l10n/java/rules/java/S104_java.json b/java-checks/src/main/resources/org/sonar/l10n/java/rules/java/S104_java.json index fb141bb6c4f..4dacf1f69f3 100644 --- a/java-checks/src/main/resources/org/sonar/l10n/java/rules/java/S104_java.json +++ b/java-checks/src/main/resources/org/sonar/l10n/java/rules/java/S104_java.json @@ -12,6 +12,6 @@ "defaultSeverity": "Major", "ruleSpecification": "RSPEC-104", "sqKey": "S104", - "scope": "Main", + "scope": "All", "quickfix": "unknown" } diff --git a/java-checks/src/main/resources/org/sonar/l10n/java/rules/java/S105_java.json b/java-checks/src/main/resources/org/sonar/l10n/java/rules/java/S105_java.json index 3ae3c256040..771eae73499 100644 --- a/java-checks/src/main/resources/org/sonar/l10n/java/rules/java/S105_java.json +++ b/java-checks/src/main/resources/org/sonar/l10n/java/rules/java/S105_java.json @@ -12,6 +12,6 @@ "defaultSeverity": "Minor", "ruleSpecification": "RSPEC-105", "sqKey": "S105", - "scope": "Main", + "scope": "All", "quickfix": "unknown" } diff --git a/java-checks/src/main/resources/org/sonar/l10n/java/rules/java/S1066_java.json b/java-checks/src/main/resources/org/sonar/l10n/java/rules/java/S1066_java.json index 16f59cf6f31..3089fe0f1ca 100644 --- a/java-checks/src/main/resources/org/sonar/l10n/java/rules/java/S1066_java.json +++ b/java-checks/src/main/resources/org/sonar/l10n/java/rules/java/S1066_java.json @@ -12,6 +12,6 @@ "defaultSeverity": "Major", "ruleSpecification": "RSPEC-1066", "sqKey": "S1066", - "scope": "Main", + "scope": "All", "quickfix": "unknown" } diff --git a/java-checks/src/main/resources/org/sonar/l10n/java/rules/java/S1067_java.json b/java-checks/src/main/resources/org/sonar/l10n/java/rules/java/S1067_java.json index 97a5baaacb5..b6f4b5ac3d7 100644 --- a/java-checks/src/main/resources/org/sonar/l10n/java/rules/java/S1067_java.json +++ b/java-checks/src/main/resources/org/sonar/l10n/java/rules/java/S1067_java.json @@ -14,6 +14,6 @@ "defaultSeverity": "Critical", "ruleSpecification": "RSPEC-1067", "sqKey": "S1067", - "scope": "Main", + "scope": "All", "quickfix": "unknown" } diff --git a/java-checks/src/main/resources/org/sonar/l10n/java/rules/java/S106_java.html b/java-checks/src/main/resources/org/sonar/l10n/java/rules/java/S106_java.html index 46207f637b3..36b4f96f946 100644 --- a/java-checks/src/main/resources/org/sonar/l10n/java/rules/java/S106_java.html +++ b/java-checks/src/main/resources/org/sonar/l10n/java/rules/java/S106_java.html @@ -17,6 +17,10 @@
These methods are ignored inside main
.
This rule ignores initializations to -1, 0, 1, null
, true
, false
and ""
.
@@ -47,9 +47,11 @@Compliant Solution
Random
, then store, and reuse it.
The Random()
constructor tries to set the seed with a distinct value every time. However there is no guarantee that the seed will be
random or even uniformly distributed. Some JDK will use the current time as seed, which makes the generated numbers not random at all.
This rule finds cases where a new Random
is created each time a method is invoked and assigned to a local random variable.
This rule finds cases where a new Random
is created each time a method is invoked.
public void doSomethingCommon() { diff --git a/java-checks/src/main/resources/org/sonar/l10n/java/rules/java/S2123_java.json b/java-checks/src/main/resources/org/sonar/l10n/java/rules/java/S2123_java.json index b0429182c84..52ca02df422 100644 --- a/java-checks/src/main/resources/org/sonar/l10n/java/rules/java/S2123_java.json +++ b/java-checks/src/main/resources/org/sonar/l10n/java/rules/java/S2123_java.json @@ -12,6 +12,6 @@ "defaultSeverity": "Major", "ruleSpecification": "RSPEC-2123", "sqKey": "S2123", - "scope": "Main", + "scope": "All", "quickfix": "unknown" } diff --git a/java-checks/src/main/resources/org/sonar/l10n/java/rules/java/S2142_java.html b/java-checks/src/main/resources/org/sonar/l10n/java/rules/java/S2142_java.html index 20b40032855..750c61454d8 100644 --- a/java-checks/src/main/resources/org/sonar/l10n/java/rules/java/S2142_java.html +++ b/java-checks/src/main/resources/org/sonar/l10n/java/rules/java/S2142_java.html @@ -36,6 +36,6 @@Compliant Solution
In these cases it is obvious the code is as intended.
Spring @Controller
, @Service
, and @Repository
classes are singletons by default, meaning only one instance
of the class is ever instantiated in the application. Typically such a class might have a few static
members, such as a logger, but all
non-static members should be managed by Spring and supplied via constructor injection rather than by field injection.
This rule raise an issue when any non-static
member of a Spring component has an injection annotation, or if the constructor of Spring
-component does not have injection annotation.
This rule raise an issue when any non-static
member of a Spring component has an injection annotation.
@Controller @@ -11,27 +10,32 @@Noncompliant Code Example
@Autowired private String name = null; // Noncompliant - HelloWorld() { - // ... - } - - // ... }
As of Spring 4.3
@Controller public class HelloWorld { private String name = null; - @Autowired HelloWorld(String name) { this.name = name; - // ... } +} ++
Before Spring 4.3
++@Controller +public class HelloWorld { + + private String name = null; - // ... + @Autowired + HelloWorld(String name) { + this.name = name; + } }diff --git a/java-checks/src/main/resources/org/sonar/l10n/java/rules/java/S4347_java.html b/java-checks/src/main/resources/org/sonar/l10n/java/rules/java/S4347_java.html index 7acd444a7ff..3c1d715474a 100644 --- a/java-checks/src/main/resources/org/sonar/l10n/java/rules/java/S4347_java.html +++ b/java-checks/src/main/resources/org/sonar/l10n/java/rules/java/S4347_java.html @@ -23,6 +23,7 @@
ActiveMQ can send/receive JMS Object messages (named ObjectMessage in ActiveMQ context) to comply with JMS specification. Internally, ActiveMQ -relies on Java serialization mechanism for marshaling/unmashaling of the message payload. Deserialization based on data supplied by the user could +relies on Java serialization mechanism for marshaling/unmarshaling of the message payload. Deserialization based on data supplied by the user could lead to remote code execution attacks, where the structure of the serialized data is changed to modify the behavior of the object being unserialized.
To limit the risk to be victim of such attack, ActiveMQ 5.12.2+ enforces developers to explicitly whitelist packages that can be exchanged using @@ -19,6 +19,8 @@
Don’t use x-powered-by
or Server
HTTP header or any other means disclosing fingerprints of the application.
To avoid syntax errors, special characters should be escaped with backslashes when they are intended to be matched literally and references to capturing groups should use the correctly spelled name or number of the group.
-To match a literal string, rather than a regular expression, either all special characters should be escaped or the Pattern.LITERAL
-flag or methods that don’t use regular expressions should be used.
To match a literal string instead of a regular expression, either all special characters should be escaped, the Pattern.LITERAL
flag
+or methods that don’t use regular expressions should be used.
Pattern.compile("(["); diff --git a/java-checks/src/main/resources/org/sonar/l10n/java/rules/java/S5856_java.json b/java-checks/src/main/resources/org/sonar/l10n/java/rules/java/S5856_java.json index a8ab3f03627..ccb1fd05b08 100644 --- a/java-checks/src/main/resources/org/sonar/l10n/java/rules/java/S5856_java.json +++ b/java-checks/src/main/resources/org/sonar/l10n/java/rules/java/S5856_java.json @@ -12,6 +12,6 @@ "defaultSeverity": "Critical", "ruleSpecification": "RSPEC-5856", "sqKey": "S5856", - "scope": "Main", + "scope": "All", "quickfix": "unknown" } diff --git a/java-checks/src/main/resources/org/sonar/l10n/java/rules/java/S5860_java.json b/java-checks/src/main/resources/org/sonar/l10n/java/rules/java/S5860_java.json index 66447cc1bd2..fd4e6896bf5 100644 --- a/java-checks/src/main/resources/org/sonar/l10n/java/rules/java/S5860_java.json +++ b/java-checks/src/main/resources/org/sonar/l10n/java/rules/java/S5860_java.json @@ -12,6 +12,6 @@ "defaultSeverity": "Major", "ruleSpecification": "RSPEC-5860", "sqKey": "S5860", - "scope": "Main", + "scope": "All", "quickfix": "unknown" } diff --git a/java-checks/src/main/resources/org/sonar/l10n/java/rules/java/S5867_java.json b/java-checks/src/main/resources/org/sonar/l10n/java/rules/java/S5867_java.json index f6d01151a12..809ef8c6532 100644 --- a/java-checks/src/main/resources/org/sonar/l10n/java/rules/java/S5867_java.json +++ b/java-checks/src/main/resources/org/sonar/l10n/java/rules/java/S5867_java.json @@ -12,6 +12,6 @@ "defaultSeverity": "Minor", "ruleSpecification": "RSPEC-5867", "sqKey": "S5867", - "scope": "Main", + "scope": "All", "quickfix": "unknown" } diff --git a/java-checks/src/main/resources/org/sonar/l10n/java/rules/java/S5868_java.json b/java-checks/src/main/resources/org/sonar/l10n/java/rules/java/S5868_java.json index c52d98649ee..d85a51caedd 100644 --- a/java-checks/src/main/resources/org/sonar/l10n/java/rules/java/S5868_java.json +++ b/java-checks/src/main/resources/org/sonar/l10n/java/rules/java/S5868_java.json @@ -12,6 +12,6 @@ "defaultSeverity": "Major", "ruleSpecification": "RSPEC-5868", "sqKey": "S5868", - "scope": "Main", + "scope": "All", "quickfix": "unknown" } diff --git a/java-checks/src/main/resources/org/sonar/l10n/java/rules/java/S5869_java.json b/java-checks/src/main/resources/org/sonar/l10n/java/rules/java/S5869_java.json index 33adeb113c6..f79ce26d85d 100644 --- a/java-checks/src/main/resources/org/sonar/l10n/java/rules/java/S5869_java.json +++ b/java-checks/src/main/resources/org/sonar/l10n/java/rules/java/S5869_java.json @@ -12,6 +12,6 @@ "defaultSeverity": "Major", "ruleSpecification": "RSPEC-5869", "sqKey": "S5869", - "scope": "Main", + "scope": "All", "quickfix": "unknown" } diff --git a/java-checks/src/main/resources/org/sonar/l10n/java/rules/java/S5876_java.html b/java-checks/src/main/resources/org/sonar/l10n/java/rules/java/S5876_java.html index bcc3906ef49..f7d73b2bb03 100644 --- a/java-checks/src/main/resources/org/sonar/l10n/java/rules/java/S5876_java.html +++ b/java-checks/src/main/resources/org/sonar/l10n/java/rules/java/S5876_java.html @@ -27,6 +27,8 @@Compliant Solution