0
我想使用Apache commons CSV解析器解析CSV文件,但groovy在传递分隔符';'时抛出异常。作为字符,因为groovy传递一个java.lang.Character,并且该方法需要一个原始字符。 我在我的单元测试中使用groovy,java 7.没有方法的签名:CSVFormat.withDelimiter()适用于参数类型:[;]?
任何机构都知道如何解决这个问题?
//Create the CSVFormat object
CSVFormat format = CSVFormat.RFC4180.withHeader().withDelimiter(';');
//initialize the CSVParser object
CSVParser parser = new CSVParser(new FileReader(filePath), format);
groovy.lang.MissingMethodException: No signature of method: org.apache.commons.csv.CSVFormat.withDelimiter() is applicable for argument types: (java.lang.String) values: [,]
Possible solutions: withDelimiter(char), getDelimiter()
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:55)
at org.codehaus.groovy.runtime.callsite.PojoMetaClassSite.call(PojoMetaClassSite.java:46)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)
at test.ca.azb.j2ee.obb3.TestPersistence.testLoadHyrCsvToHyrTable(TestPersistence.groovy:226)