< prev index next >

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

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


 251 
 252         // Check that eltClassName's value is one of the allowed basic data types for open data
 253         //
 254         boolean ok = false;
 255         if (isPrimitiveArray) {
 256             ok = ArrayType.isPrimitiveContentType(eltClassName);
 257         } else {
 258             ok = ALLOWED_CLASSNAMES_LIST.contains(eltClassName);
 259         }
 260         if ( ! ok ) {
 261             throw new OpenDataException("Argument className=\""+ className +
 262                                         "\" is not one of the allowed Java class names for open data.");
 263         }
 264 
 265         return className;
 266     }
 267 
 268     /* Return argValue.trim() provided argValue is neither null nor empty;
 269        otherwise throw IllegalArgumentException.  */
 270     private static String valid(String argName, String argValue) {
 271         if (argValue == null || (argValue = argValue.trim()).equals(""))
 272             throw new IllegalArgumentException("Argument " + argName +
 273                                                " cannot be null or empty");
 274         return argValue;
 275     }
 276 
 277     /* Package-private access to a Descriptor containing this OpenType. */
 278     synchronized Descriptor getDescriptor() {
 279         if (descriptor == null) {
 280             descriptor = new ImmutableDescriptor(new String[] {"openType"},
 281                                                  new Object[] {this});
 282         }
 283         return descriptor;
 284     }
 285 
 286     /* *** Open type information methods *** */
 287 
 288     /**
 289      * Returns the fully qualified Java class name of the open data values
 290      * this open type describes.
 291      * The only possible Java class names for open data values are listed in




 251 
 252         // Check that eltClassName's value is one of the allowed basic data types for open data
 253         //
 254         boolean ok = false;
 255         if (isPrimitiveArray) {
 256             ok = ArrayType.isPrimitiveContentType(eltClassName);
 257         } else {
 258             ok = ALLOWED_CLASSNAMES_LIST.contains(eltClassName);
 259         }
 260         if ( ! ok ) {
 261             throw new OpenDataException("Argument className=\""+ className +
 262                                         "\" is not one of the allowed Java class names for open data.");
 263         }
 264 
 265         return className;
 266     }
 267 
 268     /* Return argValue.trim() provided argValue is neither null nor empty;
 269        otherwise throw IllegalArgumentException.  */
 270     private static String valid(String argName, String argValue) {
 271         if (argValue == null || (argValue = argValue.trim()).isEmpty())
 272             throw new IllegalArgumentException("Argument " + argName +
 273                                                " cannot be null or empty");
 274         return argValue;
 275     }
 276 
 277     /* Package-private access to a Descriptor containing this OpenType. */
 278     synchronized Descriptor getDescriptor() {
 279         if (descriptor == null) {
 280             descriptor = new ImmutableDescriptor(new String[] {"openType"},
 281                                                  new Object[] {this});
 282         }
 283         return descriptor;
 284     }
 285 
 286     /* *** Open type information methods *** */
 287 
 288     /**
 289      * Returns the fully qualified Java class name of the open data values
 290      * this open type describes.
 291      * The only possible Java class names for open data values are listed in


< prev index next >