aboutsummaryrefslogtreecommitdiffstats
path: root/server
diff options
context:
space:
mode:
authorGabor Liptak <gliptak@gmail.com>2015-06-17 13:45:37 -0400
committerGabor Liptak <gliptak@gmail.com>2015-06-17 13:45:37 -0400
commit6f7dcf0f6ad046940c37a14041e2ddd02c457776 (patch)
tree9022c22c58ff90949dc098b5866590ee56fbbdcb /server
parent8714a329c98b2610cf54632400e33447b7bf7448 (diff)
downloadsonarqube-6f7dcf0f6ad046940c37a14041e2ddd02c457776.tar.gz
sonarqube-6f7dcf0f6ad046940c37a14041e2ddd02c457776.zip
Cleanup warnings
Diffstat (limited to 'server')
-rw-r--r--server/sonar-process/src/test/java/org/sonar/process/LogbackHelperTest.java2
-rw-r--r--server/sonar-search/src/main/java/org/sonar/search/SearchLogging.java4
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/app/WebLogging.java4
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/db/BaseDao.java2
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/es/request/ProxyBulkRequestBuilder.java2
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/issue/index/IssueAuthorizationIndexer.java3
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/ui/Views.java12
-rw-r--r--server/sonar-server/src/test/java/org/sonar/server/app/ProgrammaticLogbackValveTest.java4
-rw-r--r--server/sonar-server/src/test/java/org/sonar/server/ui/ViewProxyTest.java30
-rw-r--r--server/sonar-server/src/test/java/org/sonar/server/ui/ViewsTest.java12
10 files changed, 40 insertions, 35 deletions
diff --git a/server/sonar-process/src/test/java/org/sonar/process/LogbackHelperTest.java b/server/sonar-process/src/test/java/org/sonar/process/LogbackHelperTest.java
index e4cad8faea8..1e2a9756224 100644
--- a/server/sonar-process/src/test/java/org/sonar/process/LogbackHelperTest.java
+++ b/server/sonar-process/src/test/java/org/sonar/process/LogbackHelperTest.java
@@ -81,7 +81,7 @@ public class LogbackHelperTest {
@Test
public void newConsoleAppender() {
LoggerContext ctx = sut.getRootContext();
- ConsoleAppender appender = sut.newConsoleAppender(ctx, "MY_APPENDER", "%msg%n");
+ ConsoleAppender<?> appender = sut.newConsoleAppender(ctx, "MY_APPENDER", "%msg%n");
assertThat(appender.getName()).isEqualTo("MY_APPENDER");
assertThat(appender.getContext()).isSameAs(ctx);
diff --git a/server/sonar-search/src/main/java/org/sonar/search/SearchLogging.java b/server/sonar-search/src/main/java/org/sonar/search/SearchLogging.java
index 2c2d45ad39b..bb031f8407f 100644
--- a/server/sonar-search/src/main/java/org/sonar/search/SearchLogging.java
+++ b/server/sonar-search/src/main/java/org/sonar/search/SearchLogging.java
@@ -22,7 +22,9 @@ package org.sonar.search;
import ch.qos.logback.classic.Level;
import ch.qos.logback.classic.Logger;
import ch.qos.logback.classic.LoggerContext;
+import ch.qos.logback.classic.spi.ILoggingEvent;
import ch.qos.logback.core.ConsoleAppender;
+
import org.sonar.process.LogbackHelper;
public class SearchLogging {
@@ -35,7 +37,7 @@ public class SearchLogging {
LoggerContext ctx = helper.getRootContext();
ctx.reset();
- ConsoleAppender consoleAppender = helper.newConsoleAppender(ctx, "CONSOLE", LOG_FORMAT);
+ ConsoleAppender<ILoggingEvent> consoleAppender = helper.newConsoleAppender(ctx, "CONSOLE", LOG_FORMAT);
Logger rootLogger = helper.configureLogger(ctx, Logger.ROOT_LOGGER_NAME, Level.INFO);
rootLogger.addAppender(consoleAppender);
return ctx;
diff --git a/server/sonar-server/src/main/java/org/sonar/server/app/WebLogging.java b/server/sonar-server/src/main/java/org/sonar/server/app/WebLogging.java
index a434e44159c..2e1e88c499a 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/app/WebLogging.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/app/WebLogging.java
@@ -22,7 +22,9 @@ package org.sonar.server.app;
import ch.qos.logback.classic.Level;
import ch.qos.logback.classic.Logger;
import ch.qos.logback.classic.LoggerContext;
+import ch.qos.logback.classic.spi.ILoggingEvent;
import ch.qos.logback.core.ConsoleAppender;
+
import org.slf4j.bridge.SLF4JBridgeHandler;
import org.sonar.api.utils.MessageException;
import org.sonar.process.LogbackHelper;
@@ -56,7 +58,7 @@ class WebLogging {
}
private void configureAppender(LoggerContext ctx) {
- ConsoleAppender consoleAppender = helper.newConsoleAppender(ctx, "CONSOLE", LOG_FORMAT);
+ ConsoleAppender<ILoggingEvent> consoleAppender = helper.newConsoleAppender(ctx, "CONSOLE", LOG_FORMAT);
ctx.getLogger(Logger.ROOT_LOGGER_NAME).addAppender(consoleAppender);
}
diff --git a/server/sonar-server/src/main/java/org/sonar/server/db/BaseDao.java b/server/sonar-server/src/main/java/org/sonar/server/db/BaseDao.java
index e0875201856..83b46ae6209 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/db/BaseDao.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/db/BaseDao.java
@@ -215,7 +215,7 @@ public abstract class BaseDao<MAPPER, DTO extends Dto<KEY>, KEY extends Serializ
item.setUpdatedAt(now);
doUpdate(session, item);
if (hasIndex()) {
- session.enqueue(new UpsertDto(getIndexType(), item));
+ session.enqueue(new UpsertDto<DTO>(getIndexType(), item));
}
} catch (Exception e) {
throw new IllegalStateException("Fail to update item in db: " + item, e);
diff --git a/server/sonar-server/src/main/java/org/sonar/server/es/request/ProxyBulkRequestBuilder.java b/server/sonar-server/src/main/java/org/sonar/server/es/request/ProxyBulkRequestBuilder.java
index acb87886f66..e3ca7507fa5 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/es/request/ProxyBulkRequestBuilder.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/es/request/ProxyBulkRequestBuilder.java
@@ -82,7 +82,7 @@ public class ProxyBulkRequestBuilder extends BulkRequestBuilder {
message.append("Bulk[");
Multiset<BulkRequestKey> groupedRequests = LinkedHashMultiset.create();
for (int i = 0; i < request.requests().size(); i++) {
- ActionRequest item = request.requests().get(i);
+ ActionRequest<?> item = request.requests().get(i);
String requestType, index, docType;
if (item instanceof IndexRequest) {
IndexRequest request = (IndexRequest) item;
diff --git a/server/sonar-server/src/main/java/org/sonar/server/issue/index/IssueAuthorizationIndexer.java b/server/sonar-server/src/main/java/org/sonar/server/issue/index/IssueAuthorizationIndexer.java
index 0a8c3efd3f4..5965b32a07b 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/issue/index/IssueAuthorizationIndexer.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/issue/index/IssueAuthorizationIndexer.java
@@ -95,13 +95,12 @@ public class IssueAuthorizationIndexer extends BaseIndexer {
}
private ActionRequest newUpdateRequest(IssueAuthorizationDao.Dto dto) {
- ActionRequest request;
Map<String, Object> doc = ImmutableMap.of(
IssueIndexDefinition.FIELD_AUTHORIZATION_PROJECT_UUID, dto.getProjectUuid(),
IssueIndexDefinition.FIELD_AUTHORIZATION_GROUPS, dto.getGroups(),
IssueIndexDefinition.FIELD_AUTHORIZATION_USERS, dto.getUsers(),
IssueIndexDefinition.FIELD_AUTHORIZATION_UPDATED_AT, new Date(dto.getUpdatedAt()));
- request = new UpdateRequest(IssueIndexDefinition.INDEX, IssueIndexDefinition.TYPE_AUTHORIZATION, dto.getProjectUuid())
+ ActionRequest<?> request = new UpdateRequest(IssueIndexDefinition.INDEX, IssueIndexDefinition.TYPE_AUTHORIZATION, dto.getProjectUuid())
.routing(dto.getProjectUuid())
.doc(doc)
.upsert(doc);
diff --git a/server/sonar-server/src/main/java/org/sonar/server/ui/Views.java b/server/sonar-server/src/main/java/org/sonar/server/ui/Views.java
index e70b00c8041..4ad9a25d040 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/ui/Views.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/ui/Views.java
@@ -118,7 +118,7 @@ public class Views {
return Lists.newArrayList(widgets);
}
- protected static boolean accept(ViewProxy proxy,
+ protected static boolean accept(ViewProxy<?> proxy,
@Nullable String section, @Nullable String resourceScope, @Nullable String resourceQualifier, @Nullable String resourceLanguage, @Nullable String[] availableMeasures) {
return acceptNavigationSection(proxy, section)
&& acceptResourceScope(proxy, resourceScope)
@@ -127,23 +127,23 @@ public class Views {
&& acceptAvailableMeasures(proxy, availableMeasures);
}
- protected static boolean acceptResourceLanguage(ViewProxy proxy, @Nullable String resourceLanguage) {
+ protected static boolean acceptResourceLanguage(ViewProxy<?> proxy, @Nullable String resourceLanguage) {
return resourceLanguage == null || ArrayUtils.isEmpty(proxy.getResourceLanguages()) || ArrayUtils.contains(proxy.getResourceLanguages(), resourceLanguage);
}
- protected static boolean acceptResourceScope(ViewProxy proxy, @Nullable String resourceScope) {
+ protected static boolean acceptResourceScope(ViewProxy<?> proxy, @Nullable String resourceScope) {
return resourceScope == null || ArrayUtils.isEmpty(proxy.getResourceScopes()) || ArrayUtils.contains(proxy.getResourceScopes(), resourceScope);
}
- protected static boolean acceptResourceQualifier(ViewProxy proxy, @Nullable String resourceQualifier) {
+ protected static boolean acceptResourceQualifier(ViewProxy<?> proxy, @Nullable String resourceQualifier) {
return resourceQualifier == null || ArrayUtils.isEmpty(proxy.getResourceQualifiers()) || ArrayUtils.contains(proxy.getResourceQualifiers(), resourceQualifier);
}
- protected static boolean acceptNavigationSection(ViewProxy proxy, @Nullable String section) {
+ protected static boolean acceptNavigationSection(ViewProxy<?> proxy, @Nullable String section) {
return proxy.isWidget() || section == null || ArrayUtils.contains(proxy.getSections(), section);
}
- protected static boolean acceptAvailableMeasures(ViewProxy proxy, @Nullable String[] availableMeasures) {
+ protected static boolean acceptAvailableMeasures(ViewProxy<?> proxy, @Nullable String[] availableMeasures) {
return availableMeasures == null || proxy.acceptsAvailableMeasures(availableMeasures);
}
}
diff --git a/server/sonar-server/src/test/java/org/sonar/server/app/ProgrammaticLogbackValveTest.java b/server/sonar-server/src/test/java/org/sonar/server/app/ProgrammaticLogbackValveTest.java
index ee436f7f9f3..c447639c601 100644
--- a/server/sonar-server/src/test/java/org/sonar/server/app/ProgrammaticLogbackValveTest.java
+++ b/server/sonar-server/src/test/java/org/sonar/server/app/ProgrammaticLogbackValveTest.java
@@ -19,7 +19,9 @@
*/
package org.sonar.server.app;
+import ch.qos.logback.access.spi.IAccessEvent;
import ch.qos.logback.core.ConsoleAppender;
+
import org.apache.catalina.Container;
import org.junit.Test;
import org.sonar.process.LogbackHelper;
@@ -34,7 +36,7 @@ public class ProgrammaticLogbackValveTest {
ProgrammaticLogbackValve valve = new ProgrammaticLogbackValve();
valve.setContainer(mock(Container.class));
LogbackHelper helper = new LogbackHelper();
- ConsoleAppender appender = helper.newConsoleAppender(valve, "CONSOLE", "combined");
+ ConsoleAppender<IAccessEvent> appender = helper.newConsoleAppender(valve, "CONSOLE", "combined");
valve.addAppender(appender);
valve.start();
assertThat(valve.isStarted()).isTrue();
diff --git a/server/sonar-server/src/test/java/org/sonar/server/ui/ViewProxyTest.java b/server/sonar-server/src/test/java/org/sonar/server/ui/ViewProxyTest.java
index 2895462beed..916a083e7b4 100644
--- a/server/sonar-server/src/test/java/org/sonar/server/ui/ViewProxyTest.java
+++ b/server/sonar-server/src/test/java/org/sonar/server/ui/ViewProxyTest.java
@@ -66,7 +66,7 @@ public class ViewProxyTest {
}
View view = new MyView();
- ViewProxy proxy = new ViewProxy<>(view, userSession);
+ ViewProxy<?> proxy = new ViewProxy<>(view, userSession);
assertThat(proxy.getTarget()).isEqualTo(view);
assertThat(proxy.getSections()).isEqualTo(new String[] {NavigationSection.RESOURCE});
@@ -82,7 +82,7 @@ public class ViewProxyTest {
}
}
View view = new MyView();
- ViewProxy proxy = new ViewProxy<>(view, userSession);
+ ViewProxy<?> proxy = new ViewProxy<>(view, userSession);
assertThat(proxy.getTarget()).isEqualTo(view);
assertThat(proxy.getSections()).isEqualTo(new String[] {NavigationSection.HOME});
@@ -98,7 +98,7 @@ public class ViewProxyTest {
}
}
- ViewProxy proxy = new ViewProxy<>(new MyView(), userSession);
+ ViewProxy<?> proxy = new ViewProxy<>(new MyView(), userSession);
assertThat(proxy.isDefaultTab()).isTrue();
assertThat(proxy.getDefaultTabForMetrics()).isEmpty();
@@ -111,7 +111,7 @@ public class ViewProxyTest {
super("fake");
}
}
- ViewProxy proxy = new ViewProxy<>(new MyView(), userSession);
+ ViewProxy<?> proxy = new ViewProxy<>(new MyView(), userSession);
assertThat(proxy.isDefaultTab()).isFalse();
assertThat(proxy.getDefaultTabForMetrics()).isEmpty();
@@ -125,7 +125,7 @@ public class ViewProxyTest {
super("fake");
}
}
- ViewProxy proxy = new ViewProxy<>(new MyView(), userSession);
+ ViewProxy<?> proxy = new ViewProxy<>(new MyView(), userSession);
assertThat(proxy.isDefaultTab()).isFalse();
assertThat(proxy.getDefaultTabForMetrics()).isEqualTo(new String[] {"ncloc", "coverage"});
@@ -199,7 +199,7 @@ public class ViewProxyTest {
super("fake");
}
}
- ViewProxy proxy = new ViewProxy<>(new MyView(), userSession);
+ ViewProxy<?> proxy = new ViewProxy<>(new MyView(), userSession);
assertThat(proxy.acceptsAvailableMeasures(new String[] {"lines", "ncloc", "coverage"})).isTrue();
}
@@ -212,7 +212,7 @@ public class ViewProxyTest {
super("fake");
}
}
- ViewProxy proxy = new ViewProxy<>(new MyView(), userSession);
+ ViewProxy<?> proxy = new ViewProxy<>(new MyView(), userSession);
assertThat(proxy.acceptsAvailableMeasures(new String[] {"lines", "ncloc", "coverage"})).isTrue();
assertThat(proxy.acceptsAvailableMeasures(new String[] {"lines", "coverage"})).isFalse();
@@ -226,7 +226,7 @@ public class ViewProxyTest {
super("fake");
}
}
- ViewProxy proxy = new ViewProxy<>(new MyView(), userSession);
+ ViewProxy<?> proxy = new ViewProxy<>(new MyView(), userSession);
assertThat(proxy.acceptsAvailableMeasures(new String[] {"lines", "coverage"})).isTrue();
assertThat(proxy.acceptsAvailableMeasures(new String[] {"complexity", "coverage"})).isFalse();
@@ -240,7 +240,7 @@ public class ViewProxyTest {
super("fake");
}
}
- ViewProxy proxy = new ViewProxy<>(new MyView(), userSession);
+ ViewProxy<?> proxy = new ViewProxy<>(new MyView(), userSession);
// ok, mandatory measures and 1 needed measure
assertThat(proxy.acceptsAvailableMeasures(new String[] {"lines", "ncloc", "coverage", "duplications"})).isTrue();
@@ -260,7 +260,7 @@ public class ViewProxyTest {
}
}
- ViewProxy proxy = new ViewProxy<>(new MyView(), userSession);
+ ViewProxy<?> proxy = new ViewProxy<>(new MyView(), userSession);
assertThat(proxy.isUserAuthorized()).isTrue();
}
@@ -276,7 +276,7 @@ public class ViewProxyTest {
}
}
- ViewProxy proxy = new ViewProxy<>(new MyView(), userSession);
+ ViewProxy<?> proxy = new ViewProxy<>(new MyView(), userSession);
userSession.setGlobalPermissions("palap");
assertThat(proxy.isUserAuthorized()).isTrue();
@@ -293,7 +293,7 @@ public class ViewProxyTest {
}
}
- ViewProxy proxy = new ViewProxy<>(new MyView(), userSession);
+ ViewProxy<?> proxy = new ViewProxy<>(new MyView(), userSession);
userSession.setGlobalPermissions("pilip");
assertThat(proxy.isUserAuthorized()).isFalse();
@@ -309,7 +309,7 @@ public class ViewProxyTest {
}
}
- ViewProxy proxy = new ViewProxy<>(new MyView(), userSession);
+ ViewProxy<?> proxy = new ViewProxy<>(new MyView(), userSession);
assertThat(proxy.isUserAuthorized(newProjectDto("abcd"))).isTrue();
}
@@ -325,7 +325,7 @@ public class ViewProxyTest {
}
}
- ViewProxy proxy = new ViewProxy<>(new MyView(), userSession);
+ ViewProxy<?> proxy = new ViewProxy<>(new MyView(), userSession);
userSession.addProjectUuidPermissions("palap", "abcd");
assertThat(proxy.isUserAuthorized(newProjectDto("abcd"))).isTrue();
@@ -342,7 +342,7 @@ public class ViewProxyTest {
}
}
- ViewProxy proxy = new ViewProxy<>(new MyView(), userSession);
+ ViewProxy<?> proxy = new ViewProxy<>(new MyView(), userSession);
userSession.addProjectUuidPermissions("pilip", "abcd");
assertThat(proxy.isUserAuthorized(newProjectDto("abcd"))).isFalse();
diff --git a/server/sonar-server/src/test/java/org/sonar/server/ui/ViewsTest.java b/server/sonar-server/src/test/java/org/sonar/server/ui/ViewsTest.java
index 72904514454..cfc81a65936 100644
--- a/server/sonar-server/src/test/java/org/sonar/server/ui/ViewsTest.java
+++ b/server/sonar-server/src/test/java/org/sonar/server/ui/ViewsTest.java
@@ -96,7 +96,7 @@ public class ViewsTest {
@Test
public void should_accept_navigation_section() {
- ViewProxy proxy = mock(ViewProxy.class);
+ ViewProxy<?> proxy = mock(ViewProxy.class);
when(proxy.getSections()).thenReturn(new String[] {NavigationSection.RESOURCE});
when(proxy.isWidget()).thenReturn(false);
@@ -109,7 +109,7 @@ public class ViewsTest {
@Test
public void should_accept_available_measures() {
- ViewProxy proxy = mock(ViewProxy.class);
+ ViewProxy<?> proxy = mock(ViewProxy.class);
when(proxy.acceptsAvailableMeasures(new String[] {"lines"})).thenReturn(true);
when(proxy.acceptsAvailableMeasures(new String[] {"ncloc"})).thenReturn(false);
@@ -124,7 +124,7 @@ public class ViewsTest {
@Test
public void should_not_check_navigation_section_on_widgets() {
- ViewProxy proxy = mock(ViewProxy.class);
+ ViewProxy<?> proxy = mock(ViewProxy.class);
when(proxy.isWidget()).thenReturn(true);
assertThat(Views.acceptNavigationSection(proxy, NavigationSection.RESOURCE)).isEqualTo(true);
@@ -136,7 +136,7 @@ public class ViewsTest {
@Test
public void should_check_resource_language() {
- ViewProxy proxy = mock(ViewProxy.class);
+ ViewProxy<?> proxy = mock(ViewProxy.class);
assertThat(Views.acceptResourceLanguage(proxy, Java.KEY)).isEqualTo(true);
when(proxy.getResourceLanguages()).thenReturn(new String[] {"foo"});
@@ -146,7 +146,7 @@ public class ViewsTest {
@Test
public void should_check_resource_scope() {
- ViewProxy proxy = mock(ViewProxy.class);
+ ViewProxy<?> proxy = mock(ViewProxy.class);
assertThat(Views.acceptResourceScope(proxy, Scopes.FILE)).isEqualTo(true);
when(proxy.getResourceScopes()).thenReturn(new String[] {Scopes.PROJECT, Scopes.FILE});
@@ -156,7 +156,7 @@ public class ViewsTest {
@Test
public void should_check_resource_qualifier() {
- ViewProxy proxy = mock(ViewProxy.class);
+ ViewProxy<?> proxy = mock(ViewProxy.class);
assertThat(Views.acceptResourceQualifier(proxy, Scopes.FILE)).isEqualTo(true);
when(proxy.getResourceQualifiers()).thenReturn(new String[] {Qualifiers.CLASS, Qualifiers.FILE});