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

   Hi @garydgregory,
   
   In my understanding, the constructor of PecentCodec calls the 
`insertAlwaysEncodeChars(byte[])` method in [Line 
83](https://github.com/apache/commons-codec/blob/master/src/main/java/org/apache/commons/codec/net/PercentCodec.java#L83).
 The use of the `insertAlwaysEncodeChars(byte[])` method is to record all bytes 
in the provided byte array to be some character that requires encode all the 
time. Thus if garbage bytes do exist in the byte array, it should be skipped 
and all other "valid" bytes should still be considered. For example, if someone 
thinks that the letter A should always be encoded, and accidentally provides 
`byte[] encode = {(byte)'A', (byte) -1};`, the logic could still work, skipping 
the -1 bytes and change the 'A' byte in the BitSet to true. Also, the byte 
array itself is never stored in the object. Thus the PR could make the running 
smoother without crashing even if some invalid byte does exist. The new logic 
simply skips them and continues. The most important part i
 s that "valid" bytes are still processed and interpreted.
   This is my understanding, am I missing something here??
   


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