Closed kbraak closed 6 years ago
thanks @kbraak They both will be changed to checked exceptions.
Maybe it's reasonable to make UnknownDelimitersException a subclass of IOException, which will already be handled.
give the client the chance to recover from it?
Nothing stops the client from catch (RuntimeException e)
or a subclass already, it's just optional.
Sounds good
@cgendreau @mdoering
UnknownDelimitersException is an unchecked exception in gbif-common (a duplicate copy UnkownDelimitersException exists in dwca-io and can likely be removed).
This exception gets thrown when a CSV file is inspected for its delimiter, however, the delimiter cannot be determined. This exception can be cause when reading an empty CSV file for example.
extractCsvMetadata()
inside CSVReaderFactory specifies UnknownDelimitersException in its signature. Various otherbuild()
methods inside this class also call extractCsvMetadata(), however, do NOT specify it in their own signature.Since the file has been considered invalid, why not declare it in the signature and give the client the chance to recover from it? This is the way that UnsupportedArchiveException is handled in dwca-io, which is a similar unchecked exception that always appears in the method signature.
Apart from this issue of consistency, I wonder if UnknownDelimitersException and UnsupportedArchiveException wouldn't be better made into checked exceptions?