arthurscchan commented on PR #222:
URL: https://github.com/apache/commons-codec/pull/222#issuecomment-1827774135

   Hi @garydgregory,
   
   I think it is a different case. The invalid bytes are provided through 
constructor, it is only used for the initial setting of the PercentCodec object 
to set which bytes are to be encoded during the encode or decode method.  Thus 
if we initialise the PercentCodec with a byte array contains invalid bytes, it 
just mean that the encode method will not encode that byte. It does not affect 
the encode and decode process at all. Thus the encode / decode method round 
trip won't be affected and the result is the same as the original input. Maybe 
I could add a round trip call and ensure the result are the same in the test 
case. 
   Alternatively, instead of checking the length and skip the invalid byte 
during constructor phase, I could simply add a try catch block in the code, 
when any IndexOutOfBound (or more general, and kind of RuntimeException) is 
thrown, wrap it with EncoderException. This could at least make the method not 
throwing "unexpected" RuntimeException. It maybe a better approach. WDYT?


-- 
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: issues-unsubscr...@commons.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to