*) Bugfix for PrintWriter Problem

See: http://www.yacy-forum.de/viewtopic.php?t=2792

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@2494 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
theli 19 years ago
parent d4c5e2af01
commit 4825bfaaf3

@ -49,6 +49,7 @@ package de.anomic.plasma.crawler.ftp;
import java.io.ByteArrayOutputStream; import java.io.ByteArrayOutputStream;
import java.io.File; import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException; import java.io.IOException;
import java.io.PrintStream; import java.io.PrintStream;
import java.io.PrintWriter; import java.io.PrintWriter;
@ -147,7 +148,7 @@ public class CrawlWorker extends AbstractCrawlWorker implements
} }
// creating a cache file object // creating a cache file object
File cacheFile = cacheManager.getCachePath(this.url); File cacheFile = this.cacheManager.getCachePath(this.url);
cacheFile.getParentFile().mkdirs(); cacheFile.getParentFile().mkdirs();
ftpClient.exec("cd \"" + fullPath + "\"", false); ftpClient.exec("cd \"" + fullPath + "\"", false);
@ -157,8 +158,9 @@ public class CrawlWorker extends AbstractCrawlWorker implements
StringBuffer dirList = ftpClient.dirhtml(host, (port==-1)?21:port, fullPath, userName, userPwd); StringBuffer dirList = ftpClient.dirhtml(host, (port==-1)?21:port, fullPath, userName, userPwd);
// write it into a file // write it into a file
PrintWriter writer = new PrintWriter(cacheFile); PrintWriter writer = new PrintWriter(new FileOutputStream(cacheFile),false);
writer.write(dirList.toString()); writer.write(dirList.toString());
writer.flush();
writer.close(); writer.close();
} else { } else {
// download the remote file // download the remote file

Loading…
Cancel
Save