stevedlawrence opened a new pull request, #1282:
URL: https://github.com/apache/daffodil/pull/1282

   Currently, reloading a saved parser when a neccessary character set plugin 
is not on the classpath results in an exception with a very helpful message 
that has nothing to do with character sets or plugins, for example:
   
       java.lang.ClassCastException: cannot assign instance of
       scala.collection.immutable.List$SerializationProxy to field
       
org.apache.daffodil.runtime1.processors.ModelGroupRuntimeData.groupMembers
       of type scala.collection.Seq in instance of
       org.apache.daffodil.runtime1.processors.SequenceRuntimeData
   
   This is a known issue with scala and its use of proxy when serializing data 
structures like Lists and Maps.
   
   To fix the exception and improve diagnostics, this uses writeReplace to 
serialize a BitsCharset as a BitsCharsetSerializationProxy with information 
about the needed BitsCharset. This proxy implements readResolve to look up the 
BitsCharset from the bits charset registry and restore the original 
BitsChraset. If not found in the registry, then we throw an helpful exception 
that bubbles up to the reload function and we can output a helpful diagnostic. 
Now we get something like:
   
       [error] The saved parser was created with a different set of
       dependencies containing a class no longer on the classpath: Charset
       plugin com.example.MyCustomCharset for X-DFDL-MY-CUSTOM-CHARSET
   
   Add an integraion test to make sure this errors with a reasonable 
diagnostic, which require splitting a schema file into valid and invalid parts 
so we can reuse it with the CLI.
   
   DAFFODIL-2915


-- 
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]

Reply via email to