aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-plugin-api
diff options
context:
space:
mode:
authorSimon Brandhof <simon.brandhof@gmail.com>2013-09-02 17:23:16 +0200
committerSimon Brandhof <simon.brandhof@gmail.com>2013-09-02 17:23:16 +0200
commitabb2e152f99285512a4d5281562c69338cd23efd (patch)
treedabc9e9040a7279d9096e500d2f3c24ecb11d5f0 /sonar-plugin-api
parent00e0421d707e63ed043117ee6563a1395d76cdb6 (diff)
downloadsonarqube-abb2e152f99285512a4d5281562c69338cd23efd.tar.gz
sonarqube-abb2e152f99285512a4d5281562c69338cd23efd.zip
Fix some quality flaws
Diffstat (limited to 'sonar-plugin-api')
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/measures/MeasuresFilters.java6
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/utils/LocalizedMessages.java56
2 files changed, 30 insertions, 32 deletions
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/measures/MeasuresFilters.java b/sonar-plugin-api/src/main/java/org/sonar/api/measures/MeasuresFilters.java
index 35c888403b5..2806ef43f23 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/measures/MeasuresFilters.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/measures/MeasuresFilters.java
@@ -136,10 +136,8 @@ public final class MeasuresFilters {
return new MetricFilter<Collection<RuleMeasure>>(metric) {
private boolean apply(Measure measure) {
- return measure instanceof RuleMeasure
- && metric.equals(measure.getMetric())
- && measure.getPersonId() == null
- && ((RuleMeasure) measure).getRule() != null;
+ return measure instanceof RuleMeasure && metric.equals(measure.getMetric())
+ && measure.getPersonId() == null && ((RuleMeasure) measure).getRule() != null;
}
public Collection<RuleMeasure> filter(Collection<Measure> measures) {
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/utils/LocalizedMessages.java b/sonar-plugin-api/src/main/java/org/sonar/api/utils/LocalizedMessages.java
index d2f62876334..3a14965bd7a 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/utils/LocalizedMessages.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/utils/LocalizedMessages.java
@@ -73,35 +73,13 @@ public class LocalizedMessages extends ResourceBundle {
}
/*
- * (non-Javadoc)
- *
- * @see java.util.ResourceBundle#getKeys()
- */
-
+ * (non-Javadoc)
+ *
+ * @see java.util.ResourceBundle#getKeys()
+ */
@Override
public Enumeration<String> getKeys() {
- return new Enumeration<String>() {
- private Set<String> keys = new HashSet<String>();
-
- // Set iterator to simulate enumeration
- private Iterator<String> i;
-
- // Constructor
- {
- for (ResourceBundle b : bundles) {
- keys.addAll(Lists.newArrayList(Iterators.forEnumeration(b.getKeys())));
- }
- i = keys.iterator();
- }
-
- public boolean hasMoreElements() {
- return i.hasNext();
- }
-
- public String nextElement() {
- return i.next();
- }
- };
+ return new KeyEnumeration();
}
/*
@@ -109,7 +87,6 @@ public class LocalizedMessages extends ResourceBundle {
*
* @see java.util.ResourceBundle#handleGetObject(java.lang.String)
*/
-
@Override
protected Object handleGetObject(String key) {
for (ResourceBundle b : bundles) {
@@ -121,4 +98,27 @@ public class LocalizedMessages extends ResourceBundle {
}
throw new MissingResourceException(null, null, key);
}
+
+ private class KeyEnumeration implements Enumeration<String> {
+ private Set<String> keys = new HashSet<String>();
+
+ // Set iterator to simulate enumeration
+ private Iterator<String> i;
+
+ // Constructor
+ {
+ for (ResourceBundle b : bundles) {
+ keys.addAll(Lists.newArrayList(Iterators.forEnumeration(b.getKeys())));
+ }
+ i = keys.iterator();
+ }
+
+ public boolean hasMoreElements() {
+ return i.hasNext();
+ }
+
+ public String nextElement() {
+ return i.next();
+ }
+ }
}