You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2017/10/13 14:42:19 UTC

svn commit: r1812136 - in /tomcat/trunk/java/org/apache/tomcat/websocket: DigestAuthenticator.java WsWebSocketContainer.java

Author: markt
Date: Fri Oct 13 14:42:19 2017
New Revision: 1812136

URL: http://svn.apache.org/viewvc?rev=1812136&view=rev
Log:
Fix IDE nags

Modified:
    tomcat/trunk/java/org/apache/tomcat/websocket/DigestAuthenticator.java
    tomcat/trunk/java/org/apache/tomcat/websocket/WsWebSocketContainer.java

Modified: tomcat/trunk/java/org/apache/tomcat/websocket/DigestAuthenticator.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/websocket/DigestAuthenticator.java?rev=1812136&r1=1812135&r2=1812136&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/websocket/DigestAuthenticator.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/websocket/DigestAuthenticator.java Fri Oct 13 14:42:19 2017
@@ -16,7 +16,6 @@
  */
 package org.apache.tomcat.websocket;
 
-import java.io.UnsupportedEncodingException;
 import java.nio.charset.StandardCharsets;
 import java.security.MessageDigest;
 import java.security.NoSuchAlgorithmException;
@@ -78,7 +77,7 @@ public class DigestAuthenticator extends
                     realm, nonce, messageQop, algorithm) + "\",");
         }
 
-        catch (UnsupportedEncodingException | NoSuchAlgorithmException e) {
+        catch (NoSuchAlgorithmException e) {
             throw new AuthenticationException(
                     "Unable to generate request digest " + e.getMessage());
         }
@@ -89,7 +88,7 @@ public class DigestAuthenticator extends
         if (!messageQop.isEmpty()) {
             challenge.append("qop=\"" + messageQop + "\"");
             challenge.append(",cnonce=\"" + cNonce + "\",");
-            challenge.append("nc=" + String.format("%08X", nonceCount));
+            challenge.append("nc=" + String.format("%08X", Integer.valueOf(nonceCount)));
         }
 
         return challenge.toString();
@@ -98,7 +97,7 @@ public class DigestAuthenticator extends
 
     private String calculateRequestDigest(String requestUri, String userName, String password,
             String realm, String nonce, String qop, String algorithm)
-            throws UnsupportedEncodingException, NoSuchAlgorithmException {
+            throws NoSuchAlgorithmException {
 
         StringBuilder preDigest = new StringBuilder();
         String A1;
@@ -122,7 +121,7 @@ public class DigestAuthenticator extends
 
         if (qop.toLowerCase().contains("auth")) {
             preDigest.append(":");
-            preDigest.append(String.format("%08X", nonceCount));
+            preDigest.append(String.format("%08X", Integer.valueOf(nonceCount)));
             preDigest.append(":");
             preDigest.append(String.valueOf(cNonce));
             preDigest.append(":");
@@ -136,8 +135,7 @@ public class DigestAuthenticator extends
 
     }
 
-    private String encodeMD5(String value)
-            throws UnsupportedEncodingException, NoSuchAlgorithmException {
+    private String encodeMD5(String value) throws NoSuchAlgorithmException {
         byte[] bytesOfMessage = value.getBytes(StandardCharsets.ISO_8859_1);
         MessageDigest md = MessageDigest.getInstance("MD5");
         byte[] thedigest = md.digest(bytesOfMessage);

Modified: tomcat/trunk/java/org/apache/tomcat/websocket/WsWebSocketContainer.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/websocket/WsWebSocketContainer.java?rev=1812136&r1=1812135&r2=1812136&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/websocket/WsWebSocketContainer.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/websocket/WsWebSocketContainer.java Fri Oct 13 14:42:19 2017
@@ -564,7 +564,8 @@ public class WsWebSocketContainer implem
 
                     if (userProperties.get(Constants.AUTHORIZATION_HEADER_NAME) != null) {
                         throw new DeploymentException(sm.getString(
-                                "wsWebSocketClient.failedAuthentication", httpResponse.status));
+                                "wsWebSocketClient.failedAuthentication",
+                                Integer.valueOf(httpResponse.status)));
                     }
 
                     List<String> wwwAuthenticateHeaders = httpResponse.getHandshakeResponse()
@@ -586,7 +587,7 @@ public class WsWebSocketContainer implem
                     if (auth == null) {
                         throw new DeploymentException(
                                 sm.getString("wsWebSocketClient.unsupportedAuthScheme",
-                                        httpResponse.status, authScheme));
+                                        Integer.valueOf(httpResponse.status), authScheme));
                     }
 
                     userProperties.put(Constants.AUTHORIZATION_HEADER_NAME, auth.getAuthorization(



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org