Java 调试时未找到源消息
有人在我的代码中看到任何奇怪的东西吗? 这是存储解析器实例的解析器工厂类。我已在文本文件中以格式将信息对象保存在数据库中Java 调试时未找到源消息,java,eclipse,debugging,singleton,factory-pattern,Java,Eclipse,Debugging,Singleton,Factory Pattern,有人在我的代码中看到任何奇怪的东西吗? 这是存储解析器实例的解析器工厂类。我已在文本文件中以格式将信息对象保存在数据库中 /table/something/something nameoftablecolumn/info/info/... etc. 我有解析这个文本文件的类,解析器可以解析不同的行。例如,如果行开始/table/i将选择table parser调用getParser(“table”)。 当我想要解析视图时,我遇到了一些问题。我试图通过在Eclipse中调试来找到它,但它告诉我
/table/something/something
nameoftablecolumn/info/info/...
etc.
我有解析这个文本文件的类,解析器可以解析不同的行。例如,如果行开始/table/i将选择table parser调用getParser(“table”)。
当我想要解析视图时,我遇到了一些问题。我试图通过在Eclipse中调试来找到它,但它告诉我,找不到源代码,并且在调试中的操作列表中显示了类not found exception。。但在程序中也不例外
当我跳转F5到ParserFactory的构造函数时,就会发生这种情况此类的代码为:
/**
*
*/
package appInspector.input.parser;
import java.util.HashMap;
import appInspector.input.parser.database.SourceParser;
import appInspector.input.parser.database.TableParser;
import appInspector.input.parser.database.ViewParser;
import appInspector.input.parser.filesystem.DirectoryParser;
import appInspector.input.parser.filesystem.FileParser;
/**
*
*/
public class ParserFactory {
private HashMap<String, IParser> parsers = new HashMap<String, IParser>();
private ParserFactory() {
//filesystem
parsers.put("directory", new DirectoryParser());
parsers.put("file", new FileParser());
//table
parsers.put("table", new TableParser());
//view
parsers.put("view", new ViewParser());
//source
parsers.put("source", new SourceParser());
}
public static ParserFactory newInstance(){
return new ParserFactory();
}
public IParser getParser(String key) {
IParser parser = parsers.get(key);
if(parser == null ){
System.out.println("Nepodporovaný objekt");
}
return parser;
}
}
/**
*
*/
包appInspector.input.parser;
导入java.util.HashMap;
导入appInspector.input.parser.database.SourceParser;
导入appInspector.input.parser.database.TableParser;
导入appInspector.input.parser.database.ViewParser;
导入appInspector.input.parser.filesystem.DirectoryParser;
导入appInspector.input.parser.FileParser;
/**
*
*/
公共类解析器工厂{
私有HashMap解析器=新HashMap();
私有ParserFactory(){
//文件系统
put(“directory”,newdirectoryparser());
put(“file”,newfileparser());
//桌子
put(“table”,newtableparser());
//看法
put(“view”,newviewparser());
//来源
put(“source”,newsourceparser());
}
public static ParserFactory newInstance(){
返回新的ParserFactory();
}
公共IParser getParser(字符串键){
IParser parser=parsers.get(key);
if(解析器==null){
系统输出打印(Nepodporovanýobjekt);
}
返回解析器;
}
}
编辑:
我也有类似的问题(类似的输出-表示找不到源)。
我尝试在我的Eclipse版本上复制该问题,但未能成功。我是日食朱诺,OSX山狮 我对您的代码进行了一些修改以测试它:
package com.aj.spring;
import java.util.HashMap;
/**
* *
*/
public class ParserFactory {
private HashMap<String, IParser> parsers = new HashMap<String, IParser>();
private ParserFactory() {
parsers.put("directory", new FileParser());
parsers.put("file", new FileParser());
parsers.put("table", new FileParser());
parsers.put("view", new FileParser());
parsers.put("source", new FileParser());
}
public static ParserFactory newInstance() {
return new ParserFactory();
}
public IParser getParser(String key) {
IParser parser = parsers.get(key);
if (parser == null) {
System.out.println("Nepodporovan objekt");
}
return parser;
}
public static void main(String[] args) {
ParserFactory.newInstance();
}
}
package com.aj.spring;
导入java.util.HashMap;
/**
* *
*/
公共类解析器工厂{
私有HashMap解析器=新HashMap();
私有ParserFactory(){
put(“目录”,newfileparser());
put(“file”,newfileparser());
put(“table”,newfileparser());
put(“view”,newfileparser());
put(“source”,newfileparser());
}
公共静态ParserFactory newInstance(){
返回新的ParserFactory();
}
公共IParser getParser(字符串键){
IParser parser=parsers.get(key);
if(解析器==null){
System.out.println(“Nepodporovan对象”);
}
返回解析器;
}
公共静态void main(字符串[]args){
ParserFactory.newInstance();
}
}