651 * This method will make a copy of the {@code protocols} array.
652 *
653 * @param protocols an ordered array of application protocols,
654 * with {@code protocols[0]} being the most preferred.
655 * If the array is empty (zero-length), protocol
656 * indications will not be used.
657 * @throws IllegalArgumentException if protocols is null, or if
658 * any element in a non-empty array is null or an
659 * empty (zero-length) string
660 * @see #getApplicationProtocols
661 * @since 9
662 */
663 public void setApplicationProtocols(String[] protocols) {
664 if (protocols == null) {
665 throw new IllegalArgumentException("protocols was null");
666 }
667
668 String[] tempProtocols = protocols.clone();
669
670 for (String p : tempProtocols) {
671 if (p == null || p.equals("")) {
672 throw new IllegalArgumentException(
673 "An element of protocols was null/empty");
674 }
675 }
676 applicationProtocols = tempProtocols;
677 }
678 }
|
651 * This method will make a copy of the {@code protocols} array.
652 *
653 * @param protocols an ordered array of application protocols,
654 * with {@code protocols[0]} being the most preferred.
655 * If the array is empty (zero-length), protocol
656 * indications will not be used.
657 * @throws IllegalArgumentException if protocols is null, or if
658 * any element in a non-empty array is null or an
659 * empty (zero-length) string
660 * @see #getApplicationProtocols
661 * @since 9
662 */
663 public void setApplicationProtocols(String[] protocols) {
664 if (protocols == null) {
665 throw new IllegalArgumentException("protocols was null");
666 }
667
668 String[] tempProtocols = protocols.clone();
669
670 for (String p : tempProtocols) {
671 if (p == null || p.isEmpty()) {
672 throw new IllegalArgumentException(
673 "An element of protocols was null/empty");
674 }
675 }
676 applicationProtocols = tempProtocols;
677 }
678 }
|