Author: jawi
Date: Thu Sep 12 07:56:06 2013
New Revision: 1522475

URL: http://svn.apache.org/r1522475
Log:
Incorrectly used JDK7 method, while ACE should be JDK6 compliant:

- URLConnection#getHeaderFieldLong is only available in JDK6,
  so reverted to the default way of obtaining a long value from
  the headers.


Modified:
    
ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/impl/UpdateHandlerBase.java

Modified: 
ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/impl/UpdateHandlerBase.java
URL: 
http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/impl/UpdateHandlerBase.java?rev=1522475&r1=1522474&r2=1522475&view=diff
==============================================================================
--- 
ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/impl/UpdateHandlerBase.java
 (original)
+++ 
ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/impl/UpdateHandlerBase.java
 Thu Sep 12 07:56:06 2013
@@ -100,7 +100,18 @@ public class UpdateHandlerBase extends C
                 ((HttpURLConnection) urlConnection).setRequestMethod("HEAD");
             }
 
-            return 
urlConnection.getHeaderFieldLong(AgentConstants.HEADER_DPSIZE, -1L);
+            long dpSize = -1L;
+            // getHeaderFieldLong is added in JDK7, unfortunately...
+            String headerDPSize = 
urlConnection.getHeaderField(AgentConstants.HEADER_DPSIZE);
+            if (headerDPSize != null && !"".equals(headerDPSize.trim())) {
+                try {
+                    dpSize = Long.parseLong(headerDPSize);
+                }
+                catch (NumberFormatException exception) {
+                    // Ignore, use default of -1...
+                }
+            }
+            return dpSize;
         }
         finally {
             close(urlConnection);


Reply via email to