Skip to content

Commit

Permalink
Add Error Prone Annotations dependency to suppress warnings (#8774)
Browse files Browse the repository at this point in the history
  • Loading branch information
wu-sheng committed Mar 31, 2022
1 parent eb5f755 commit faf6e2e
Show file tree
Hide file tree
Showing 30 changed files with 91 additions and 76 deletions.
6 changes: 4 additions & 2 deletions .lift/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ jdk11 = true
ignoreRules = [ "THREAD_SAFETY_VIOLATION", "MissingSummary", "SameNameButDifferent", "NonAtomicVolatileUpdate", "EqualsGetClass"]
setup = ".lift/setup.sh"
ignoreFiles = """
skywalking-ui/
skywalking-ui/**
**/target/**
/dist-material/release-docs/
/dist-material/release-docs/**
test/e2e-v2/cases/**
test/e2e-v2/java-test-service/**
"""
3 changes: 2 additions & 1 deletion CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,8 @@ NOTICE, this sharding concept is NOT just for splitting data into different data
* E2E: Add verify OAP eBPF Profiling.
* Let `multiGet` could query without tag value in the `InfluxDB` storage plugin.
* Adjust MAL for V9, remove some groups, add a new Service function for the custom delimiter.
* Fix `DatabaseSlowStatement` miss set service catalog.
* Add service catalog `DatabaseSlowStatement`.
* Add `Error Prone Annotations` dependency to suppress warnings, which are not errors.

#### UI

Expand Down
2 changes: 1 addition & 1 deletion dist-material/release-docs/LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ The text of each license is the standard Apache 2.0 license.
netty: netty-tcnative-boringssl-static 2.0.43: https://github.com/netty/netty-tcnative, Apache 2.0
annotations 13.0: http://www.jetbrains.org, Apache 2.0
compiler 0.9.6: https://github.com/spullara/mustache.java, Apache 2.0
error_prone_annotations 2.3.2: https://github.com/google/error-prone, Apache 2.0
error_prone_annotations 2.11.0: https://github.com/google/error-prone, Apache 2.0
instrumentation-api 0.4.3: https://github.com/google/instrumentation-java, Apache 2.0
jackson-annotations 2.8.0: https://github.com/FasterXML/jackson-annotations, Apache 2.0
jackson-core 2.12.2: https://github.com/FasterXML/jackson-core, Apache 2.0
Expand Down
6 changes: 6 additions & 0 deletions oap-server-bom/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
<properties>
<slf4j.version>1.7.30</slf4j.version>
<log4j.version>2.17.1</log4j.version>
<google.error_prone_annotations>2.11.0</google.error_prone_annotations>
<graphql-java-tools.version>12.0.2</graphql-java-tools.version>
<graphql-java.version>17.3</graphql-java.version>
<graphql-java-extended-scalars.version>17.0</graphql-java-extended-scalars.version>
Expand Down Expand Up @@ -122,6 +123,11 @@
<artifactId>log4j-api</artifactId>
<version>${log4j.version}</version>
</dependency>
<dependency>
<groupId>com.google.errorprone</groupId>
<artifactId>error_prone_annotations</artifactId>
<version>${google.error_prone_annotations}</version>
</dependency>
<dependency>
<groupId>com.graphql-java-kickstart</groupId>
<artifactId>graphql-java-tools</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,6 @@ public static Analyzer build(final String metricName,
return analyzer;
}

private static final String FUNCTION_NAME_TEMP = "%s%s";

private List<String> samples;

private final String metricName;
Expand Down Expand Up @@ -250,7 +248,7 @@ private void createMetric(final ScopeType scopeType,
final String dataType,
final DownsamplingType downsamplingType) {
String functionName = String.format(
FUNCTION_NAME_TEMP, downsamplingType.toString().toLowerCase(), StringUtils.capitalize(dataType));
"%s%s", downsamplingType.toString().toLowerCase(), StringUtils.capitalize(dataType));
meterSystem.create(metricName, functionName, scopeType);
}

Expand All @@ -272,6 +270,7 @@ private void generateTraffic(MeterEntity entity) {
toService(requireNonNull(entity.getSourceServiceName()), entity.getLayer());
clientSide(entity);
break;
default:
}
} else {
toService(requireNonNull(entity.getServiceName()), entity.getLayer());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

package org.apache.skywalking.oal.rt.parser;

import java.util.LinkedList;
import java.util.ArrayList;
import java.util.List;
import lombok.Getter;
import lombok.Setter;
Expand Down Expand Up @@ -91,7 +91,7 @@ public class AnalysisResult {

public void addPersistentField(String fieldName, String columnName, Class<?> type) {
if (persistentFields == null) {
persistentFields = new LinkedList<>();
persistentFields = new ArrayList<>();
}
DataColumn dataColumn = new DataColumn(fieldName, columnName, type);
persistentFields.add(dataColumn);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

package org.apache.skywalking.oal.rt.parser;

import java.util.LinkedList;
import java.util.ArrayList;
import java.util.List;
import lombok.Getter;

Expand All @@ -28,7 +28,7 @@ public class OALScripts {
private DisableCollection disableCollection;

public OALScripts() {
metricsStmts = new LinkedList<>();
metricsStmts = new ArrayList<>();
disableCollection = new DisableCollection();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@

package org.apache.skywalking.oal.rt.parser;

import java.util.LinkedList;
import java.util.ArrayList;
import java.util.List;

public class PersistenceColumns {
private List<PersistenceField> stringFields = new LinkedList<>();
private List<PersistenceField> longFields = new LinkedList<>();
private List<PersistenceField> doubleFields = new LinkedList<>();
private List<PersistenceField> intFields = new LinkedList<>();
private List<PersistenceField> objectFields = new LinkedList<>();
private List<PersistenceField> stringFields = new ArrayList<>();
private List<PersistenceField> longFields = new ArrayList<>();
private List<PersistenceField> doubleFields = new ArrayList<>();
private List<PersistenceField> intFields = new ArrayList<>();
private List<PersistenceField> objectFields = new ArrayList<>();

public void addStringField(String fieldName) {
stringFields.add(new PersistenceField(fieldName, "String"));
Expand Down
9 changes: 7 additions & 2 deletions oap-server/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
~
-->

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>apm</artifactId>
<groupId>org.apache.skywalking</groupId>
Expand Down Expand Up @@ -51,7 +52,7 @@

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

<kafka-clients.version>2.4.1</kafka-clients.version>
<spring-kafka-test.version>2.4.6.RELEASE</spring-kafka-test.version>
</properties>
Expand Down Expand Up @@ -87,6 +88,10 @@
<groupId>org.testcontainers</groupId>
<artifactId>testcontainers</artifactId>
</dependency>
<dependency>
<groupId>com.google.errorprone</groupId>
<artifactId>error_prone_annotations</artifactId>
</dependency>
</dependencies>

<dependencyManagement>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
package org.apache.skywalking.oap.server.cluster.plugin.zookeeper;

import com.google.common.collect.Lists;
import java.nio.charset.StandardCharsets;
import java.security.NoSuchAlgorithmException;
import java.util.List;
import org.apache.curator.RetryPolicy;
Expand Down Expand Up @@ -114,7 +115,7 @@ public List<ACL> getAclForPath(String s) {
}
};
builder.aclProvider(provider);
builder.authorization(config.getSchema(), config.getExpression().getBytes());
builder.authorization(config.getSchema(), config.getExpression().getBytes(StandardCharsets.UTF_8));
}
client = builder.build();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import java.nio.charset.StandardCharsets;
import org.apache.curator.x.discovery.ServiceInstance;
import org.apache.curator.x.discovery.details.InstanceSerializer;
import org.apache.skywalking.oap.server.core.cluster.RemoteInstance;
Expand All @@ -30,7 +31,7 @@ public class SWInstanceSerializer implements InstanceSerializer<RemoteInstance>

@Override
public byte[] serialize(ServiceInstance<RemoteInstance> instance) throws Exception {
return gson.toJson(instance).getBytes();
return gson.toJson(instance).getBytes(StandardCharsets.UTF_8);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ private void groupConfigsSync() {

public abstract Optional<GroupConfigTable> readGroupConfig(Set<String> keys);

public class Register {
static class Register {
private Map<String, WatcherHolder> register = new HashMap<>();

private boolean containsKey(String key) {
Expand Down Expand Up @@ -255,7 +255,7 @@ public String toString() {
}

@Getter
protected class WatcherHolder {
protected static class WatcherHolder {
private ConfigChangeWatcher watcher;
private final String key;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

package org.apache.skywalking.oap.server.configuration.zookeeper;

import java.nio.charset.StandardCharsets;
import java.util.Optional;
import java.util.Set;
import lombok.extern.slf4j.Slf4j;
Expand Down Expand Up @@ -54,7 +55,7 @@ public Optional<ConfigTable> readConfig(Set<String> keys) {
ChildData data = this.childrenCache.getCurrentData(this.prefix + s);
String itemValue = null;
if (data != null && data.getData() != null) {
itemValue = new String(data.getData());
itemValue = new String(data.getData(), StandardCharsets.UTF_8);
}
table.add(new ConfigTable.ConfigItem(s, itemValue));
});
Expand All @@ -66,21 +67,22 @@ public Optional<GroupConfigTable> readGroupConfig(final Set<String> keys) {
GroupConfigTable table = new GroupConfigTable();
keys.forEach(key -> {
GroupConfigTable.GroupConfigItems groupConfigItems = new GroupConfigTable.GroupConfigItems(key);
try {
client.getChildren().forPath(this.prefix + key).forEach(itemName -> {
byte[] data = null;
try {
data = client.getData().forPath(this.prefix + key + "/" + itemName);
} catch (Exception e) {
log.error(e.getMessage(), e);
}
groupConfigItems.add(
new ConfigTable.ConfigItem(itemName, data == null ? null : new String(data)));
});
} catch (Exception e) {
log.error(e.getMessage(), e);
}
table.addGroupConfigItems(groupConfigItems);
try {
client.getChildren().forPath(this.prefix + key).forEach(itemName -> {
byte[] data = null;
try {
data = client.getData().forPath(this.prefix + key + "/" + itemName);
} catch (Exception e) {
log.error(e.getMessage(), e);
}
groupConfigItems.add(
new ConfigTable.ConfigItem(
itemName, data == null ? null : new String(data, StandardCharsets.UTF_8)));
});
} catch (Exception e) {
log.error(e.getMessage(), e);
}
table.addGroupConfigItems(groupConfigItems);
});
return Optional.of(table);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ public void dispatch(EndpointRelation source) {
case SERVER:
serverSide(source);
break;
default:
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@

package org.apache.skywalking.oap.server.core.query.sql;

import java.util.LinkedList;
import java.util.ArrayList;
import java.util.List;
import lombok.Getter;

@Getter
public class Where {
private List<KeyValues> keyValues = new LinkedList<>();
private List<KeyValues> keyValues = new ArrayList<>();
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,13 @@
@Slf4j
public class LogHandler extends AbstractKafkaHandler {

private final KafkaFetcherConfig config;
private final HistogramMetrics histogram;
private final CounterMetrics errorCounter;
private final ILogAnalyzerService logAnalyzerService;

public LogHandler(final ModuleManager moduleManager,
final KafkaFetcherConfig config) {
super(moduleManager, config);
this.config = config;
this.logAnalyzerService = moduleManager.find(LogAnalyzerModule.NAME)
.provider()
.getService(ILogAnalyzerService.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,22 +19,19 @@
package org.apache.skywalking.oap.server.library.module;

import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import lombok.extern.slf4j.Slf4j;
import org.apache.skywalking.oap.server.library.util.CollectionUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

@Slf4j
class BootstrapFlow {
private static final Logger LOGGER = LoggerFactory.getLogger(BootstrapFlow.class);

private Map<String, ModuleDefine> loadedModules;
private List<ModuleProvider> startupSequence;

BootstrapFlow(Map<String, ModuleDefine> loadedModules) throws CycleDependencyException, ModuleNotFoundException {
this.loadedModules = loadedModules;
startupSequence = new LinkedList<>();
startupSequence = new ArrayList<>();

makeSequence();
}
Expand All @@ -43,7 +40,7 @@ class BootstrapFlow {
void start(
ModuleManager moduleManager) throws ModuleNotFoundException, ServiceNotProvidedException, ModuleStartException {
for (ModuleProvider provider : startupSequence) {
LOGGER.info("start the provider {} in {} module.", provider.name(), provider.getModuleName());
log.info("start the provider {} in {} module.", provider.name(), provider.getModuleName());
provider.requiredCheck(provider.getModule().services());

provider.start();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ private static InputStream readPkcs1PrivateKey(byte[] pkcs1Bytes) {
0x4, (byte) 0x82, (byte) ((pkcs1Length >> 8) & 0xff), (byte) (pkcs1Length & 0xff) // Octet string + length
};
StringBuilder pkcs8 = new StringBuilder(PKCS_8_PEM_HEADER);
pkcs8.append("\n").append(new String(Base64.getEncoder().encode(join(pkcs8Header, pkcs1Bytes))));
pkcs8.append("\n").append(new String(Base64.getEncoder().encode(join(pkcs8Header, pkcs1Bytes)), StandardCharsets.UTF_8));
pkcs8.append("\n").append(PKCS_8_PEM_FOOTER);
return new ByteArrayInputStream(pkcs8.toString().getBytes());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import java.io.InputStreamReader;
import java.io.Reader;
import java.net.URL;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
Expand All @@ -34,7 +35,7 @@
public class ResourceUtils {

public static Reader read(String fileName) throws FileNotFoundException {
return new InputStreamReader(readToStream(fileName));
return new InputStreamReader(readToStream(fileName), StandardCharsets.UTF_8);
}

public static InputStream readToStream(String fileName) throws FileNotFoundException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,14 @@

package org.apache.skywalking.oap.query.graphql.resolver;

import com.google.errorprone.annotations.Keep;
import graphql.kickstart.tools.GraphQLMutationResolver;
import org.apache.skywalking.oap.server.core.version.Version;

/**
* Root mutation resolver.
*/
public class Mutation implements GraphQLMutationResolver {
private String version = "8.0";
@Keep // GraphQL picks this as version
private String version = Version.CURRENT.toString();
}
Loading

0 comments on commit faf6e2e

Please sign in to comment.