BewareMyPower commented on code in PR #20824:
URL: https://github.com/apache/pulsar/pull/20824#discussion_r1284979609


##########
pulsar-client/src/main/java/org/apache/pulsar/client/impl/auth/oauth2/ClientCredentialsFlow.java:
##########
@@ -137,19 +138,18 @@ public static ClientCredentialsFlow 
fromParameters(Map<String, String> params) {
      * @return
      * @throws IOException
      */
-    private static KeyFile loadPrivateKey(String privateKeyURL) throws 
IOException {
+    @VisibleForTesting
+    static KeyFile loadPrivateKey(String privateKeyURL) throws IOException {
         try {
             URLConnection urlConnection = new 
org.apache.pulsar.client.api.url.URL(privateKeyURL).openConnection();
             try {
                 String protocol = urlConnection.getURL().getProtocol();
-                String contentType = urlConnection.getContentType();
-                if ("data".equals(protocol) && 
!"application/json".equals(contentType)) {
+                if ("data".equals(protocol) && 
!"application/json".equals(urlConnection.getContentType())) {

Review Comment:
   The change here does not make any difference to the correctness. but only 
avoid calling `getContentType()` when the protocol is "data".



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