biweekly icon indicating copy to clipboard operation
biweekly copied to clipboard

Feature Request: Option for strict parsing

Open linusclindgren opened this issue 2 years ago • 1 comments

I'd like the option to parse iCals strictly. If this is not the consensus of developers in the project, perhaps the warnings in the ChainingParser could be made public. This way at least it will be possible to see any warnings and throw an exception with the warnings.

abstract class ChainingParser<T extends ChainingParser<?>> {

...

public List<List<ParseWarning>> warnings;

linusclindgren avatar Feb 15 '23 09:02 linusclindgren

If you pass an empty list into the "warnings" method of the chaining parser, it will add the parse warnings to the list.

List<List<ParseWarning>> warnings = new ArrayList<List<ParseWarning>>();

ICalendar ical = Biweekly.parse(new File("...")).warnings(warnings).first();

List<ParseWarning> warningsFromFirstICalThatWasParsed = warnings.get(0);
for (ParseWarning warning : warningsFromFirstICalThatWasParsed){
  //...
}

mangstadt avatar Feb 17 '23 01:02 mangstadt