AlexanderAshitkin commented on code in PR #391:
URL:
https://github.com/apache/maven-build-cache-extension/pull/391#discussion_r2404802902
##########
src/main/java/org/apache/maven/buildcache/BuildCacheMojosExecutionStrategy.java:
##########
@@ -434,6 +440,55 @@ private static String normalizedPath(Path path, Path
baseDirPath) {
return normalizedPath;
}
+ /**
+ * Filters array values based on ignore pattern and converts to string
representation.
+ */
+ private static String filterAndStringifyArray(Object array, String
ignorePattern) {
+ if (ignorePattern == null) {
+ return ArrayUtils.toString(array);
+ }
+
+ java.util.regex.Pattern pattern =
java.util.regex.Pattern.compile(ignorePattern);
+ java.util.List<Object> filtered = new java.util.ArrayList<>();
+
+ int length = java.lang.reflect.Array.getLength(array);
+ for (int i = 0; i < length; i++) {
+ Object element = java.lang.reflect.Array.get(array, i);
+ String elementStr = String.valueOf(element);
+ if (!pattern.matcher(elementStr).find()) {
+ filtered.add(element);
+ }
+ }
+
+ return filtered.toString();
+ }
+
+ /**
+ * Filters an array string representation (e.g., "[a, b, c]") based on
ignore pattern.
+ */
+ private static String filterArrayString(String arrayStr, String
ignorePattern) {
Review Comment:
1) it is better to keep this logic in utils class
2) unit test, please
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]