< prev index next >

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

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


 148     /**
 149      * Checks that Object[] arg is neither null nor empty (ie length==0)
 150      * and that it does not contain any null element.
 151      */
 152     private static void checkForNullElement(Object[] arg, String argName) {
 153         if ( (arg == null) || (arg.length == 0) ) {
 154             throw new IllegalArgumentException("Argument "+ argName +"[] cannot be null or empty.");
 155         }
 156         for (int i=0; i<arg.length; i++) {
 157             if (arg[i] == null) {
 158                 throw new IllegalArgumentException("Argument's element "+ argName +"["+ i +"] cannot be null.");
 159             }
 160         }
 161     }
 162 
 163     /**
 164      * Checks that String[] does not contain any empty (or blank characters only) string.
 165      */
 166     private static void checkForEmptyString(String[] arg, String argName) {
 167         for (int i=0; i<arg.length; i++) {
 168             if (arg[i].trim().equals("")) {
 169                 throw new IllegalArgumentException("Argument's element "+ argName +"["+ i +"] cannot be an empty string.");
 170             }
 171         }
 172     }
 173 
 174 
 175     /* *** Tabular type specific information methods *** */
 176 
 177     /**
 178      * Returns the type of the row elements of tabular data values
 179      * described by this <code>TabularType</code> instance.
 180      *
 181      * @return the type of each row.
 182      */
 183     public CompositeType getRowType() {
 184 
 185         return rowType;
 186     }
 187 
 188     /**




 148     /**
 149      * Checks that Object[] arg is neither null nor empty (ie length==0)
 150      * and that it does not contain any null element.
 151      */
 152     private static void checkForNullElement(Object[] arg, String argName) {
 153         if ( (arg == null) || (arg.length == 0) ) {
 154             throw new IllegalArgumentException("Argument "+ argName +"[] cannot be null or empty.");
 155         }
 156         for (int i=0; i<arg.length; i++) {
 157             if (arg[i] == null) {
 158                 throw new IllegalArgumentException("Argument's element "+ argName +"["+ i +"] cannot be null.");
 159             }
 160         }
 161     }
 162 
 163     /**
 164      * Checks that String[] does not contain any empty (or blank characters only) string.
 165      */
 166     private static void checkForEmptyString(String[] arg, String argName) {
 167         for (int i=0; i<arg.length; i++) {
 168             if (arg[i].trim().isEmpty()) {
 169                 throw new IllegalArgumentException("Argument's element "+ argName +"["+ i +"] cannot be an empty string.");
 170             }
 171         }
 172     }
 173 
 174 
 175     /* *** Tabular type specific information methods *** */
 176 
 177     /**
 178      * Returns the type of the row elements of tabular data values
 179      * described by this <code>TabularType</code> instance.
 180      *
 181      * @return the type of each row.
 182      */
 183     public CompositeType getRowType() {
 184 
 185         return rowType;
 186     }
 187 
 188     /**


< prev index next >