stevedlawrence commented on code in PR #1681:
URL: https://github.com/apache/daffodil/pull/1681#discussion_r3395909545
##########
daffodil-core/src/main/scala/org/apache/daffodil/runtime1/processors/VariableMap1.scala:
##########
@@ -367,15 +365,11 @@ class VariableMap private (
vrd.direction match {
case VariableDirection.ParseOnly if (!state.isInstanceOf[PState]) =>
state.SDE(
- "Attempting to read variable %s which is marked as parseOnly during
unparsing".format(
- varQName
- )
+ s"Attempting to read variable $varQName which is marked as parseOnly
during unparsing"
Review Comment:
This is kindof an example of my previous comment. This could instead be:
```scala
state.SDE(
"Attempting to read variable %s which is marked as parseOnly during
unparsing",
varQName
)
```
So instead of formatting the string, we passing in a format string and args
to the SDE function and let the SDE build the message when needed.
Note that in this particular case it probably doesn't really matter because
SDE's are fatal and are always going to be displayed. But in non fatal cases
(e.g. exceptions that could cause parse errors or unparse suspensions), these
.format() calls are potentially wasted effort.
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]