szquadri / javamelody

Automatically exported from code.google.com/p/javamelody
0 stars 0 forks source link

MULTILINE && DOTALL flags for transform-patterns #474

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Sql requests typically consists of multiple lines of text, I think it would be 
useful to enable MULTILINE and DOTALL flags for regular expressions used to 
transform request description.

Here is patch implementing the feature.

diff --git a/src/main/java/net/bull/javamelody/FilterContext.java 
b/src/main/java/net/bull/javamelody/FilterContext.java
index 18c6e3f..f1c4ce7 100644
--- a/src/main/java/net/bull/javamelody/FilterContext.java
+++ b/src/main/java/net/bull/javamelody/FilterContext.java
@@ -172,7 +172,8 @@
            final Parameter parameter = Parameter.valueOfIgnoreCase(counter.getName()
                    + "_TRANSFORM_PATTERN");
            if (Parameters.getParameter(parameter) != null) {
-               final Pattern pattern = 
Pattern.compile(Parameters.getParameter(parameter));
+               final Pattern pattern = Pattern.compile(Parameters.getParameter(parameter),
+                       Pattern.MULTILINE + Pattern.DOTALL);
                counter.setRequestTransformPattern(pattern);
            }
        }

Original issue reported on code.google.com by michal.b...@gmail.com on 15 Apr 2015 at 12:39

GoogleCodeExporter commented 9 years ago
This is committed in trunk (revision 4066) and ready for the next release 
(1.56).

Thanks Michal.

Original comment by evernat@free.fr on 20 Apr 2015 at 10:24