You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by an...@apache.org on 2006/05/29 13:44:18 UTC

svn commit: r410077 - in /cocoon/branches/BRANCH_2_1_X: src/java/org/apache/cocoon/environment/http/HttpRequest.java status.xml

Author: antonio
Date: Mon May 29 04:44:18 2006
New Revision: 410077

URL: http://svn.apache.org/viewvc?rev=410077&view=rev
Log:
Fix COCOON-1625 redundant copying between container and form encoding. Thanks to Aleksander Bandelj (aleksander.bandelj@academa.si).

Modified:
    cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/environment/http/HttpRequest.java
    cocoon/branches/BRANCH_2_1_X/status.xml

Modified: cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/environment/http/HttpRequest.java
URL: http://svn.apache.org/viewvc/cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/environment/http/HttpRequest.java?rev=410077&r1=410076&r2=410077&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/environment/http/HttpRequest.java (original)
+++ cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/environment/http/HttpRequest.java Mon May 29 04:44:18 2006
@@ -17,6 +17,7 @@
 
 import java.io.BufferedReader;
 import java.io.IOException;
+import java.io.UnsupportedEncodingException;
 import java.lang.ref.WeakReference;
 import java.util.Collections;
 import java.util.Enumeration;
@@ -314,7 +315,11 @@
 
     public String getParameter(String name) {
         String value = this.req.getParameter(name);
-        if (this.form_encoding == null || value == null) {
+        if (this.form_encoding == null || this.form_encoding == null || value == null) {
+            return value;
+        }
+        // Form and container encoding are equal, skip expensive value decoding
+        if (this.container_encoding.equals(this.form_encoding)) {
             return value;
         }
         return decode(value);
@@ -327,7 +332,7 @@
                 this.container_encoding = "ISO-8859-1";
             byte[] bytes = str.getBytes(this.container_encoding);
             return new String(bytes, form_encoding);
-        } catch (java.io.UnsupportedEncodingException uee) {
+        } catch (UnsupportedEncodingException uee) {
             throw new CascadingRuntimeException("Unsupported Encoding Exception", uee);
         }
     }

Modified: cocoon/branches/BRANCH_2_1_X/status.xml
URL: http://svn.apache.org/viewvc/cocoon/branches/BRANCH_2_1_X/status.xml?rev=410077&r1=410076&r2=410077&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/status.xml (original)
+++ cocoon/branches/BRANCH_2_1_X/status.xml Mon May 29 04:44:18 2006
@@ -182,6 +182,9 @@
   <release version="@version@" date="@date@">
 -->
   <release version="2.1.10" date="TBD">
+    <action dev="AG" type="fix" fixes-bug="COCOON-1625" due-to="Aleksander Bandelj" due-to-email="aleksander.bandelj@academa.si">
+      HTTPRequest: Redundant copying between container and form encoding.
+    </action>
     <action dev="AG" type="fix" fixes-bug="COCOON-1694" due-to="Pier Fumagalli" due-to-email="pier@betaversion.org">
       Error decommissioning component: org.apache.cocoon.components.store.impl.EHDefaultStore.
     </action>