< prev index next >

src/java.management/share/classes/javax/management/openmbean/CompositeType.java

Print this page
rev 52881 : 8214971: Replace use of string.equals("") with isEmpty()
Reviewed-by: jlaskey, prappo, lancea, dfuchs, redestad


 154                                             "\" duplicates a previous item names.");
 155             }
 156             nameToDescription.put(key, itemDescriptions[i].trim());
 157             nameToType.put(key, itemTypes[i]);
 158         }
 159     }
 160 
 161     private static void checkForNullElement(Object[] arg, String argName) {
 162         if ( (arg == null) || (arg.length == 0) ) {
 163             throw new IllegalArgumentException("Argument "+ argName +"[] cannot be null or empty.");
 164         }
 165         for (int i=0; i<arg.length; i++) {
 166             if (arg[i] == null) {
 167                 throw new IllegalArgumentException("Argument's element "+ argName +"["+ i +"] cannot be null.");
 168             }
 169         }
 170     }
 171 
 172     private static void checkForEmptyString(String[] arg, String argName) {
 173         for (int i=0; i<arg.length; i++) {
 174             if (arg[i].trim().equals("")) {
 175                 throw new IllegalArgumentException("Argument's element "+ argName +"["+ i +"] cannot be an empty string.");
 176             }
 177         }
 178     }
 179 
 180     /* *** Composite type specific information methods *** */
 181 
 182     /**
 183      * Returns <code>true</code> if this <code>CompositeType</code> instance defines an item
 184      * whose name is <var>itemName</var>.
 185      *
 186      * @param itemName the name of the item.
 187      *
 188      * @return true if an item of this name is present.
 189      */
 190     public boolean containsKey(String itemName) {
 191 
 192         if (itemName == null) {
 193             return false;
 194         }




 154                                             "\" duplicates a previous item names.");
 155             }
 156             nameToDescription.put(key, itemDescriptions[i].trim());
 157             nameToType.put(key, itemTypes[i]);
 158         }
 159     }
 160 
 161     private static void checkForNullElement(Object[] arg, String argName) {
 162         if ( (arg == null) || (arg.length == 0) ) {
 163             throw new IllegalArgumentException("Argument "+ argName +"[] cannot be null or empty.");
 164         }
 165         for (int i=0; i<arg.length; i++) {
 166             if (arg[i] == null) {
 167                 throw new IllegalArgumentException("Argument's element "+ argName +"["+ i +"] cannot be null.");
 168             }
 169         }
 170     }
 171 
 172     private static void checkForEmptyString(String[] arg, String argName) {
 173         for (int i=0; i<arg.length; i++) {
 174             if (arg[i].trim().isEmpty()) {
 175                 throw new IllegalArgumentException("Argument's element "+ argName +"["+ i +"] cannot be an empty string.");
 176             }
 177         }
 178     }
 179 
 180     /* *** Composite type specific information methods *** */
 181 
 182     /**
 183      * Returns <code>true</code> if this <code>CompositeType</code> instance defines an item
 184      * whose name is <var>itemName</var>.
 185      *
 186      * @param itemName the name of the item.
 187      *
 188      * @return true if an item of this name is present.
 189      */
 190     public boolean containsKey(String itemName) {
 191 
 192         if (itemName == null) {
 193             return false;
 194         }


< prev index next >