< prev index next >

src/java.base/share/classes/sun/security/ssl/SSLContextImpl.java

Print this page
rev 14210 : 8154231: Simplify access to System properties from JDK code
Reviewed-by: rriggs


 639     }
 640 
 641     /*
 642      * The interface for the customized SSL/(D)TLS SSLContext.
 643      *
 644      * @see SSLContext
 645      */
 646     private static class CustomizedSSLProtocols {
 647         private static final String PROPERTY_NAME = "jdk.tls.client.protocols";
 648         static IllegalArgumentException reservedException = null;
 649         static ArrayList<ProtocolVersion>
 650                                 customizedProtocols = new ArrayList<>();
 651 
 652         // Don't want a java.lang.LinkageError for illegal system property.
 653         //
 654         // Please don't throw exception in this static block.  Otherwise,
 655         // java.lang.LinkageError may be thrown during the instantiation of
 656         // the provider service. Instead, please handle the initialization
 657         // exception in the caller's constructor.
 658         static {
 659             String property = AccessController.doPrivileged(
 660                     new GetPropertyAction(PROPERTY_NAME));
 661             if (property != null && property.length() != 0) {
 662                 // remove double quote marks from beginning/end of the property
 663                 if (property.length() > 1 && property.charAt(0) == '"' &&
 664                         property.charAt(property.length() - 1) == '"') {
 665                     property = property.substring(1, property.length() - 1);
 666                 }
 667             }
 668 
 669             if (property != null && property.length() != 0) {
 670                 String[] protocols = property.split(",");
 671                 for (int i = 0; i < protocols.length; i++) {
 672                     protocols[i] = protocols[i].trim();
 673                     // Is it a supported protocol name?
 674                     try {
 675                         ProtocolVersion pro =
 676                                 ProtocolVersion.valueOf(protocols[i]);
 677 
 678                         if (SunJSSE.isFIPS() &&
 679                                 ((pro.v == ProtocolVersion.SSL30.v) ||
 680                                  (pro.v == ProtocolVersion.SSL20Hello.v))) {




 639     }
 640 
 641     /*
 642      * The interface for the customized SSL/(D)TLS SSLContext.
 643      *
 644      * @see SSLContext
 645      */
 646     private static class CustomizedSSLProtocols {
 647         private static final String PROPERTY_NAME = "jdk.tls.client.protocols";
 648         static IllegalArgumentException reservedException = null;
 649         static ArrayList<ProtocolVersion>
 650                                 customizedProtocols = new ArrayList<>();
 651 
 652         // Don't want a java.lang.LinkageError for illegal system property.
 653         //
 654         // Please don't throw exception in this static block.  Otherwise,
 655         // java.lang.LinkageError may be thrown during the instantiation of
 656         // the provider service. Instead, please handle the initialization
 657         // exception in the caller's constructor.
 658         static {
 659             String property = GetPropertyAction.getProperty(PROPERTY_NAME);

 660             if (property != null && property.length() != 0) {
 661                 // remove double quote marks from beginning/end of the property
 662                 if (property.length() > 1 && property.charAt(0) == '"' &&
 663                         property.charAt(property.length() - 1) == '"') {
 664                     property = property.substring(1, property.length() - 1);
 665                 }
 666             }
 667 
 668             if (property != null && property.length() != 0) {
 669                 String[] protocols = property.split(",");
 670                 for (int i = 0; i < protocols.length; i++) {
 671                     protocols[i] = protocols[i].trim();
 672                     // Is it a supported protocol name?
 673                     try {
 674                         ProtocolVersion pro =
 675                                 ProtocolVersion.valueOf(protocols[i]);
 676 
 677                         if (SunJSSE.isFIPS() &&
 678                                 ((pro.v == ProtocolVersion.SSL30.v) ||
 679                                  (pro.v == ProtocolVersion.SSL20Hello.v))) {


< prev index next >