From 6bd5113916cd37983b8925c08eed599cbf3f7fcc Mon Sep 17 00:00:00 2001 From: sschr15 Date: Tue, 6 Feb 2024 16:11:49 -0600 Subject: [PATCH] Fix regexes not matching correctly --- .../modules/logs/processors/MissingItemProcessor.kt | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/module-log-parser/src/main/kotlin/org/quiltmc/community/cozy/modules/logs/processors/MissingItemProcessor.kt b/module-log-parser/src/main/kotlin/org/quiltmc/community/cozy/modules/logs/processors/MissingItemProcessor.kt index 4947b13..9c3c90f 100644 --- a/module-log-parser/src/main/kotlin/org/quiltmc/community/cozy/modules/logs/processors/MissingItemProcessor.kt +++ b/module-log-parser/src/main/kotlin/org/quiltmc/community/cozy/modules/logs/processors/MissingItemProcessor.kt @@ -12,18 +12,18 @@ import org.quiltmc.community.cozy.modules.logs.types.LogProcessor // ClassNotFoundException: package.name.ClassName private val CLASS_REGEX = - """java\.lang\.ClassNotFoundException: ((?:[^\n.]\.)*)([^\n.]+)""" + """java\.lang\.ClassNotFoundException: ((?:[^\n.]+[\.\/])*)([^\n.()]+)""" .toRegex(RegexOption.IGNORE_CASE) // NoSuchMethodError: 'ReturnType package.name.ClassName.methodName(ParamType, ParamType, ParamType)' private val METHOD_REGEX = - """java\.lang\.NoSuchMethodError: '([^\n]+) ((?:[^\n.]\.)*)([^\n.]+)\.([^\n.]+)\.([^\n(]+)\(([^)]*)\)""" + """java\.lang\.NoSuchMethodError: '([^\n]+) ((?:[^\n.]+[\.\/])*)([^\n.()]+)\.([^\n.]+)\.([^\n(]+)\(([^)]*)\)""" .toRegex(RegexOption.IGNORE_CASE) // This is the new format for NoSuchFieldError (the old one has no useful information) // NoSuchFieldError: Class package.name.ClassName does not have member field 'Type fieldName' private val FIELD_REGEX = - """java\.lang\.NoSuchFieldError: Class ((?:[^\n.]\.)*)([^\n.]+) does not have member field '([^\n]+)'""" + """java\.lang\.NoSuchFieldError: Class ((?:[^\n.]+[\.\/])*)([^\n.()]+) does not have member field '([^\n]+)'""" .toRegex(RegexOption.IGNORE_CASE) public class MissingItemProcessor : LogProcessor() { @@ -42,7 +42,7 @@ public class MissingItemProcessor : LogProcessor() { for (match in classMatches) { val pkg = match.groupValues[1] if (pkg.isNotBlank()) { - packages.add(pkg) + packages.add(pkg.replace('/', '.')) } else { topLevelClasses.add(match.groupValues[2]) } @@ -51,7 +51,7 @@ public class MissingItemProcessor : LogProcessor() { for (match in methodMatches) { val pkg = match.groupValues[2] if (pkg.isNotBlank()) { - packages.add(pkg) + packages.add(pkg.replace('/', '.')) } else { topLevelClasses.add(match.groupValues[3]) } @@ -60,7 +60,7 @@ public class MissingItemProcessor : LogProcessor() { for (match in fieldMatches) { val pkg = match.groupValues[1] if (pkg.isNotBlank()) { - packages.add(pkg) + packages.add(pkg.replace('/', '.')) } else { topLevelClasses.add(match.groupValues[2]) }