You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2008/06/11 22:11:44 UTC

svn commit: r666821 - in /tomcat/tc6.0.x/trunk: STATUS.txt java/org/apache/naming/resources/DirContextURLConnection.java webapps/docs/changelog.xml

Author: markt
Date: Wed Jun 11 13:11:44 2008
New Revision: 666821

URL: http://svn.apache.org/viewvc?rev=666821&view=rev
Log:
Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=45101
Format header dates obtained from DirContextURLConnection as per HTTP spec
Patch provided by Chris Hubick
Note: There's downside as naming now depends on the utils

Modified:
    tomcat/tc6.0.x/trunk/STATUS.txt
    tomcat/tc6.0.x/trunk/java/org/apache/naming/resources/DirContextURLConnection.java
    tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml

Modified: tomcat/tc6.0.x/trunk/STATUS.txt
URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/STATUS.txt?rev=666821&r1=666820&r2=666821&view=diff
==============================================================================
--- tomcat/tc6.0.x/trunk/STATUS.txt (original)
+++ tomcat/tc6.0.x/trunk/STATUS.txt Wed Jun 11 13:11:44 2008
@@ -43,14 +43,6 @@
       remm Ok with this addition, but I would only vote +0 for inclusion in this release
            (this still sounds like a very minor fix)
 
-* Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=45101
-  Format header dates obtained from DirContextURLConnection as per HTTP spec
-  Patch provided by Chris Hubick
-  http://svn.apache.org/viewvc?rev=661488&view=rev
-  +1: markt, remm (but there's downside as naming now depends on the utils)
-  +1: fhanik
-  -1: 
-
 * Enhancement https://issues.apache.org/bugzilla/show_bug.cgi?id=45155
   Provide a workaround to a buggy MS WebDAV client.
   http://svn.apache.org/viewvc?rev=664345&view=rev

Modified: tomcat/tc6.0.x/trunk/java/org/apache/naming/resources/DirContextURLConnection.java
URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/naming/resources/DirContextURLConnection.java?rev=666821&r1=666820&r2=666821&view=diff
==============================================================================
--- tomcat/tc6.0.x/trunk/java/org/apache/naming/resources/DirContextURLConnection.java (original)
+++ tomcat/tc6.0.x/trunk/java/org/apache/naming/resources/DirContextURLConnection.java Wed Jun 11 13:11:44 2008
@@ -39,6 +39,7 @@
 import org.apache.naming.JndiPermission;
 import org.apache.naming.resources.Resource;
 import org.apache.naming.resources.ResourceAttributes;
+import org.apache.tomcat.util.http.FastHttpDateFormat;
 
 /**
  * Connection to a JNDI directory context.
@@ -222,6 +223,18 @@
     }
     
 
+    protected String getHeaderValueAsString(Object headerValue) {
+        if (headerValue == null) return null;
+        if (headerValue instanceof Date) {
+            // return date strings (ie Last-Modified) in HTTP format, rather
+            // than Java format
+            return FastHttpDateFormat.formatDate(
+                    ((Date)headerValue).getTime(), null);
+        }
+        return headerValue.toString();
+    }
+
+
     /**
      * Returns an unmodifiable Map of the header fields.
      */
@@ -248,7 +261,8 @@
               ArrayList attributeValueList = new ArrayList(attribute.size());
               NamingEnumeration attributeValues = attribute.getAll();
               while (attributeValues.hasMore()) {
-                  attributeValueList.add(attributeValues.next().toString());
+                  Object attrValue = attributeValues.next();
+                  attributeValueList.add(getHeaderValueAsString(attrValue));
               }
               attributeValueList.trimToSize(); // should be a no-op if attribute.size() didn't lie
               headerFields.put(attributeID, Collections.unmodifiableList(attributeValueList));
@@ -285,7 +299,8 @@
                 if (attributeID.equalsIgnoreCase(name)) {
                     Attribute attribute = attributes.get(attributeID);
                     if (attribute == null) return null;
-                    return attribute.get(attribute.size()-1).toString();
+                    Object attrValue = attribute.get(attribute.size()-1);
+                    return getHeaderValueAsString(attrValue);
                 }
             }
         } catch (NamingException ne) {

Modified: tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml
URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml?rev=666821&r1=666820&r2=666821&view=diff
==============================================================================
--- tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml Wed Jun 11 13:11:44 2008
@@ -188,6 +188,11 @@
         <bug>44988</bug>: Use Java5 syntax for debug options. Patch provided
         by Cedrik Lime. (markt)
       </fix>
+      <fix>
+        <bug>45101</bug>: Format header dates obtained from
+        <code>DirContextURLConnection</code> as per the HTTP spec. Patch
+        provided by Chris Hubick. (markt)
+      </fix>
     </changelog>
   </subsection>
   <subsection name="Coyote">



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org