Skip to content

Commit 8424660

Browse files
Copilottrask
andcommitted
Fix checkstyle violations from sync: logger naming and system.out.println
Co-authored-by: trask <[email protected]>
1 parent c3d06e6 commit 8424660

File tree

6 files changed

+12
-11
lines changed

6 files changed

+12
-11
lines changed

agent/agent-tooling/src/main/java/com/microsoft/applicationinsights/agent/internal/classicsdk/TelemetryClientClassFileTransformer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1722,7 +1722,7 @@ public static void main(String[] args) throws Exception {
17221722
content = content.replace("\r\n", "\n");
17231723
content = content.replaceAll("(?m)^[^\n]*visitLineNumber[^\n]*\n", "");
17241724
content = content.replaceAll("(?m)^[^\n]*visitLocalVariable[^\n]*\n", "");
1725-
System.out.println(content);
1725+
System.out.println(content); // CHECKSTYLE:OFF SystemOut
17261726
}
17271727
17281728
@SuppressWarnings("UnnecessarilyFullyQualified")

agent/agent-tooling/src/main/java/com/microsoft/applicationinsights/agent/internal/configuration/SnippetConfiguration.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,22 +16,22 @@
1616
// preview Configuration
1717
public class SnippetConfiguration {
1818
private static final String snippet = readSnippet();
19-
private static final Logger LOGGER = LoggerFactory.getLogger(SnippetConfiguration.class);
19+
private static final Logger logger = LoggerFactory.getLogger(SnippetConfiguration.class);
2020

2121
// visible for testing
2222
static String readSnippet() {
2323
ClassLoader classLoader = SnippetConfiguration.class.getClassLoader();
2424
String resourceName = "browser-sdk-loader-snippet.txt";
2525
InputStream inputStream = classLoader.getResourceAsStream(resourceName);
2626
if (inputStream == null) {
27-
LOGGER.error("Resource not found: " + resourceName);
27+
logger.error("Resource not found: " + resourceName);
2828
return "";
2929
}
3030
try {
3131
return toString(inputStream);
3232
} catch (IOException e) {
3333
// Handle any IO exceptions that occur
34-
LOGGER.error("Failed to read javascript-snippet file", e);
34+
logger.error("Failed to read javascript-snippet file", e);
3535
}
3636
return "";
3737
}

buildscripts/checkstyle.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,7 @@
326326
value="CLASS_DEF, INTERFACE_DEF, ENUM_DEF, METHOD_DEF, CTOR_DEF, VARIABLE_DEF"/>
327327
</module>
328328
<module name="JavadocMethod">
329-
<property name="accessModifiers" value="public"/>
329+
<property name="scope" value="public"/>
330330
<property name="allowMissingParamTags" value="true"/>
331331
<property name="allowMissingReturnTag" value="true"/>
332332
<property name="allowedAnnotations" value="Override, Test"/>

etw/java/src/main/java/com/microsoft/applicationinsights/agent/internal/diagnostics/etw/DllFileUtils.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
import org.slf4j.LoggerFactory;
1919

2020
class DllFileUtils {
21-
private static final Logger LOGGER = LoggerFactory.getLogger(DllFileUtils.class);
21+
private static final Logger logger = LoggerFactory.getLogger(DllFileUtils.class);
2222

2323
private DllFileUtils() {}
2424

@@ -52,7 +52,7 @@ public static File buildDllLocalPath(@Nullable String versionDirectory) {
5252
if (!dllPath.exists() || !dllPath.canRead() || !dllPath.canWrite()) {
5353
throw new IllegalStateException("Failed to create a read/write folder for the native dll.");
5454
}
55-
LOGGER.trace("{} folder exists", dllPath);
55+
logger.trace("{} folder exists", dllPath);
5656

5757
return dllPath;
5858
}
@@ -87,7 +87,7 @@ public static void extractToLocalFolder(File dllOnDisk, String libraryToLoad) th
8787
}
8888
}
8989
}
90-
LOGGER.debug("Successfully extracted '{}' to local folder", libraryToLoad);
90+
logger.debug("Successfully extracted '{}' to local folder", libraryToLoad);
9191
}
9292

9393
private static final List<String> CANDIDATE_USERNAME_ENVIRONMENT_VARIABLES =

etw/java/src/main/jni/com/microsoft/applicationinsights/agent/internal/diagnostics/etw/EtwProvider.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,18 @@ public class EtwProvider {
1414
private static final String LIB_FILENAME_64_BIT =
1515
"applicationinsights-java-etw-provider-x86-64.dll";
1616

17-
private static final Logger LOGGER = LoggerFactory.getLogger(EtwProvider.class);
17+
private static final Logger logger = LoggerFactory.getLogger(EtwProvider.class);
1818

1919
public EtwProvider(String sdkVersion) {
2020
String osname = System.getProperty("os.name");
2121
if (osname != null && osname.startsWith("Windows")) {
2222
File dllPath = null;
2323
try {
2424
dllPath = loadLibrary(sdkVersion);
25-
LOGGER.debug("EtwProvider initialized. Lib path={}", dllPath.getAbsolutePath());
25+
logger.debug("EtwProvider initialized. Lib path={}", dllPath.getAbsolutePath());
2626
} catch (Throwable t) {
2727
try {
28-
LOGGER.debug("Error initializing EtwProvider", t);
28+
logger.debug("Error initializing EtwProvider", t);
2929
if (dllPath != null) {
3030
dllPath.deleteOnExit();
3131
}

settings.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ pluginManagement {
55
id("com.github.jk1.dependency-license-report") version "2.9"
66
id("me.champeau.jmh") version "0.7.3"
77
id("com.gradle.plugin-publish") version "1.3.1"
8+
id("com.github.ben-manes.versions") version "0.51.0"
89
}
910
}
1011

0 commit comments

Comments
 (0)