update to avoid FileNotFoundException if the parent directory does not exist .
git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@112850 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
1 parent
0cf7643d7c
commit
06515f23fe
6 files changed
+34
-7
No files matched your search
@@ -77,7 +77,7 @@ import org.apache.maven.linkcheck.validation.MailtoLinkValidator;
|
||||
* their links checked.
|
||||
*
|
||||
* @author <a href="mailto:bwalding@apache.org">Ben Walding</a>
|
||||
* @version $Id: LinkCheck.java,v 1.3 2003/02/03 14:13:54 bwalding Exp $
|
||||
* @version $Id: LinkCheck.java,v 1.4 2003/02/07 11:47:14 evenisse Exp $
|
||||
*/
|
||||
public class LinkCheck
|
||||
{
|
||||
@@ -216,6 +216,10 @@ public class LinkCheck
|
||||
*/
|
||||
private void createDocument(List files) throws Exception
|
||||
{
|
||||
File dir = output.getParentFile();
|
||||
if (dir != null) {
|
||||
dir.mkdirs();
|
||||
}
|
||||
PrintWriter out = new PrintWriter(new OutputStreamWriter(new FileOutputStream(output), getOutputEncoding()));
|
||||
|
||||
StringBuffer buffer = new StringBuffer();
|
||||
|
||||
@@ -69,7 +69,7 @@ import org.apache.commons.logging.LogFactory;
|
||||
|
||||
/**
|
||||
* @author <a href="mailto:bwalding@apache.org">Ben Walding</a>
|
||||
* @version $Id: LinkValidatorManager.java,v 1.2 2003/02/03 14:13:54 bwalding Exp $
|
||||
* @version $Id: LinkValidatorManager.java,v 1.3 2003/02/07 11:47:14 evenisse Exp $
|
||||
*/
|
||||
|
||||
public class LinkValidatorManager {
|
||||
@@ -145,6 +145,11 @@ public class LinkValidatorManager {
|
||||
|
||||
public void saveCache(String cacheFilename) {
|
||||
try {
|
||||
File cacheFile = new File(cacheFileName);
|
||||
File dir = cacheFile.getParentFile();
|
||||
if (dir != null) {
|
||||
dir.mkdirs();
|
||||
}
|
||||
this.cache.save(new FileOutputStream(cacheFilename));
|
||||
} catch (FileNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
|
||||
Reference in new issue
Block a user