Use Buffered Streams and close them properly
git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@115975 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
1 parent
6d5c248cf9
commit
97a5792442
1 file changed
+16
-3
@@ -17,10 +17,13 @@ package org.apache.maven.linkcheck.validation;
|
||||
* ====================================================================
|
||||
*/
|
||||
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.BufferedOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
@@ -31,7 +34,7 @@ import org.apache.commons.logging.LogFactory;
|
||||
/**
|
||||
* @author <a href="mailto:bwalding@apache.org">Ben Walding</a>
|
||||
* @author <a href="mailto:carlos@apache.org">Carlos Sanchez</a>
|
||||
* @version $Id: LinkValidatorManager.java,v 1.7 2004/08/01 21:05:32 carlos Exp $
|
||||
* @version $Id: LinkValidatorManager.java,v 1.8 2004/08/17 17:29:49 carlos Exp $
|
||||
*/
|
||||
|
||||
public class LinkValidatorManager {
|
||||
@@ -103,10 +106,15 @@ public class LinkValidatorManager {
|
||||
try {
|
||||
File f = new File(cacheFilename);
|
||||
if (f.exists()) {
|
||||
this.cache.load(new FileInputStream(cacheFilename));
|
||||
BufferedInputStream is = new BufferedInputStream(
|
||||
new FileInputStream(cacheFilename));
|
||||
this.cache.load(is);
|
||||
is.close();
|
||||
}
|
||||
} catch (FileNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -117,9 +125,14 @@ public class LinkValidatorManager {
|
||||
if (dir != null) {
|
||||
dir.mkdirs();
|
||||
}
|
||||
this.cache.save(new FileOutputStream(cacheFilename));
|
||||
BufferedOutputStream os = new BufferedOutputStream(
|
||||
new FileOutputStream(cacheFilename));
|
||||
this.cache.save(os);
|
||||
os.close();
|
||||
} catch (FileNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user