ws-axis-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject svn commit: r491624 - in /webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2: transport/http/HTTPTransportUtils.java util/JavaUtils.java
Date Mon, 01 Jan 2007 20:33:45 GMT
Author: dims
Date: Mon Jan  1 12:33:44 2007
New Revision: 491624

URL: http://svn.apache.org/viewvc?view=rev&rev=491624
Log:
optimize java keyword search a bit. reduce calls to getProperty/getParameter

Modified:
    webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2/transport/http/HTTPTransportUtils.java
    webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2/util/JavaUtils.java

Modified: webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2/transport/http/HTTPTransportUtils.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2/transport/http/HTTPTransportUtils.java?view=diff&rev=491624&r1=491623&r2=491624
==============================================================================
--- webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2/transport/http/HTTPTransportUtils.java
(original)
+++ webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2/transport/http/HTTPTransportUtils.java
Mon Jan  1 12:33:44 2007
@@ -98,30 +98,28 @@
 
     public static boolean doWriteMTOM(MessageContext msgContext) {
         boolean enableMTOM = false;
-
-        if (msgContext.getParameter(Constants.Configuration.ENABLE_MTOM) != null) {
+        Parameter parameter = msgContext.getParameter(Constants.Configuration.ENABLE_MTOM);
+        if (parameter != null) {
             enableMTOM = JavaUtils.isTrueExplicitly(
-                    msgContext.getParameter(Constants.Configuration.ENABLE_MTOM).getValue());
+                    parameter.getValue());
         }
-
-        if (msgContext.getProperty(Constants.Configuration.ENABLE_MTOM) != null) {
-            enableMTOM = JavaUtils.isTrueExplicitly(
-                    msgContext.getProperty(Constants.Configuration.ENABLE_MTOM));
+        Object property = msgContext.getProperty(Constants.Configuration.ENABLE_MTOM);
+        if (property != null) {
+            enableMTOM = JavaUtils.isTrueExplicitly(property);
         }
         return enableMTOM;
     }
     
     public static boolean doWriteSwA(MessageContext msgContext) {
         boolean enableSwA = false;
-
-        if (msgContext.getParameter(Constants.Configuration.ENABLE_SWA) != null) {
+        Parameter parameter = msgContext.getParameter(Constants.Configuration.ENABLE_SWA);
+        if (parameter != null) {
             enableSwA = JavaUtils.isTrueExplicitly(
-                    msgContext.getParameter(Constants.Configuration.ENABLE_SWA).getValue());
+                    parameter.getValue());
         }
-
-        if (msgContext.getProperty(Constants.Configuration.ENABLE_SWA) != null) {
-            enableSwA = JavaUtils.isTrueExplicitly(
-                    msgContext.getProperty(Constants.Configuration.ENABLE_SWA));
+        Object property = msgContext.getProperty(Constants.Configuration.ENABLE_SWA);
+        if (property != null) {
+            enableSwA = JavaUtils.isTrueExplicitly(property);
         }
         return enableSwA;
     }

Modified: webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2/util/JavaUtils.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2/util/JavaUtils.java?view=diff&rev=491624&r1=491623&r2=491624
==============================================================================
--- webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2/util/JavaUtils.java
(original)
+++ webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2/util/JavaUtils.java
Mon Jan  1 12:33:44 2007
@@ -71,7 +71,29 @@
      * @return Returns boolean.
      */
     public static boolean isJavaKeyword(String keyword) {
+        // None of the java keywords have uppercase characters
+        if(hasUpperCase(keyword)) {
+            return false;
+        }
         return (Arrays.binarySearch(keywords, keyword, englishCollator) >= 0);
+    }
+
+    /**
+     * Check if the word has any uppercase letters
+     * 
+     * @param word
+     * @return
+     */
+    public static boolean hasUpperCase(String word) {
+        if (word == null)
+            return false;
+        int len = word.length();
+        for (int i = 0; i < len; i++) {
+            if (Character.isUpperCase(word.charAt(i))) {
+                return true;
+            }
+        }
+        return false;
     }
 
     /**



---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org


Mime
View raw message