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)