aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Brandhof <simon.brandhof@gmail.com>2012-04-03 10:08:48 +0200
committerSimon Brandhof <simon.brandhof@gmail.com>2012-04-03 10:08:48 +0200
commit38e53c0572db4e267a704666cb0d1343992df5e1 (patch)
tree7b7bf7acb697d244dbf6ca03466b35c929662b24
parentc881206bd9f2edfd6a5586ec735d003bd73d367d (diff)
downloadsonarqube-38e53c0572db4e267a704666cb0d1343992df5e1.tar.gz
sonarqube-38e53c0572db4e267a704666cb0d1343992df5e1.zip
Fix some quality flaws
-rw-r--r--plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/sensors/ViolationsDecorator.java1
-rw-r--r--plugins/sonar-design-plugin/src/main/java/org/sonar/plugins/design/ui/page/GwtDesignPage.java13
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/components/PastSnapshotFinder.java22
-rw-r--r--sonar-colorizer/src/main/java/org/sonar/colorizer/GroovyKeywords.java7
-rw-r--r--sonar-colorizer/src/main/java/org/sonar/colorizer/JavaKeywords.java6
-rw-r--r--sonar-colorizer/src/main/java/org/sonar/colorizer/JavaTokenizers.java10
-rw-r--r--sonar-colorizer/src/main/java/org/sonar/colorizer/TokenizerDispatcher.java11
-rw-r--r--sonar-core/src/main/java/org/sonar/core/resource/ResourceIndexerDao.java1
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/resources/Library.java1
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/utils/dag/Node.java10
-rw-r--r--sonar-server/src/main/java/org/sonar/server/charts/ChartsServlet.java12
-rw-r--r--sonar-server/src/main/java/org/sonar/server/charts/deprecated/BarChart.java11
-rw-r--r--sonar-server/src/main/java/org/sonar/server/charts/deprecated/BaseChartWeb.java1
-rw-r--r--sonar-server/src/main/java/org/sonar/server/charts/deprecated/CustomBarChart.java6
-rw-r--r--sonar-server/src/main/java/org/sonar/server/charts/deprecated/PieChart.java1
-rw-r--r--sonar-server/src/main/java/org/sonar/server/plugins/ClassLoaderUtils.java10
-rw-r--r--sonar-server/src/main/java/org/sonar/server/plugins/StaticResourcesServlet.java10
17 files changed, 66 insertions, 67 deletions
diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/sensors/ViolationsDecorator.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/sensors/ViolationsDecorator.java
index eb4ade51a18..e17ca8784da 100644
--- a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/sensors/ViolationsDecorator.java
+++ b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/sensors/ViolationsDecorator.java
@@ -57,6 +57,7 @@ public class ViolationsDecorator implements Decorator {
CoreMetrics.INFO_VIOLATIONS);
}
+ @Override
public void decorate(Resource resource, DecoratorContext context) {
if (shouldDecorateResource(resource)) {
computeTotalViolations(context);
diff --git a/plugins/sonar-design-plugin/src/main/java/org/sonar/plugins/design/ui/page/GwtDesignPage.java b/plugins/sonar-design-plugin/src/main/java/org/sonar/plugins/design/ui/page/GwtDesignPage.java
index f1c4188110a..27598c65399 100644
--- a/plugins/sonar-design-plugin/src/main/java/org/sonar/plugins/design/ui/page/GwtDesignPage.java
+++ b/plugins/sonar-design-plugin/src/main/java/org/sonar/plugins/design/ui/page/GwtDesignPage.java
@@ -21,20 +21,15 @@ package org.sonar.plugins.design.ui.page;
import org.sonar.api.measures.CoreMetrics;
import org.sonar.api.resources.Qualifiers;
-import org.sonar.api.web.DefaultTab;
-import org.sonar.api.web.GwtPage;
-import org.sonar.api.web.NavigationSection;
-import org.sonar.api.web.RequiredMeasures;
-import org.sonar.api.web.ResourceQualifier;
-import org.sonar.api.web.UserRole;
+import org.sonar.api.web.*;
import org.sonar.plugins.design.ui.page.client.DesignPage;
@RequiredMeasures(allOf = {CoreMetrics.DEPENDENCY_MATRIX_KEY})
@ResourceQualifier({Qualifiers.PROJECT, Qualifiers.MODULE, Qualifiers.PACKAGE, Qualifiers.DIRECTORY})
@DefaultTab(metrics = {
- CoreMetrics.DEPENDENCY_MATRIX_KEY, CoreMetrics.PACKAGE_FEEDBACK_EDGES_KEY, CoreMetrics.PACKAGE_CYCLES_KEY,
- CoreMetrics.PACKAGE_TANGLE_INDEX_KEY, CoreMetrics.PACKAGE_TANGLES_KEY, CoreMetrics.FILE_CYCLES_KEY,
- CoreMetrics.FILE_TANGLE_INDEX_KEY, CoreMetrics.FILE_TANGLES_KEY, CoreMetrics.FILE_FEEDBACK_EDGES_KEY})
+ CoreMetrics.DEPENDENCY_MATRIX_KEY, CoreMetrics.PACKAGE_FEEDBACK_EDGES_KEY, CoreMetrics.PACKAGE_CYCLES_KEY,
+ CoreMetrics.PACKAGE_TANGLE_INDEX_KEY, CoreMetrics.PACKAGE_TANGLES_KEY, CoreMetrics.FILE_CYCLES_KEY,
+ CoreMetrics.FILE_TANGLE_INDEX_KEY, CoreMetrics.FILE_TANGLES_KEY, CoreMetrics.FILE_FEEDBACK_EDGES_KEY})
@NavigationSection({NavigationSection.RESOURCE, NavigationSection.RESOURCE_TAB})
@UserRole(UserRole.USER)
public class GwtDesignPage extends GwtPage {
diff --git a/sonar-batch/src/main/java/org/sonar/batch/components/PastSnapshotFinder.java b/sonar-batch/src/main/java/org/sonar/batch/components/PastSnapshotFinder.java
index 56c8f8468aa..f29752a07de 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/components/PastSnapshotFinder.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/components/PastSnapshotFinder.java
@@ -51,7 +51,7 @@ public class PastSnapshotFinder implements BatchExtension {
public PastSnapshot find(Snapshot projectSnapshot, Configuration conf, int index) {
String propertyValue = getPropertyValue(conf, index);
PastSnapshot pastSnapshot = find(projectSnapshot, index, propertyValue);
- if (pastSnapshot==null && StringUtils.isNotBlank(propertyValue)) {
+ if (pastSnapshot == null && StringUtils.isNotBlank(propertyValue)) {
Logs.INFO.debug("The property " + CoreProperties.TIMEMACHINE_PERIOD_PREFIX + index + " has an unvalid value: " + propertyValue);
}
return pastSnapshot;
@@ -60,11 +60,21 @@ public class PastSnapshotFinder implements BatchExtension {
static String getPropertyValue(Configuration conf, int index) {
String defaultValue = null;
switch (index) {
- case 1: defaultValue = CoreProperties.TIMEMACHINE_DEFAULT_PERIOD_1; break;
- case 2: defaultValue = CoreProperties.TIMEMACHINE_DEFAULT_PERIOD_2; break;
- case 3: defaultValue = CoreProperties.TIMEMACHINE_DEFAULT_PERIOD_3; break;
- case 4: defaultValue = CoreProperties.TIMEMACHINE_DEFAULT_PERIOD_4; break; // NOSONAR false-positive: constant 4 is the same than 5 (empty string)
- case 5: defaultValue = CoreProperties.TIMEMACHINE_DEFAULT_PERIOD_5; break; // NOSONAR false-positive: constant 5 is the same than 4 (empty string)
+ case 1:
+ defaultValue = CoreProperties.TIMEMACHINE_DEFAULT_PERIOD_1;
+ break;
+ case 2:
+ defaultValue = CoreProperties.TIMEMACHINE_DEFAULT_PERIOD_2;
+ break;
+ case 3:
+ defaultValue = CoreProperties.TIMEMACHINE_DEFAULT_PERIOD_3;
+ break;
+ case 4:
+ defaultValue = CoreProperties.TIMEMACHINE_DEFAULT_PERIOD_4;
+ break; // NOSONAR false-positive: constant 4 is the same than 5 (empty string)
+ case 5:
+ defaultValue = CoreProperties.TIMEMACHINE_DEFAULT_PERIOD_5;
+ break; // NOSONAR false-positive: constant 5 is the same than 4 (empty string)
}
return conf.getString(CoreProperties.TIMEMACHINE_PERIOD_PREFIX + index, defaultValue);
}
diff --git a/sonar-colorizer/src/main/java/org/sonar/colorizer/GroovyKeywords.java b/sonar-colorizer/src/main/java/org/sonar/colorizer/GroovyKeywords.java
index f0cb0afabd6..d22f0c06a22 100644
--- a/sonar-colorizer/src/main/java/org/sonar/colorizer/GroovyKeywords.java
+++ b/sonar-colorizer/src/main/java/org/sonar/colorizer/GroovyKeywords.java
@@ -27,10 +27,9 @@ public final class GroovyKeywords {
private static final Set<String> KEYWORDS = new HashSet<String>();
- private static final String[] GROOVY_KEYWORDS = new String[] { "as", "assert", "break", "case", "catch", "class", "continue", "def",
- "default", "do"
- , "else", "extends", "finally", "for", "if", "in", "implements", "import", "instanceof", "interface", "new", "package",
- "property", "return", "switch", "throw", "throws", "try", "while" };
+ private static final String[] GROOVY_KEYWORDS = new String[]{"as", "assert", "break", "case", "catch", "class", "continue", "def",
+ "default", "do", "else", "extends", "finally", "for", "if", "in", "implements", "import", "instanceof", "interface", "new", "package",
+ "property", "return", "switch", "throw", "throws", "try", "while"};
static {
Collections.addAll(KEYWORDS, GROOVY_KEYWORDS);
diff --git a/sonar-colorizer/src/main/java/org/sonar/colorizer/JavaKeywords.java b/sonar-colorizer/src/main/java/org/sonar/colorizer/JavaKeywords.java
index 97ddaf08c41..a9f00b5f1cd 100644
--- a/sonar-colorizer/src/main/java/org/sonar/colorizer/JavaKeywords.java
+++ b/sonar-colorizer/src/main/java/org/sonar/colorizer/JavaKeywords.java
@@ -27,11 +27,11 @@ public final class JavaKeywords {
private static final Set<String> KEYWORDS = new HashSet<String>();
- private static final String[] JAVA_KEYWORDS = new String[] { "abstract", "assert", "boolean", "break", "byte", "case", "catch", "char",
+ private static final String[] JAVA_KEYWORDS = new String[]{"abstract", "assert", "boolean", "break", "byte", "case", "catch", "char",
"class", "const", "continue", "default",
- "do", "double", "else", "enum", "extends", "false", "final", "finally", "float", "for",
+ "do", "double", "else", "enum", "extends", "false", "final", "finally", "float", "for",
"goto", "if", "implements", "import", "instanceof",
- "int", "interface", "long", "native", "new", "null", "package", "private",
+ "int", "interface", "long", "native", "new", "null", "package", "private",
"protected", "public", "return", "short", "static", "strictfp",
"super", "switch", "synchronized", "this", "throw", "throws", "transient", "true", "try", "void", "volatile", "while"};
diff --git a/sonar-colorizer/src/main/java/org/sonar/colorizer/JavaTokenizers.java b/sonar-colorizer/src/main/java/org/sonar/colorizer/JavaTokenizers.java
index 4f9659f6aca..898eb969656 100644
--- a/sonar-colorizer/src/main/java/org/sonar/colorizer/JavaTokenizers.java
+++ b/sonar-colorizer/src/main/java/org/sonar/colorizer/JavaTokenizers.java
@@ -29,9 +29,13 @@ public final class JavaTokenizers {
}
public static List<Tokenizer> forHtml() {
- return Collections.unmodifiableList(Arrays.asList(new JavaAnnotationTokenizer("<span class=\"a\">", "</span>"), new LiteralTokenizer(
- "<span class=\"s\">", "</span>"), new CDocTokenizer("<span class=\"cd\">", "</span>"), new JavadocTokenizer("<span class=\"j\">",
- "</span>"), new CppDocTokenizer("<span class=\"cppd\">", "</span>"), new JavaConstantTokenizer("<span class=\"c\">", "</span>"),
+ return Collections.unmodifiableList(Arrays.asList(
+ new JavaAnnotationTokenizer("<span class=\"a\">", "</span>"),
+ new LiteralTokenizer("<span class=\"s\">", "</span>"),
+ new CDocTokenizer("<span class=\"cd\">", "</span>"),
+ new JavadocTokenizer("<span class=\"j\">", "</span>"),
+ new CppDocTokenizer("<span class=\"cppd\">", "</span>"),
+ new JavaConstantTokenizer("<span class=\"c\">", "</span>"),
new KeywordsTokenizer("<span class=\"k\">", "</span>", JavaKeywords.get())));
}
}
diff --git a/sonar-colorizer/src/main/java/org/sonar/colorizer/TokenizerDispatcher.java b/sonar-colorizer/src/main/java/org/sonar/colorizer/TokenizerDispatcher.java
index 116598731e8..9e15ea5474a 100644
--- a/sonar-colorizer/src/main/java/org/sonar/colorizer/TokenizerDispatcher.java
+++ b/sonar-colorizer/src/main/java/org/sonar/colorizer/TokenizerDispatcher.java
@@ -19,11 +19,11 @@
*/
package org.sonar.colorizer;
-import java.util.List;
-
import org.sonar.channel.Channel;
import org.sonar.channel.CodeReader;
+import java.util.List;
+
public class TokenizerDispatcher {
private Channel[] tokenizers;
@@ -32,8 +32,8 @@ public class TokenizerDispatcher {
this.tokenizers = tokenizers;
}
- public TokenizerDispatcher(List<Channel<HtmlCodeBuilder>> tokenizers) {
- this.tokenizers = tokenizers.toArray(new Channel[0]); // NOSONAR performance is not an issue here
+ public TokenizerDispatcher(List<Channel<HtmlCodeBuilder>> tokenizersArray) {
+ this.tokenizers = tokenizersArray.toArray(new Channel[tokenizersArray.size()]);
}
public final String colorize(String code) {
@@ -44,7 +44,8 @@ public class TokenizerDispatcher {
public final void colorize(CodeReader code, HtmlCodeBuilder colorizedCode) {
cloneNotThreadSafeTokenizers();
- nextChar: while (code.peek() != -1) {
+ nextChar:
+ while (code.peek() != -1) {
for (Channel<HtmlCodeBuilder> codeTokenizer : tokenizers) {
if (codeTokenizer.consume(code, colorizedCode)) {
continue nextChar;
diff --git a/sonar-core/src/main/java/org/sonar/core/resource/ResourceIndexerDao.java b/sonar-core/src/main/java/org/sonar/core/resource/ResourceIndexerDao.java
index dc9df4e8f06..77e2831efee 100644
--- a/sonar-core/src/main/java/org/sonar/core/resource/ResourceIndexerDao.java
+++ b/sonar-core/src/main/java/org/sonar/core/resource/ResourceIndexerDao.java
@@ -19,7 +19,6 @@
*/
package org.sonar.core.resource;
-import org.apache.commons.lang.ArrayUtils;
import org.apache.commons.lang.StringUtils;
import org.apache.ibatis.session.ResultContext;
import org.apache.ibatis.session.ResultHandler;
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/resources/Library.java b/sonar-plugin-api/src/main/java/org/sonar/api/resources/Library.java
index 1f40f631f72..903da8f8a04 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/resources/Library.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/resources/Library.java
@@ -99,7 +99,6 @@ public final class Library extends Resource {
return false;
}
return version.equals(library.version);
-
}
@Override
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/utils/dag/Node.java b/sonar-plugin-api/src/main/java/org/sonar/api/utils/dag/Node.java
index 897f3e04cc0..7781adc91f4 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/utils/dag/Node.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/utils/dag/Node.java
@@ -56,11 +56,11 @@ public class Node implements Comparable<Node> {
}
}
- public void resolveOrder() throws CyclicDependenciesException {
+ public void resolveOrder() {
resolveOrder(toString());
}
- private int resolveOrder(String path) throws CyclicDependenciesException {
+ private int resolveOrder(String path) {
seen = true;
try {
int highOrder = -1;
@@ -96,10 +96,6 @@ public class Node implements Comparable<Node> {
return orderInd;
}
- public int getOrder() {
- return order;
- }
-
@Override
public String toString() {
return object.toString();
@@ -113,7 +109,6 @@ public class Node implements Comparable<Node> {
if (!(o instanceof Node)) {
return false;
}
-
return object.equals(((Node) o).getObject());
}
@@ -121,6 +116,5 @@ public class Node implements Comparable<Node> {
public int hashCode() {
return object.hashCode();
}
-
}
diff --git a/sonar-server/src/main/java/org/sonar/server/charts/ChartsServlet.java b/sonar-server/src/main/java/org/sonar/server/charts/ChartsServlet.java
index 81660dcca1c..2a39719585d 100644
--- a/sonar-server/src/main/java/org/sonar/server/charts/ChartsServlet.java
+++ b/sonar-server/src/main/java/org/sonar/server/charts/ChartsServlet.java
@@ -19,6 +19,7 @@
*/
package org.sonar.server.charts;
+import com.google.common.collect.Maps;
import org.apache.commons.io.IOUtils;
import org.jfree.chart.encoders.KeypointPNGEncoderAdapter;
import org.slf4j.Logger;
@@ -45,8 +46,7 @@ public class ChartsServlet extends HttpServlet {
private static final long serialVersionUID = 669857447198433893L;
@Override
- public void doGet(HttpServletRequest request, HttpServletResponse response)
- throws ServletException, IOException {
+ public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
if (isDeprecatedChart(request)) {
deprecatedDoGet(request, response);
@@ -71,7 +71,7 @@ public class ChartsServlet extends HttpServlet {
}
private ChartParameters getParams(HttpServletRequest request) {
- Map<String, String> map = new HashMap<String, String>();
+ Map<String, String> map = Maps.newHashMap();
Enumeration keys = request.getParameterNames();
while (keys.hasMoreElements()) {
String key = (String) keys.nextElement();
@@ -104,10 +104,8 @@ public class ChartsServlet extends HttpServlet {
return false;
}
- public void deprecatedDoGet(HttpServletRequest request, HttpServletResponse response)
- throws ServletException, IOException {
-
- Map<String, String> params = new HashMap<String, String>();
+ public void deprecatedDoGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
+ Map<String, String> params = Maps.newHashMap();
params.put(BaseChartWeb.CHART_PARAM_TYPE, request.getParameter(BaseChartWeb.CHART_PARAM_TYPE));
params.put(BaseChartWeb.CHART_PARAM_VALUES, request.getParameter(BaseChartWeb.CHART_PARAM_VALUES));
params.put(BaseChartWeb.CHART_PARAM_COLORS, request.getParameter(BaseChartWeb.CHART_PARAM_COLORS));
diff --git a/sonar-server/src/main/java/org/sonar/server/charts/deprecated/BarChart.java b/sonar-server/src/main/java/org/sonar/server/charts/deprecated/BarChart.java
index 41ddae8886e..32e9821ecb9 100644
--- a/sonar-server/src/main/java/org/sonar/server/charts/deprecated/BarChart.java
+++ b/sonar-server/src/main/java/org/sonar/server/charts/deprecated/BarChart.java
@@ -169,14 +169,13 @@ public class BarChart extends BaseChartWeb implements DeprecatedChart {
// Categories
String categoriesParam = params.get(BaseChartWeb.CHART_PARAM_CATEGORIES);
boolean categoriesPresent = categoriesParam != null && categoriesParam.length() > 0;
- String[] categoriesSplit = null;
+ String[] categoriesSplit;
if (categoriesPresent) {
categoriesSplit = categoriesParam.split(",");
} else {
categoriesSplit = new String[1];
categoriesSplit[0] = BaseChartWeb.DEFAULT_NAME_CATEGORY;
}
- int nbCategories = categoriesSplit.length;
// Series
String seriesParam = params.get(BaseChartWeb.CHART_PARAM_SERIES);
@@ -190,17 +189,15 @@ public class BarChart extends BaseChartWeb implements DeprecatedChart {
seriesSplit[i] = BaseChartWeb.DEFAULT_NAME_SERIE + i;
}
}
- int nbSeries = seriesSplit.length;
- for (int iCategories = 0; iCategories < nbCategories; iCategories++) {
- String currentCategory = categoriesSplit[iCategories];
- for (int iSeries = 0; iSeries < nbSeries; iSeries++) {
- String currentSerie = seriesSplit[iSeries];
+ for (String currentCategory : categoriesSplit) {
+ for (String currentSerie : seriesSplit) {
double currentValue = 0.0;
if (stValues.hasMoreTokens()) {
try {
currentValue = Double.parseDouble(stValues.nextToken());
} catch (NumberFormatException e) {
+ // ignore
}
}
dataset.addValue(currentValue, currentSerie, currentCategory);
diff --git a/sonar-server/src/main/java/org/sonar/server/charts/deprecated/BaseChartWeb.java b/sonar-server/src/main/java/org/sonar/server/charts/deprecated/BaseChartWeb.java
index 722eae4b242..cd6ead87c02 100644
--- a/sonar-server/src/main/java/org/sonar/server/charts/deprecated/BaseChartWeb.java
+++ b/sonar-server/src/main/java/org/sonar/server/charts/deprecated/BaseChartWeb.java
@@ -119,6 +119,7 @@ public abstract class BaseChartWeb extends BaseChart {
result = Double.parseDouble(paramValue);
}
catch (NumberFormatException e) {
+ // ignore
}
}
return result;
diff --git a/sonar-server/src/main/java/org/sonar/server/charts/deprecated/CustomBarChart.java b/sonar-server/src/main/java/org/sonar/server/charts/deprecated/CustomBarChart.java
index dd1cf0d20da..db5b3d8c168 100644
--- a/sonar-server/src/main/java/org/sonar/server/charts/deprecated/CustomBarChart.java
+++ b/sonar-server/src/main/java/org/sonar/server/charts/deprecated/CustomBarChart.java
@@ -118,15 +118,12 @@ public class CustomBarChart extends BarChart {
categoriesSplit[i] = DEFAULT_NAME_CATEGORY + i;
}
}
- int nbCategories = categoriesSplit.length;
// Series
String[] seriesSplit = {DEFAULT_NAME_SERIE};
int nbSeries = 1;
- //
- for (int iCategories = 0; iCategories < nbCategories; iCategories++) {
- String currentCategory = categoriesSplit[iCategories];
+ for (String currentCategory : categoriesSplit) {
for (int iSeries = 0; iSeries < nbSeries; iSeries++) {
String currentSerie = seriesSplit[iSeries];
double currentValue = 0.0;
@@ -134,6 +131,7 @@ public class CustomBarChart extends BarChart {
try {
currentValue = Double.parseDouble(stValues.nextToken());
} catch (NumberFormatException e) {
+ // ignore
}
}
dataset.addValue(currentValue, currentSerie, currentCategory);
diff --git a/sonar-server/src/main/java/org/sonar/server/charts/deprecated/PieChart.java b/sonar-server/src/main/java/org/sonar/server/charts/deprecated/PieChart.java
index f8b6da3ef83..2c28dc1255b 100644
--- a/sonar-server/src/main/java/org/sonar/server/charts/deprecated/PieChart.java
+++ b/sonar-server/src/main/java/org/sonar/server/charts/deprecated/PieChart.java
@@ -119,6 +119,7 @@ public class PieChart extends BaseChartWeb implements DeprecatedChart {
measure = Double.parseDouble(st.nextToken());
}
catch (NumberFormatException e) {
+ // ignore
}
dataset.setValue(Integer.toString(i), measure);
i++;
diff --git a/sonar-server/src/main/java/org/sonar/server/plugins/ClassLoaderUtils.java b/sonar-server/src/main/java/org/sonar/server/plugins/ClassLoaderUtils.java
index 9b971a24dc9..21c9df014bd 100644
--- a/sonar-server/src/main/java/org/sonar/server/plugins/ClassLoaderUtils.java
+++ b/sonar-server/src/main/java/org/sonar/server/plugins/ClassLoaderUtils.java
@@ -99,9 +99,7 @@ public final class ClassLoaderUtils {
URL root = classLoader.getResource(rootPath);
if (root != null) {
- if (!"jar".equals(root.getProtocol())) {
- throw new IllegalStateException("Unsupported protocol: " + root.getProtocol());
- }
+ checkJarFile(root);
// Path of the root directory
// Examples :
@@ -127,4 +125,10 @@ public final class ClassLoaderUtils {
throw Throwables.propagate(e);
}
}
+
+ private static void checkJarFile(URL root) {
+ if (!"jar".equals(root.getProtocol())) {
+ throw new IllegalStateException("Unsupported protocol: " + root.getProtocol());
+ }
+ }
}
diff --git a/sonar-server/src/main/java/org/sonar/server/plugins/StaticResourcesServlet.java b/sonar-server/src/main/java/org/sonar/server/plugins/StaticResourcesServlet.java
index d84970b7ae8..6e06c03e0e7 100644
--- a/sonar-server/src/main/java/org/sonar/server/plugins/StaticResourcesServlet.java
+++ b/sonar-server/src/main/java/org/sonar/server/plugins/StaticResourcesServlet.java
@@ -25,14 +25,13 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.sonar.server.platform.Platform;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
public class StaticResourcesServlet extends HttpServlet {
@@ -40,8 +39,7 @@ public class StaticResourcesServlet extends HttpServlet {
private static final long serialVersionUID = -2577454614650178426L;
@Override
- public void doGet(HttpServletRequest request, HttpServletResponse response)
- throws ServletException, IOException {
+ public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
String pluginKey = getPluginKey(request);
String resource = getResourcePath(request);