cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject svn commit: r1454391 - /cxf/trunk/rt/management/src/main/java/org/apache/cxf/management/interceptor/AbstractMessageResponseTimeInterceptor.java
Date Fri, 08 Mar 2013 14:06:02 GMT
Author: sergeyb
Date: Fri Mar  8 14:06:02 2013
New Revision: 1454391

URL: http://svn.apache.org/r1454391
Log:
[CXF-4873] Escape the MBean ObjectName question mark pattern char in the counter interceptor
operation name value if it comes as a message property

Modified:
    cxf/trunk/rt/management/src/main/java/org/apache/cxf/management/interceptor/AbstractMessageResponseTimeInterceptor.java

Modified: cxf/trunk/rt/management/src/main/java/org/apache/cxf/management/interceptor/AbstractMessageResponseTimeInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/management/src/main/java/org/apache/cxf/management/interceptor/AbstractMessageResponseTimeInterceptor.java?rev=1454391&r1=1454390&r2=1454391&view=diff
==============================================================================
--- cxf/trunk/rt/management/src/main/java/org/apache/cxf/management/interceptor/AbstractMessageResponseTimeInterceptor.java
(original)
+++ cxf/trunk/rt/management/src/main/java/org/apache/cxf/management/interceptor/AbstractMessageResponseTimeInterceptor.java
Fri Mar  8 14:06:02 2013
@@ -41,6 +41,8 @@ import org.apache.cxf.service.model.Oper
 
 public abstract class AbstractMessageResponseTimeInterceptor extends AbstractPhaseInterceptor<Message>
{
     private static final Logger LOG = LogUtils.getL7dLogger(AbstractMessageResponseTimeInterceptor.class);
+    private static final String QUESTION_MARK = "?";
+    private static final String ESCAPED_QUESTION_MARK = "\\?";
     
     AbstractMessageResponseTimeInterceptor(String phase) {
         super(phase);
@@ -114,7 +116,7 @@ public abstract class AbstractMessageRes
             if (operationName == null) {
                 Object nameProperty = ex.get("org.apache.cxf.resource.operation.name");
                 if (nameProperty != null) {
-                    operationName = "\"" + nameProperty.toString() + "\"";
+                    operationName = "\"" + escapePatternChars(nameProperty.toString()) +
"\"";
                 }
             }
             
@@ -147,4 +149,11 @@ public abstract class AbstractMessageRes
         }
     }
         
+    protected String escapePatternChars(String value) {  
+        // This can be replaced if really needed with pattern-based matching
+        if (value.lastIndexOf(QUESTION_MARK) != -1) {
+            value.replace(QUESTION_MARK, ESCAPED_QUESTION_MARK);
+        }
+        return value;
+    }
 }



Mime
View raw message