lychbeyond 发表于 2012-4-24 11:31:37

ant 执行cobertura report appear a lot of error : JavaNCSS got an error

本帖最后由 lychbeyond 于 2012-4-24 13:04 编辑

Environment: ant1.7.1+junit4+cobertura1.9.4



net.sourceforge.cobertura.javancss.parser.TokenMgrError: Lexical error at line 29, column 59. Encountered: "\r" (13), after : "\"\u5bb8\u832c\u7ca1\u5a75\ufffd\u693f\u6769\ufffd;"
at net.sourceforge.cobertura.javancss.parser.JavaParserTokenManager.getNextToken(JavaParserTokenManager.java:2078)
........................................................................................
2012 04 23 15:55:39,797 WARN 0 ComplexityCalculator:107(main) - JavaNCSS got an error while parsing the java file D:\testworkspace\HT20120420\src\com\cnbab\proj118\regnlogin\action\ActivateUserByEmail.java
TokenMgrError in STDIN
Lexical error at line 29, column 59. Encountered: "\r" (13), after : "\"\u5bb8\u832c\u7ca1\u5a75\ufffd\u693f\u6769\ufffd;"
.........................................................................................................
2012 04 23 15:55:39,814 WARN 17 ComplexityCalculator:107(main) - JavaNCSS got an error while parsing the java file D:\testworkspace\HT20120420\src\com\cnbab\proj118\regnlogin\action\ActivateUserBySms.java
TokenMgrError in STDIN
Lexical error at line 32, column 59. Encountered: "\r" (13), after : "\"\u5bb8\u832c\u7ca1\u5a75\ufffd\u693f\u6769\ufffd;"
at net.sourceforge.cobertura.reporting.html.HTMLReport.generateTableRowForTotal(HTMLReport.java:704)
.....................................................................................................
2012 04 23 15:55:39,821 WARN 24 ComplexityCalculator:107(main) - JavaNCSS got an error while parsing the java file D:\testworkspace\HT20120420\src\com\cnbab\proj118\regnlogin\action\LoginEntry.java
TokenMgrError in STDIN
Lexical error at line 24, column 70. Encountered: "\r" (13), after : "\"\u9427\u8bf2\u7d8d\u935a\u5d84\u7b09\u9473\u6212\u8d1f\u7ecc\ufffd);"
net.sourceforge.cobertura.javancss.parser.TokenMgrError: Lexical error at line 86, column 69. Encountered: "\r" (13), after : "\"\u6d93\ue043\u7d8b\u5bb8\u30e5\u6662\u93b4\ufffd))"
at net.sourceforge.cobertura.javancss.parser.JavaParserTokenManager.getNextToken(JavaParserTokenManager.java:2078)
at net.sourceforge.cobertura.javancss.parser.JavaParser.jj_scan_token(JavaParser.java:10181)
at net.sourceforge.cobertura.javancss.parser.JavaParser.jj_3R_198(JavaParser.java:8524)
...................
..............非常严重,怎么解决?

lychbeyond 发表于 2012-4-27 17:35:49

if(strRet.equals("01"))
                        return SUCCESS;
                else{
                        if(strRet.equals("02"))
                                this.strError = "已被激活";
                        if(strRet.equals("03"))
                                this.strError = "未被激活";
                        if(strRet.equals("04"))
                                this.strError = "没有这个用户";
                        return ERROR;   


出现上述原因是程序中有好多中文提示信息(UTF-8)编码(如上面代码),cobertura instrument编译时不通过,网上资料说在cobertura-instrument.bat文件中添加-Dfile.encoding=utf-8或java环境变量中增加-Dfile.encoding=utf-8可以解决,可我在ant中我加了很多encoding="utf-8" 都没解决。请各位指点迷津!

rlhbe 发表于 2013-6-24 16:10:03

嘿嘿,回个贴表明我来过。











http://www.discuz.net/static/image/common/sigline.gif
实习就业网微信公众号:shsxjy

坤业百货6m 发表于 2013-9-4 12:26:30

好东西哦,大家不要光看不顶











http://www.discuz.net/static/image/common/sigline.gif
公司名称:郑州坤业百货有限公司
公司规模:20人以下
公司行业:耐用消费品(服装服饰/纺织/皮革/家具/家电)
公司类型:民营

郑州坤业百货五楼餐饮区已试营业,欢迎大家前往;
页: [1]
查看完整版本: ant 执行cobertura report appear a lot of error : JavaNCSS got an error