Commit 8774cce7 authored by yihua.huang's avatar yihua.huang

files

parent 3d4ad02b
...@@ -36,7 +36,7 @@ public class FilePipeline implements Pipeline { ...@@ -36,7 +36,7 @@ public class FilePipeline implements Pipeline {
String path = this.path + "" + domain + "/"; String path = this.path + "" + domain + "/";
File file = new File(path); File file = new File(path);
if (!file.exists()) { if (!file.exists()) {
file.mkdir(); file.mkdirs();
} }
try { try {
PrintWriter printWriter = new PrintWriter(new FileWriter(path + DigestUtils.md5Hex(page.getUrl().toString()) + ".html")); PrintWriter printWriter = new PrintWriter(new FileWriter(path + DigestUtils.md5Hex(page.getUrl().toString()) + ".html"));
......
...@@ -59,6 +59,10 @@ public class FileCacheQueueSchedular implements Schedular { ...@@ -59,6 +59,10 @@ public class FileCacheQueueSchedular implements Schedular {
} }
private void init() { private void init() {
File file = new File(filePath);
if (!file.exists()){
file.mkdirs();
}
readFile(); readFile();
initWriter(); initWriter();
initFlushThread(); initFlushThread();
......
...@@ -29,9 +29,6 @@ public class FreemarkerPipeline implements Pipeline { ...@@ -29,9 +29,6 @@ public class FreemarkerPipeline implements Pipeline {
this.template = configuration.getTemplate(template); this.template = configuration.getTemplate(template);
this.path = path; this.path = path;
File file = new File(path); File file = new File(path);
if (!file.exists()) {
file.mkdir();
}
} }
public FreemarkerPipeline(String template) throws IOException { public FreemarkerPipeline(String template) throws IOException {
...@@ -46,7 +43,7 @@ public class FreemarkerPipeline implements Pipeline { ...@@ -46,7 +43,7 @@ public class FreemarkerPipeline implements Pipeline {
String path = this.path + "" + domain + "/"; String path = this.path + "" + domain + "/";
File file = new File(path); File file = new File(path);
if (!file.exists()) { if (!file.exists()) {
file.mkdir(); file.mkdirs();
} }
try { try {
PrintWriter printWriter = new PrintWriter(new FileWriter(path + DigestUtils.md5Hex(page.getUrl().toString()) + ".html")); PrintWriter printWriter = new PrintWriter(new FileWriter(path + DigestUtils.md5Hex(page.getUrl().toString()) + ".html"));
...@@ -54,6 +51,7 @@ public class FreemarkerPipeline implements Pipeline { ...@@ -54,6 +51,7 @@ public class FreemarkerPipeline implements Pipeline {
printWriter.close(); printWriter.close();
} catch (TemplateException e) { } catch (TemplateException e) {
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace();
} }
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment