luehe       2003/08/25 10:37:26

  Modified:    util/java/org/apache/tomcat/util/net/jsse
                        JSSE14SocketFactory.java
  Log:
  Also consider last element in comma-separated protocols list, or the case where
  the list contains a single element and no commas :)
  
  Revision  Changes    Path
  1.12      +44 -19    
jakarta-tomcat-connectors/util/java/org/apache/tomcat/util/net/jsse/JSSE14SocketFactory.java
  
  Index: JSSE14SocketFactory.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/util/java/org/apache/tomcat/util/net/jsse/JSSE14SocketFactory.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- JSSE14SocketFactory.java  13 Aug 2003 05:32:53 -0000      1.11
  +++ JSSE14SocketFactory.java  25 Aug 2003 17:37:26 -0000      1.12
  @@ -205,28 +205,53 @@
   
           if (requestedProtocols != null) {
               Vector vec = null;
  -            int fromIndex = 0;
  -            int index = requestedProtocols.indexOf(',', fromIndex);
  -            while (index != -1) {
  -                String protocol
  -                    = requestedProtocols.substring(fromIndex, index).trim();
  -                /*
  -                 * Check to see if the requested protocol is among the
  -                 * supported protocols, i.e., may be enabled
  -                 */
  -                for (int i=0; supportedProtocols != null
  -                             && i<supportedProtocols.length; i++) {
  -                    if (supportedProtocols[i].equals(protocol)) {
  -                        if (vec == null) {
  -                            vec = new Vector();
  +            String protocol = requestedProtocols;
  +            int index = requestedProtocols.indexOf(',');
  +            if (index != -1) {
  +                int fromIndex = 0;
  +                while (index != -1) {
  +                    protocol = requestedProtocols.substring(fromIndex, 
index).trim();
  +                    if (protocol.length() > 0) {
  +                        /*
  +                         * Check to see if the requested protocol is among the
  +                         * supported protocols, i.e., may be enabled
  +                         */
  +                        for (int i=0; supportedProtocols != null
  +                                     && i<supportedProtocols.length; i++) {
  +                            if (supportedProtocols[i].equals(protocol)) {
  +                                if (vec == null) {
  +                                    vec = new Vector();
  +                                }
  +                                vec.addElement(protocol);
  +                                break;
  +                            }
                           }
  -                        vec.addElement(protocol);
  -                        break;
                       }
  -                }
  -                fromIndex = index+1;
  -                index = requestedProtocols.indexOf(',', fromIndex);
  +                    fromIndex = index+1;
  +                    index = requestedProtocols.indexOf(',', fromIndex);
  +                } // while
  +                protocol = requestedProtocols.substring(fromIndex);
               }
  +
  +            if (protocol != null) {
  +                protocol = protocol.trim();
  +                if (protocol.length() > 0) {
  +                    /*
  +                     * Check to see if the requested protocol is among the
  +                     * supported protocols, i.e., may be enabled
  +                     */
  +                    for (int i=0; supportedProtocols != null
  +                                 && i<supportedProtocols.length; i++) {
  +                        if (supportedProtocols[i].equals(protocol)) {
  +                            if (vec == null) {
  +                                vec = new Vector();
  +                            }
  +                            vec.addElement(protocol);
  +                            break;
  +                        }
  +                    }
  +                }
  +            }           
   
               if (vec != null) {
                   enabledProtocols = new String[vec.size()];
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to