< prev index next >

src/java.base/share/classes/sun/security/util/AbstractAlgorithmConstraints.java

Print this page
rev 51919 : 8215281: Use String.isEmpty() when applicable in java.base
Reviewed-by: dfuchs, alanb


  58             // remove double quote marks from beginning/end of the property
  59             if (property.length() >= 2 && property.charAt(0) == '"' &&
  60                     property.charAt(property.length() - 1) == '"') {
  61                 property = property.substring(1, property.length() - 1);
  62             }
  63             algorithmsInProperty = property.split(",");
  64             for (int i = 0; i < algorithmsInProperty.length; i++) {
  65                 algorithmsInProperty[i] = algorithmsInProperty[i].trim();
  66             }
  67         }
  68 
  69         // map the disabled algorithms
  70         if (algorithmsInProperty == null) {
  71             algorithmsInProperty = new String[0];
  72         }
  73         return algorithmsInProperty;
  74     }
  75 
  76     static boolean checkAlgorithm(String[] algorithms, String algorithm,
  77             AlgorithmDecomposer decomposer) {
  78         if (algorithm == null || algorithm.length() == 0) {
  79             throw new IllegalArgumentException("No algorithm name specified");
  80         }
  81 
  82         Set<String> elements = null;
  83         for (String item : algorithms) {
  84             if (item == null || item.isEmpty()) {
  85                 continue;
  86             }
  87 
  88             // check the full name
  89             if (item.equalsIgnoreCase(algorithm)) {
  90                 return false;
  91             }
  92 
  93             // decompose the algorithm into sub-elements
  94             if (elements == null) {
  95                 elements = decomposer.decompose(algorithm);
  96             }
  97 
  98             // check the items of the algorithm


  58             // remove double quote marks from beginning/end of the property
  59             if (property.length() >= 2 && property.charAt(0) == '"' &&
  60                     property.charAt(property.length() - 1) == '"') {
  61                 property = property.substring(1, property.length() - 1);
  62             }
  63             algorithmsInProperty = property.split(",");
  64             for (int i = 0; i < algorithmsInProperty.length; i++) {
  65                 algorithmsInProperty[i] = algorithmsInProperty[i].trim();
  66             }
  67         }
  68 
  69         // map the disabled algorithms
  70         if (algorithmsInProperty == null) {
  71             algorithmsInProperty = new String[0];
  72         }
  73         return algorithmsInProperty;
  74     }
  75 
  76     static boolean checkAlgorithm(String[] algorithms, String algorithm,
  77             AlgorithmDecomposer decomposer) {
  78         if (algorithm == null || algorithm.isEmpty()) {
  79             throw new IllegalArgumentException("No algorithm name specified");
  80         }
  81 
  82         Set<String> elements = null;
  83         for (String item : algorithms) {
  84             if (item == null || item.isEmpty()) {
  85                 continue;
  86             }
  87 
  88             // check the full name
  89             if (item.equalsIgnoreCase(algorithm)) {
  90                 return false;
  91             }
  92 
  93             // decompose the algorithm into sub-elements
  94             if (elements == null) {
  95                 elements = decomposer.decompose(algorithm);
  96             }
  97 
  98             // check the items of the algorithm
< prev index next >