abdera-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmsn...@apache.org
Subject svn commit: r555780 - /incubator/abdera/java/trunk/protocol/src/main/java/org/apache/abdera/protocol/util/AbstractResponse.java
Date Thu, 12 Jul 2007 21:39:45 GMT
Author: jmsnell
Date: Thu Jul 12 14:39:44 2007
New Revision: 555780

URL: http://svn.apache.org/viewvc?view=rev&rev=555780
Log:
Certain proxy servers return really wierd values for things like Age.  For instance, it appears
that the WAS Edge Caching Proxy will return "Age: -(" on occasion, which
is really not all that cool

Modified:
    incubator/abdera/java/trunk/protocol/src/main/java/org/apache/abdera/protocol/util/AbstractResponse.java

Modified: incubator/abdera/java/trunk/protocol/src/main/java/org/apache/abdera/protocol/util/AbstractResponse.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/protocol/src/main/java/org/apache/abdera/protocol/util/AbstractResponse.java?view=diff&rev=555780&r1=555779&r2=555780
==============================================================================
--- incubator/abdera/java/trunk/protocol/src/main/java/org/apache/abdera/protocol/util/AbstractResponse.java
(original)
+++ incubator/abdera/java/trunk/protocol/src/main/java/org/apache/abdera/protocol/util/AbstractResponse.java
Thu Jul 12 14:39:44 2007
@@ -38,7 +38,11 @@
   
   public long getAge() {
     String value = getHeader("Age");
-    return (value != null) ? Long.parseLong(value) : -1;
+    try {
+      return (value != null) ? Long.parseLong(value) : -1;
+    } catch (NumberFormatException e) {
+      return -1;
+    }
   }
 
   public String getAllow() {
@@ -55,7 +59,11 @@
 
   public long getContentLength() {
     String value = getHeader("Content-Length");
-    return (value != null) ? Long.parseLong(value) : -1;
+    try {
+      return (value != null) ? Long.parseLong(value) : -1;
+    } catch (NumberFormatException e) {
+      return -1;
+    }
   }
 
   public IRI getContentLocation() {



Mime
View raw message