这一行:
File[] FileOrDir=root.listFiles(); FileOrDir可能为null在这句后面需要检测 null的情况。
if(FileOrDir!=null){ //your code here
}
解决方案 »
- struts2中请求返回到jsp页面提示下载
- struts2 一个请求执行两次action
- 这应该是struts2的一个bug吧~~
- filter用户验证
- 关于转发的问题?
- 100分!求xml解释器的优点和缺点
- [tomcat连接池问题]连接人数过多,则会出现找不到连接的情况,刷新后又可以重新找到连接,页面显示正常。
- SAX高手请进。 解决问题,一定给分!!!
- 有没有单步跟踪调试java的可视化工具?如何获取?可以调试EJB吗?
- Could not parse mapping document from resouce it.cast.bean.grade.hbm.xml
- 请帮我解释一下以下对struts和tomcat的问题。
- 我现在正在做项目,需要全文检索,对一对文本文件进行检索,如果有满足“关键字”的就现实出来,谁用做过这方面的项目,给我点资料,参考一下。
public void writerToIndex(String DirFile)
{
try
{
File root=new File(DirFile);
if(root.isDirectory()){
File[] files=root.listFiles();
for(File file :files){
if(file.isDirectory()){
this.writerToIndex(root.getPath()); }else{
//do work for a simple file
}
}
}else{
//do work for a simple file
}
public void IndexTest(IndexWriter writer)
{
try
{
writer = new IndexWriter(index_path,new StandardAnalyzer(),false);
System.out.println(writer.toString());
}
catch(Exception e)
{
System.out.println("writer初始化错误");
System.out.println("---");
e.printStackTrace();
}
}
这里函数的参数会被try后的第一句覆盖掉的啊。