mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
hide user paths in stats for VM options
This commit is contained in:
+13
@@ -25,10 +25,23 @@ import java.lang.management.ManagementFactory
|
||||
class JdkSettingsUsageCollector: UsagesCollector() {
|
||||
override fun getUsages(): Set<UsageDescriptor> {
|
||||
return ManagementFactory.getRuntimeMXBean().inputArguments
|
||||
.map { s -> hideUserPath(s) }
|
||||
.map { s -> UsageDescriptor(s) }
|
||||
.toSet()
|
||||
}
|
||||
|
||||
val keysWithPath = arrayOf("-Didea.home.path", "-Didea.launcher.bin.path", "-Didea.plugins.path", "-Xbootclasspath",
|
||||
"-Djb.vmOptionsFile", "-XX ErrorFile", "-XX HeapDumpPath", " -Didea.launcher.bin.path", "-agentlib:jdwp")
|
||||
|
||||
private fun hideUserPath(key: String): String {
|
||||
@Suppress("LoopToCallChain")
|
||||
for (s in keysWithPath) {
|
||||
if (key.startsWith(s)) return "$s ..."
|
||||
}
|
||||
|
||||
return key
|
||||
}
|
||||
|
||||
override fun getGroupId(): GroupDescriptor {
|
||||
return GroupDescriptor.create("user.jdk.settings")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user