Posted by:lopwind
Posted on:2007-07-25 21:24
大家好,我是新手,想请教高手一下一个关于ParseException的问题。调试的时候出错,提示我ParseException cannot resolve symbol. 程序段如下:
private static void parse(AbstractQuery _query) {
while(!currentToken.equals(END)) {
if(currentToken.equals("query:")) {
nextToken();
parseQueryClause( _query);
continue;
}
if(currentToken.equals("category:")) {
nextToken();
parseCategoryClause(_query);
continue;
}
if(currentToken.equals("fetch:")) {
nextToken();
parseFetchClause(_query);
continue;
}
throw new ParseException ("Unknown descriptor:" + currentToken);
}
}
错误提示是:
symbol : constructor ParseException (java.lang.String)
location: class java.text.ParseException
throw new ParseException ("Unknown descriptor:" + currentToken);
我查了ParseException的定义方法,是ParseException(String , Offset);但是我在+ currentToken后边加 ,0 把Offset加上之后,系统又提示我说前边的
nextToken();
unreported exception java.text.ParseException; must be caught or declared to be thrown
请高手帮忙~~万分感谢