[ 
https://issues.apache.org/jira/browse/DAFFODIL-2984?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17984946#comment-17984946
 ] 

Steve Lawrence commented on DAFFODIL-2984:
------------------------------------------

Yes, getMessageOnly is available and works as expected in my testing with 
3.11.0 (I've just updated the "Fix Version" to reflect this).

As an example, I have Java API test code that prints out a diagnostics related 
to a parser error.

The getMessage function outputs this:
{code}
Parse Error: Unable to parse xs:int from text: Not an int
Schema context: element reference tns:e2 Location line 37 column 10 in 
.../daffodil-japi/target/scala-2.13/test-classes/test/japi/mySchema1.dfdl.xsd
Data location was preceding byte 10
{code}

The getMessageOnly function outputs this:
{code}
Unable to parse xs:int from text: Not an int
{code}

Which is what I expect.

But this is just one particular diagnostic. I'm wondering if we have specific 
diagnostics that incorrectly modify the message to include the context, which 
could cause the error you describe.

Could you provide the diagnostic that is including the context in 
getMessageOnly output?

> Diagnostic API does not allow for getting just the message
> ----------------------------------------------------------
>
>                 Key: DAFFODIL-2984
>                 URL: https://issues.apache.org/jira/browse/DAFFODIL-2984
>             Project: Daffodil
>          Issue Type: Improvement
>          Components: API
>            Reporter: Steve Lawrence
>            Priority: Major
>             Fix For: 3.11.0
>
>
> The current Diagnostic API has a public getMessage() function, but that 
> returns the modeName + message + schema context. We should change the API so 
> that toString() returns all that but getMessage() should return just the 
> message. This would provideĀ  API users easy access to just the portions of a 
> diagnostic they care about. We shoudl also consider if modeName (e.g. 
> "Validation Error") needs a method to a access it, or if there is sufficient 
> information in the Diagnostics for a API user to determine the mode and 
> display their own string.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to