Brandon - the workaround worked well - thanks for the quick response!

Lara

From: Sloane, Brandon <[email protected]>
Sent: Wednesday, February 26, 2020 6:12 PM
To: [email protected]
Subject: Re: catching NotYetImplementedException

Hi Lara,

I have opened a bug report for this issue: 
https://issues.apache.org/jira/browse/DAFFODIL-2287

The issue is occuring at the Java/Scala language boundry. 
NotYetImplementedException extends Exception, but not RuntimeException. As 
such, Java considers it a checked exception, so assumes that it will only be 
thrown by functions which declare that they might throw it. In contrast, Scala 
does not have a concept of checked exceptions. Daffodil should annotate the 
parse function (and all functions in the japi) to inform the java compiler 
about what exceptions can be thrown; however we have apparently neglected to do 
so.


In the meantime, a workaround you could use is to generically catch Exception, 
then use instanceOf to determine if a NotYetImplementedException occurred.


Regards,
Brandon


________________________________
From: Lara Blatchford 
<[email protected]<mailto:[email protected]>>
Sent: Wednesday, February 26, 2020 3:58 PM
To: [email protected]<mailto:[email protected]> 
<[email protected]<mailto:[email protected]>>
Subject: catching NotYetImplementedException


Hi - I've inherited a Java application that uses Daffodil 2.3.0, and have found 
that when a user does something like attempt to parse a UTF-8 CSV file using 
the CSV schema, the application is terminated by 
org.apache.daffodil.exceptions.NotYetImplementedException when calling parse.



I would like to be able to catch this exception and handle it gracefully, but 
if I try to catch it the compiler indicates that the parse method doesn't throw 
the exception.



I'm not familiar with Scala, but a quick search of the source shows that 
NotYetImplementedException extends UnsuppressableException - does this mean 
that somehow the exception may not be caught?



Suggestions appreciated,





Lara Blatchford

Principal Engineer

Nteligen, LLC

[email protected]<mailto:[email protected]>

(443) 864-5042 x110



[cid:[email protected]]


Reply via email to