Skip to content

Commit

Permalink
Merge branch 'master' of http://192.168.10.158/product/Jcoder
Browse files Browse the repository at this point in the history
  • Loading branch information
Ansj committed Jun 7, 2018
2 parents 4378e73 + 5c355a1 commit 9d465a6
Showing 1 changed file with 18 additions and 12 deletions.
30 changes: 18 additions & 12 deletions src/main/java/org/nlpcn/jcoder/util/GroupFileListener.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,13 @@
import java.nio.file.Path;
import java.nio.file.SimpleFileVisitor;
import java.nio.file.attribute.BasicFileAttributes;
import java.util.*;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.function.Function;
import java.util.stream.Collectors;
Expand Down Expand Up @@ -75,10 +81,6 @@ public static void regediter(String groupName) {

/**
* 创建监控
*
* @param file
* @param groupFileListener
* @return
*/
private static FileAlterationMonitor createMonitor(File file, GroupFileListener groupFileListener) {
FileAlterationObserver observer = new FileAlterationObserver(file, null, null);
Expand Down Expand Up @@ -270,22 +272,22 @@ private synchronized void createTask(File file) throws CodeException {
this.onFileChange(file);
} else {

ClassDoc parse = null ;
ClassDoc parse = null;

try {
parse = JavaDocUtil.parse(content);
} catch (Exception e) {
throw new CodeException(e) ;
throw new CodeException(e);
}

task = new Task();
task.setCode(content);
task.setCreateUser("admin");

if(parse.getScheduleStr()!=null){
if (parse.getScheduleStr() != null) {
task.setType(2);
task.setScheduleStr(parse.getScheduleStr());
}else{
} else {
task.setType(1);
}

Expand Down Expand Up @@ -340,6 +342,13 @@ public void onFileChange(File file) {
return;
}

try{
JavaDocUtil.compile(fCode.replace((char)65307,'错')) ;
}catch (Exception e){
printLog(String.format("path:%s className:%s can not to compile, so skip save:%s...................................................................", file.getAbsoluteFile(), task.getName(), fileName));
return ;
}

StaticValue.getSystemIoc().get(TaskService.class, "taskService").saveOrUpdate(task);
flush(task.getName());
taskFileMap.put(fileName, file);
Expand All @@ -356,9 +365,6 @@ public void onFileChange(File file) {

/**
* 刷新這個類
*
* @param taskName
* @throws Exception
*/
private void flush(String taskName) {
Set<String> taskNames = new HashSet<>(1);
Expand Down

0 comments on commit 9d465a6

Please sign in to comment.