Author: dkulp
Date: Mon Mar 18 20:05:11 2013
New Revision: 1457955

URL: http://svn.apache.org/r1457955
Log:
Merged revisions 1456922 via  git cherry-pick from
https://svn.apache.org/repos/asf/cxf/trunk

........
  r1456922 | asoldano | 2013-03-15 08:18:14 -0400 (Fri, 15 Mar 2013) | 2 lines

  Misc minor performance fixes

........

Modified:
    
cxf/branches/2.7.x-fixes/api/src/main/java/org/apache/cxf/helpers/HttpHeaderHelper.java
    
cxf/branches/2.7.x-fixes/api/src/main/java/org/apache/cxf/service/model/ServiceModelUtil.java
    
cxf/branches/2.7.x-fixes/api/src/main/java/org/apache/cxf/staxutils/AbstractDOMStreamReader.java
    
cxf/branches/2.7.x-fixes/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyOutInterceptor.java
    
cxf/branches/2.7.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/AbstractBindingBuilder.java

Modified: 
cxf/branches/2.7.x-fixes/api/src/main/java/org/apache/cxf/helpers/HttpHeaderHelper.java
URL: 
http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/api/src/main/java/org/apache/cxf/helpers/HttpHeaderHelper.java?rev=1457955&r1=1457954&r2=1457955&view=diff
==============================================================================
--- 
cxf/branches/2.7.x-fixes/api/src/main/java/org/apache/cxf/helpers/HttpHeaderHelper.java
 (original)
+++ 
cxf/branches/2.7.x-fixes/api/src/main/java/org/apache/cxf/helpers/HttpHeaderHelper.java
 Mon Mar 18 20:05:11 2013
@@ -26,6 +26,7 @@ import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.concurrent.ConcurrentHashMap;
+import java.util.regex.Pattern;
 
 public final class HttpHeaderHelper {
     public static final String ACCEPT_ENCODING = "Accept-Encoding";
@@ -44,6 +45,7 @@ public final class HttpHeaderHelper {
     
     private static Map<String, String> internalHeaders = new HashMap<String, 
String>();
     private static ConcurrentHashMap<String, String> encodings = new 
ConcurrentHashMap<String, String>();
+    private static Pattern charsetPattern = Pattern.compile("\"|'");
     
     static {
         internalHeaders.put("Accept-Encoding", "accept-encoding");
@@ -110,8 +112,7 @@ public final class HttpHeaderHelper {
         }
         // Charsets can be quoted. But it's quite certain that they can't have 
escaped quoted or
         // anything like that.
-        enc = enc.replace("\"", "").trim();
-        enc = enc.replace("'", "");
+        enc = charsetPattern.matcher(enc).replaceAll("").trim();
         if ("".equals(enc)) {
             return deflt;
         }

Modified: 
cxf/branches/2.7.x-fixes/api/src/main/java/org/apache/cxf/service/model/ServiceModelUtil.java
URL: 
http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/api/src/main/java/org/apache/cxf/service/model/ServiceModelUtil.java?rev=1457955&r1=1457954&r2=1457955&view=diff
==============================================================================
--- 
cxf/branches/2.7.x-fixes/api/src/main/java/org/apache/cxf/service/model/ServiceModelUtil.java
 (original)
+++ 
cxf/branches/2.7.x-fixes/api/src/main/java/org/apache/cxf/service/model/ServiceModelUtil.java
 Mon Mar 18 20:05:11 2013
@@ -79,10 +79,8 @@ public final class ServiceModelUtil {
             return null;
         }
         BindingInfo service = ep.getEndpointInfo().getBinding();
-        Map<QName, BindingOperationInfo> wrapperMap =
-            CastUtils.cast(service.getProperty("ServiceModel.WRAPPER.MAP"
-                                               + (output ? "" : "_OUT"), 
Map.class));
-
+        Map<QName, BindingOperationInfo> wrapperMap = 
CastUtils.cast(service.getProperty(output
+            ? "ServiceModel.WRAPPER.MAP_OUT" : "ServiceModel.WRAPPER.MAP", 
Map.class));
 
         if (wrapperMap == null) {
             wrapperMap = new HashMap<QName, BindingOperationInfo>();
@@ -108,8 +106,7 @@ public final class ServiceModelUtil {
                     }
                 }
             }
-            service.setProperty("ServiceModel.WRAPPER.MAP"
-                                + (output ? "" : "_OUT"), wrapperMap);
+            service.setProperty(output ? "ServiceModel.WRAPPER.MAP_OUT" : 
"ServiceModel.WRAPPER.MAP", wrapperMap);
         }
         return wrapperMap.get(opName);
     }

Modified: 
cxf/branches/2.7.x-fixes/api/src/main/java/org/apache/cxf/staxutils/AbstractDOMStreamReader.java
URL: 
http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/api/src/main/java/org/apache/cxf/staxutils/AbstractDOMStreamReader.java?rev=1457955&r1=1457954&r2=1457955&view=diff
==============================================================================
--- 
cxf/branches/2.7.x-fixes/api/src/main/java/org/apache/cxf/staxutils/AbstractDOMStreamReader.java
 (original)
+++ 
cxf/branches/2.7.x-fixes/api/src/main/java/org/apache/cxf/staxutils/AbstractDOMStreamReader.java
 Mon Mar 18 20:05:11 2013
@@ -19,9 +19,7 @@
 package org.apache.cxf.staxutils;
 
 import java.util.Collections;
-import java.util.HashMap;
 import java.util.List;
-import java.util.Map;
 
 import javax.xml.stream.Location;
 import javax.xml.stream.XMLStreamConstants;
@@ -38,8 +36,6 @@ import javax.xml.stream.XMLStreamReader;
 public abstract class AbstractDOMStreamReader<T, I> implements XMLStreamReader 
{
     protected int currentEvent = XMLStreamConstants.START_DOCUMENT;
 
-    private Map<String, Object> properties = new HashMap<String, Object>();
-
     private FastStack<ElementFrame<T, I>> frames = new 
FastStack<ElementFrame<T, I>>();
 
     private ElementFrame<T, I> frame;
@@ -118,7 +114,7 @@ public abstract class AbstractDOMStreamR
      * @see javax.xml.stream.XMLStreamReader#getProperty(java.lang.String)
      */
     public Object getProperty(String key) throws IllegalArgumentException {
-        return properties.get(key);
+        return null;
     }
 
     /*

Modified: 
cxf/branches/2.7.x-fixes/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyOutInterceptor.java
URL: 
http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyOutInterceptor.java?rev=1457955&r1=1457954&r2=1457955&view=diff
==============================================================================
--- 
cxf/branches/2.7.x-fixes/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyOutInterceptor.java
 (original)
+++ 
cxf/branches/2.7.x-fixes/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyOutInterceptor.java
 Mon Mar 18 20:05:11 2013
@@ -76,7 +76,6 @@ public class PolicyOutInterceptor extend
             return;
         }
 
-        List<Interceptor<? extends Message>> interceptors = new 
ArrayList<Interceptor<? extends Message>>();
         Collection<Assertion> assertions = new ArrayList<Assertion>();
 
         // 1. Check overridden policy
@@ -89,7 +88,7 @@ public class PolicyOutInterceptor extend
             PolicyUtils.logPolicy(LOG, Level.FINEST, "Using effective policy: 
", 
                                   effectivePolicy.getPolicy());
             
-            interceptors.addAll(effectivePolicy.getInterceptors());
+            addInterceptors(effectivePolicy.getInterceptors(), msg);
             assertions.addAll(effectivePolicy.getChosenAlternative());
         } else if (MessageUtils.isRequestor(msg)) {
             // 2. Process client policy
@@ -102,7 +101,7 @@ public class PolicyOutInterceptor extend
                 PolicyUtils.logPolicy(
                     LOG, Level.FINEST, "Using effective policy: ", 
effectivePolicy.getPolicy()
                 );
-                interceptors.addAll(effectivePolicy.getInterceptors());
+                addInterceptors(effectivePolicy.getInterceptors(), msg);
                 assertions.addAll(effectivePolicy.getChosenAlternative());
             }
         } else {
@@ -117,18 +116,11 @@ public class PolicyOutInterceptor extend
                 PolicyUtils.logPolicy(
                     LOG, Level.FINEST, "Using effective policy: ", 
effectivePolicy.getPolicy()
                 );
-                interceptors.addAll(effectivePolicy.getInterceptors());
+                addInterceptors(effectivePolicy.getInterceptors(), msg);
                 assertions.addAll(effectivePolicy.getChosenAlternative());
             }
         }
         
-        // add interceptors into message chain
-        for (Interceptor<? extends Message> oi : interceptors) {
-            msg.getInterceptorChain().add(oi);
-            LOG.log(Level.FINE, "Added interceptor of type {0}",
-                    oi.getClass().getSimpleName());           
-        }
-
         // insert assertions of endpoint's fault vocabulary into message       
 
         if (null != assertions && !assertions.isEmpty()) {
             if (LOG.isLoggable(Level.FINEST)) {
@@ -145,4 +137,11 @@ public class PolicyOutInterceptor extend
             
msg.getInterceptorChain().add(PolicyVerificationOutInterceptor.INSTANCE);
         }
     }
+    
+    private static void addInterceptors(List<Interceptor<? extends Message>> 
interceptors, Message msg) {
+        for (Interceptor<? extends Message> oi : interceptors) {
+            msg.getInterceptorChain().add(oi);
+            LOG.log(Level.FINE, "Added interceptor of type {0}", 
oi.getClass().getSimpleName());
+        }
+    }
 }

Modified: 
cxf/branches/2.7.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/AbstractBindingBuilder.java
URL: 
http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/AbstractBindingBuilder.java?rev=1457955&r1=1457954&r2=1457955&view=diff
==============================================================================
--- 
cxf/branches/2.7.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/AbstractBindingBuilder.java
 (original)
+++ 
cxf/branches/2.7.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/AbstractBindingBuilder.java
 Mon Mar 18 20:05:11 2013
@@ -277,7 +277,9 @@ public abstract class AbstractBindingBui
         if (assertion == null) {
             return;
         }
-        LOG.log(Level.FINE, "Not asserting " + assertion.getName() + ": " + 
reason);
+        if (LOG.isLoggable(Level.FINE)) {
+            LOG.log(Level.FINE, "Not asserting " + assertion.getName() + ": " 
+ reason);
+        }
         Collection<AssertionInfo> ais;
         ais = aim.get(assertion.getName());
         if (ais != null) {
@@ -296,7 +298,9 @@ public abstract class AbstractBindingBui
         if (assertion == null) {
             return;
         }
-        LOG.log(Level.FINE, "Not asserting " + assertion.getName() + ": " + 
reason);
+        if (LOG.isLoggable(Level.FINE)) {
+            LOG.log(Level.FINE, "Not asserting " + assertion.getName() + ": " 
+ reason);
+        }
         Collection<AssertionInfo> ais;
         ais = aim.get(assertion.getName());
         if (ais != null) {
@@ -315,7 +319,9 @@ public abstract class AbstractBindingBui
         if (assertion == null) {
             return;
         }
-        LOG.log(Level.FINE, "Asserting " + assertion.getName());
+        if (LOG.isLoggable(Level.FINE)) {
+            LOG.log(Level.FINE, "Asserting " + assertion.getName());
+        }
         Collection<AssertionInfo> ais;
         ais = aim.get(assertion.getName());
         if (ais != null) {


Reply via email to