bsloane1650 commented on a change in pull request #257: Daffodil 2165 type calc 
double functions
URL: https://github.com/apache/incubator-daffodil/pull/257#discussion_r299610690
 
 

 ##########
 File path: 
daffodil-runtime1/src/main/scala/org/apache/daffodil/dpath/DPathRuntime.scala
 ##########
 @@ -95,7 +99,7 @@ class CompiledDPath(val ops: RecipeOp*) extends Serializable 
{
         // in a way that is not consistent with a constant expression. Such as 
trying to do
         // anything with the infoset other than saving and restoring current 
position in the infoset.
         // Ditto trying to read a variable.
-        case _: InfosetException | _: VariableException | _: 
java.lang.IllegalStateException =>
+        case _: InfosetException | _: VariableException | _: 
NoSuchElementException | _: java.lang.IllegalStateException =>
 
 Review comment:
   dfdlx:repTypeValue() and dfdlx:logicalTypeValue() attempt to read the 
current rep/logical value from a Maybe variable. At compile time, these are 
always Nope, and so throw a NoSuchElementException.
   
   There is a good arguement to be made that we shouldn't catch 
NoSuchElementHere, as this will also catch bugs that shouldn't be caught. We 
should be able to avoid this by adding an if(isCompile) throw new 
IllegalStateException().
   
   Having said that, we are currently using IllegalStateException as a sentinal 
exception, and that is not Daffodil specific. Those may all be used 
specifically as a sentinal when they are thrown, in which case it should be 
straightforward to replace them as well. Of course, it is much less likely for 
a random bug to throw IllegalStateException, so this is less imporant.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to