[java-openws COMMIT] in /branches/REL_1: doc/RELEASE-NOTES.txt pom.xml src/main/java/org/opensaml/util/resource/HttpR...
noreply at shibboleth.net
noreply at shibboleth.net
Tue Feb 21 13:53:34 GMT 2012
Author: lajoie
Date: Tue Feb 21 13:53:34 2012
New Revision: 424
URL: http://svn.shibboleth.net/view/java-openws?rev=424&view=rev
Log:
Properly close HTTP connection - JOWS-33
Pick up latest xmltooling - JOWS-34
Modified:
branches/REL_1/doc/RELEASE-NOTES.txt
branches/REL_1/pom.xml
branches/REL_1/src/main/java/org/opensaml/util/resource/HttpResource.java
Modified: branches/REL_1/doc/RELEASE-NOTES.txt
URL: http://svn.shibboleth.net/view/java-openws/branches/REL_1/doc/RELEASE-NOTES.txt?rev=424&r1=423&r2=424&view=diff
==============================================================================
--- branches/REL_1/doc/RELEASE-NOTES.txt (original)
+++ branches/REL_1/doc/RELEASE-NOTES.txt Tue Feb 21 13:53:34 2012
@@ -1,3 +1,8 @@
+Changes in Release 1.4.4
+==============================================
+[JOWS-33] - HttpResource does not properly release HTTP connnections
+[JOWS-34] - Update xmltooling library
+
Changes in Release 1.4.3
==============================================
[JOWS-31] - Failed test on Windows: testGetLocation(org.opensaml.util.resource.FilesystemResourceTest): expected:</...> but was:<C:\...>
Modified: branches/REL_1/pom.xml
URL: http://svn.shibboleth.net/view/java-openws/branches/REL_1/pom.xml?rev=424&r1=423&r2=424&view=diff
==============================================================================
--- branches/REL_1/pom.xml (original)
+++ branches/REL_1/pom.xml Tue Feb 21 13:53:34 2012
@@ -12,7 +12,7 @@
<groupId>org.opensaml</groupId>
<artifactId>openws</artifactId>
- <version>1.4.3</version>
+ <version>1.4.4</version>
<packaging>jar</packaging>
<name>OpenWS</name>
@@ -48,7 +48,7 @@
<dependency>
<groupId>org.opensaml</groupId>
<artifactId>xmltooling</artifactId>
- <version>1.3.3</version>
+ <version>1.3.4</version>
</dependency>
<dependency>
<groupId>commons-codec</groupId>
Modified: branches/REL_1/src/main/java/org/opensaml/util/resource/HttpResource.java
URL: http://svn.shibboleth.net/view/java-openws/branches/REL_1/src/main/java/org/opensaml/util/resource/HttpResource.java?rev=424&r1=423&r2=424&view=diff
==============================================================================
--- branches/REL_1/src/main/java/org/opensaml/util/resource/HttpResource.java (original)
+++ branches/REL_1/src/main/java/org/opensaml/util/resource/HttpResource.java Tue Feb 21 13:53:34 2012
@@ -22,6 +22,7 @@
import org.apache.commons.httpclient.Header;
import org.apache.commons.httpclient.HttpClient;
+import org.apache.commons.httpclient.HttpMethod;
import org.apache.commons.httpclient.HttpStatus;
import org.apache.commons.httpclient.methods.GetMethod;
import org.apache.commons.httpclient.methods.HeadMethod;
@@ -49,7 +50,7 @@
*/
public HttpResource(String resource) {
super();
-
+
resourceUrl = DatatypeHelper.safeTrimOrNullString(resource);
if (resourceUrl == null) {
throw new IllegalArgumentException("Resource URL may not be null or empty");
@@ -57,7 +58,7 @@
httpClient = new HttpClient();
}
-
+
/**
* Constructor.
*
@@ -68,7 +69,7 @@
*/
public HttpResource(String resource, ResourceFilter resourceFilter) {
super(resourceFilter);
-
+
resourceUrl = DatatypeHelper.safeTrimOrNullString(resource);
if (resourceUrl == null) {
throw new IllegalArgumentException("Resource URL may not be null or empty");
@@ -90,6 +91,8 @@
return true;
} catch (IOException e) {
throw new ResourceException("Unable to contact resource URL: " + resourceUrl, e);
+ } finally {
+ headMethod.releaseConnection();
}
}
@@ -97,7 +100,7 @@
public InputStream getInputStream() throws ResourceException {
GetMethod getMethod = getResource();
try {
- return applyFilter(getMethod.getResponseBodyAsStream());
+ return new ConnectionClosingInputStream(getMethod, applyFilter(getMethod.getResponseBodyAsStream()));
} catch (IOException e) {
throw new ResourceException("Unable to read response", e);
}
@@ -114,7 +117,7 @@
+ ", received HTTP status code " + headMethod.getStatusCode());
}
Header lastModifiedHeader = headMethod.getResponseHeader("Last-Modified");
- if (lastModifiedHeader != null && ! DatatypeHelper.isEmpty(lastModifiedHeader.getValue())) {
+ if (lastModifiedHeader != null && !DatatypeHelper.isEmpty(lastModifiedHeader.getValue())) {
long lastModifiedTime = DateUtil.parseDate(lastModifiedHeader.getValue()).getTime();
return new DateTime(lastModifiedTime, ISOChronology.getInstanceUTC());
}
@@ -124,6 +127,8 @@
throw new ResourceException("Unable to contact resource URL: " + resourceUrl, e);
} catch (DateParseException e) {
[... 82 lines stripped ...]
More information about the commits
mailing list