List<String> lines = FileUtils.readLines(symbolFile, context.fileSystem().encoding().name());
int lineNumber = 0;
Symbolizable symbolizable = perspectives.as(Symbolizable.class, inputFile);
-
- Symbolizable.SymbolTableBuilder symbolTableBuilder = symbolizable.newSymbolTableBuilder();
- for (String line : lines) {
- lineNumber++;
- if (StringUtils.isBlank(line) || line.startsWith("#")) {
- continue;
+ if (symbolizable != null) {
+ Symbolizable.SymbolTableBuilder symbolTableBuilder = symbolizable.newSymbolTableBuilder();
+ for (String line : lines) {
+ lineNumber++;
+ if (StringUtils.isBlank(line) || line.startsWith("#")) {
+ continue;
+ }
+ processLine(symbolFile, lineNumber, symbolTableBuilder, line);
}
- processLine(symbolFile, lineNumber, symbolTableBuilder, line);
+ symbolizable.setSymbolTable(symbolTableBuilder.build());
}
- symbolizable.setSymbolTable(symbolTableBuilder.build());
} catch (IOException e) {
throw new IllegalStateException(e);
}
json.beginObject();
json.prop("property", facetName);
json.name("values").beginArray();
- if (results.getFacets().contains(facetName)) {
+ LinkedHashMap<String, Long> buckets = results.getFacets().get(facetName);
+ if (buckets != null) {
Set<String> itemsFromFacets = Sets.newHashSet();
- for (Map.Entry<String, Long> bucket : results.getFacets().get(facetName).entrySet()) {
+ for (Map.Entry<String, Long> bucket : buckets.entrySet()) {
itemsFromFacets.add(bucket.getKey());
json.beginObject();
json.prop("val", bucket.getKey());
return getNullableField(SourceLineIndexDefinition.FIELD_SCM_REVISION);
}
- public SourceLineDoc setScmRevision(String scmRevision) {
+ public SourceLineDoc setScmRevision(@Nullable String scmRevision) {
setField(SourceLineIndexDefinition.FIELD_SCM_REVISION, scmRevision);
return this;
}
return getNullableField(SourceLineIndexDefinition.FIELD_SCM_AUTHOR);
}
- public SourceLineDoc setScmAuthor(String scmAuthor) {
+ public SourceLineDoc setScmAuthor(@Nullable String scmAuthor) {
setField(SourceLineIndexDefinition.FIELD_SCM_AUTHOR, scmAuthor);
return this;
}
return getNullableField(SourceLineIndexDefinition.FIELD_HIGHLIGHTING);
}
- public SourceLineDoc setHighlighting(String s) {
+ public SourceLineDoc setHighlighting(@Nullable String s) {
setField(SourceLineIndexDefinition.FIELD_HIGHLIGHTING, s);
return this;
}
return getField(SourceLineIndexDefinition.FIELD_SOURCE);
}
- public SourceLineDoc setSource(String source) {
+ public SourceLineDoc setSource(@Nullable String source) {
setField(SourceLineIndexDefinition.FIELD_SOURCE, source);
return this;
}
return getFieldAsDate(BaseNormalizer.UPDATED_AT_FIELD);
}
- public SourceLineDoc setUpdateDate(Date updatedAt) {
+ public SourceLineDoc setUpdateDate(@Nullable Date updatedAt) {
setField(BaseNormalizer.UPDATED_AT_FIELD, updatedAt);
return this;
}
settings.page=General Settings
settings.page.description=Edit global settings for this SonarQube instance.
system_info.page=System Info
-system_info.page.description=This page provides system statistics, including plugin versions, environmental variables, and data on SonarQube itself.
users.page=Users
users.page.description=Create and administer individual users.
user_groups.page=Groups
import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle;
-import org.sonar.api.utils.log.Logger;
+import org.slf4j.Logger;
import java.util.ArrayList;
import java.util.List;
return this;
}
+ /**
+ * @since 5.1
+ */
+ public void log(org.sonar.api.utils.log.Logger logger) {
+ for (String error : getErrors()) {
+ logger.error(error);
+ }
+ for (String warning : getWarnings()) {
+ logger.warn(warning);
+ }
+ for (String info : getInfos()) {
+ logger.info(info);
+ }
+ }
+
+ /**
+ * @deprecated replaced by {@link #log(org.sonar.api.utils.log.Logger)} since deprecation of slf4j in 5.1
+ */
+ @Deprecated
public void log(Logger logger) {
for (String error : getErrors()) {
logger.error(error);
*/
package org.sonar.api.utils.log;
+import javax.annotation.Nullable;
+
import java.util.ArrayList;
import java.util.List;
}
@Override
- public void log(String msg, Object arg) {
+ public void log(String msg, @Nullable Object arg) {
logs.add(ConsoleFormatter.format(msg, arg));
}
@Override
- public void log(String msg, Object arg1, Object arg2) {
+ public void log(String msg, @Nullable Object arg1, @Nullable Object arg2) {
logs.add(ConsoleFormatter.format(msg, arg1, arg2));
}
*/
package org.sonar.api.utils.log;
+import javax.annotation.Nullable;
+
abstract class LogInterceptor {
abstract void log(String msg);
- abstract void log(String msg, Object arg);
+ abstract void log(String msg, @Nullable Object arg);
- abstract void log(String msg, Object arg1, Object arg2);
+ abstract void log(String msg, @Nullable Object arg1, @Nullable Object arg2);
abstract void log(String msg, Object... args);
verify(logger, never()).error(anyString());
verify(logger, never()).warn(anyString());
verify(logger, never()).info(anyString());
+
+ org.slf4j.Logger slf4j = mock(org.slf4j.Logger.class);
+ messages.log(slf4j);
+ verify(slf4j, never()).error(anyString());
+ verify(slf4j, never()).warn(anyString());
+ verify(slf4j, never()).info(anyString());
}
@Test
verify(logger, times(1)).error("my error");
verify(logger, never()).warn(anyString());
verify(logger, never()).info(anyString());
+
+ org.slf4j.Logger slf4j = mock(org.slf4j.Logger.class);
+ messages.log(slf4j);
+ verify(slf4j, times(1)).error("my error");
+ verify(slf4j, never()).warn(anyString());
+ verify(slf4j, never()).info(anyString());
}
}
assertThat(ConsoleFormatter.format("arg: {}", "foo")).isEqualTo("arg: foo");
assertThat(ConsoleFormatter.format("two args: {} and {}", "foo", 42)).isEqualTo("two args: foo and 42");
assertThat(ConsoleFormatter.format("args: {}, {} and {}", true, 42, 2L)).isEqualTo("args: true, 42 and 2");
+ assertThat(ConsoleFormatter.format("args: {}, {} and {}", null, null, null)).isEqualTo("args: null, null and null");
}
@Test