提交 d6203c06 编写于 作者: O Olivier Lamy

improve a bit previous commit

上级 44a8ec11
......@@ -93,7 +93,7 @@ public abstract class ItemGroupMixIn {
File[] subdirs = modulesDir.listFiles(new FileFilter() {
public boolean accept(File child) {
return child.isDirectory() && new File(child,"config.xml").exists();
return child.isDirectory();
}
});
CopyOnWriteMap.Tree<K,V> configurations = new CopyOnWriteMap.Tree<K,V>();
......
......@@ -42,6 +42,8 @@ import org.apache.commons.lang.StringUtils;
import java.io.File;
import java.io.IOException;
import java.util.*;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.annotation.CheckForNull;
import jenkins.model.DirectlyModifiableTopLevelItemGroup;
import org.apache.commons.io.FileUtils;
......@@ -272,7 +274,12 @@ public class Items {
* The directory that contains the config file, not the config file itself.
*/
public static Item load(ItemGroup parent, File dir) throws IOException {
Item item = (Item)getConfigFile(dir).read();
XmlFile xmlFile = getConfigFile(dir);
if (!xmlFile.getFile().exists()) {
Logger.getLogger( Items.class.getName() ).log( Level.WARNING, "could not find file " + xmlFile.getFile());
return null;
}
Item item = (Item)xmlFile.read();
item.onLoad(parent,dir.getName());
return item;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册