[
https://issues.apache.org/jira/browse/DAFFODIL-2894?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17840424#comment-17840424
]
Steve Lawrence commented on DAFFODIL-2894:
------------------------------------------
Included in this should be improved error messages. For example, if you create
a custom charset that does not have the correct number of characters in the
decodeString, the base class throws an assertion exception, something like:
{code:java}
org.apache.daffodil.lib.exceptions.UsageException: Usage error:
BitsCharsetNonByteSize.this.decodeString.length().==(1.<<(BitsCharsetNonByteSize.this.bitWidthOfACodeUnit))
at org.apache.daffodil.lib.exceptions.Assert$.usageError(Assert.scala:139)
at
org.apache.daffodil.io.processors.charset.BitsCharsetNonByteSize.$init$(BitsCharsetNonByteSize.scala:67)
{code}
However, when this is thrown it is caught by the service loader, which hides
this exception and just creates a warning log that says
{code:java}
[warn] Named service BitsCharsetDefinition failed to load. Cause:
org.apache.daffodil.io.processors.charset.BitsCharsetDefinition: Provider
com.example.CustomCharset could not be instantiated{code}
This is not helpful at all. For example, this really needs to include the
exception that prevented the charset from being instantiated, and the assertion
probably needs to be more human readable.
> Stabalize and document pluggable charset API
> --------------------------------------------
>
> Key: DAFFODIL-2894
> URL: https://issues.apache.org/jira/browse/DAFFODIL-2894
> Project: Daffodil
> Issue Type: Bug
> Components: API
> Reporter: Steve Lawrence
> Priority: Major
> Fix For: 4.0.0
>
>
> Daffodil supports the ability to have pluggable character sets. This is
> supported, but the API is not really documented and is not part of the
> "public" api. There aren't many known external charsets, but it's possible
> that might change. Like we did with Layers, we may want to take another look
> at our character set API and see if it is sufficient move it from an
> experimental API to a more public stable API.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)