j3graham commented on code in PR #369:
URL: 
https://github.com/apache/httpcomponents-client/pull/369#discussion_r880005209


##########
httpclient5-testing/src/main/java/org/apache/hc/client5/testing/auth/BasicAuthTokenExtractor.java:
##########
@@ -49,9 +47,9 @@ public String extract(final String challengeResponse) throws 
HttpException {
                 final String s = challengeResponse.substring(i + 1).trim();
                 try {
                     final byte[] credsRaw = 
s.getBytes(StandardCharsets.US_ASCII);
-                    final BinaryDecoder codec = new Base64();
+                    final Base64 codec = new Base64();
                     return new String(codec.decode(credsRaw), 
StandardCharsets.US_ASCII);
-                } catch (final DecoderException ex) {

Review Comment:
   The DecoderException was caught because BinaryDecoder declared it, however 
the commons-codec Base64 implementation never actually threw it. Leaving 
handling here as a hint on how bad encoding could be handlerd



##########
httpclient5-testing/src/main/java/org/apache/hc/client5/testing/auth/BasicAuthTokenExtractor.java:
##########
@@ -49,9 +47,9 @@ public String extract(final String challengeResponse) throws 
HttpException {
                 final String s = challengeResponse.substring(i + 1).trim();
                 try {
                     final byte[] credsRaw = 
s.getBytes(StandardCharsets.US_ASCII);
-                    final BinaryDecoder codec = new Base64();
+                    final Base64 codec = new Base64();
                     return new String(codec.decode(credsRaw), 
StandardCharsets.US_ASCII);
-                } catch (final DecoderException ex) {

Review Comment:
   The DecoderException was caught because BinaryDecoder declared it, however 
the commons-codec Base64 implementation never actually threw it. Leaving 
handling here as a hint on how bad encoding could be handled.



-- 
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: dev-unsubscr...@hc.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@hc.apache.org
For additional commands, e-mail: dev-h...@hc.apache.org

Reply via email to