Revision: 16494
http://sourceforge.net/p/gate/code/16494
Author: ian_roberts
Date: 2013-01-28 22:39:41 +0000 (Mon, 28 Jan 2013)
Log Message:
-----------
Call URL.openConnection() just once, then fetch both the input stream and
content type from the same connection, rather than opening two connections, one
of which might not be cleanly closed.
Modified Paths:
--------------
gate/trunk/src/gate/DocumentFormat.java
Modified: gate/trunk/src/gate/DocumentFormat.java
===================================================================
--- gate/trunk/src/gate/DocumentFormat.java 2013-01-28 16:33:22 UTC (rev
16493)
+++ gate/trunk/src/gate/DocumentFormat.java 2013-01-28 22:39:41 UTC (rev
16494)
@@ -18,6 +18,7 @@
import java.io.*;
import java.net.URL;
+import java.net.URLConnection;
import java.util.*;
import org.apache.commons.io.IOUtils;
@@ -193,8 +194,9 @@
try {
try{
- is = url.openConnection().getInputStream();
- contentType = url.openConnection().getContentType();
+ URLConnection urlconn = url.openConnection();
+ is = urlconn.getInputStream();
+ contentType = urlconn.getContentType();
} catch (IOException e){
// Failed to get the content type with te Web server.
// Let's try some other methods like FileSuffix or magic numbers.
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. ON SALE this month only -- learn more at:
http://p.sf.net/sfu/learnnow-d2d
_______________________________________________
GATE-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gate-cvs