< prev index next >

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

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


 146                                          String description,
 147                                          OpenMBeanParameterInfo[] signature,
 148                                          OpenType<?> returnOpenType,
 149                                          int impact,
 150                                          Descriptor descriptor) {
 151         super(name,
 152               description,
 153               arrayCopyCast(signature),
 154               // must prevent NPE here - we will throw IAE later on if
 155               // returnOpenType is null
 156               (returnOpenType == null) ? null : returnOpenType.getClassName(),
 157               impact,
 158               ImmutableDescriptor.union(descriptor,
 159                 // must prevent NPE here - we will throw IAE later on if
 160                 // returnOpenType is null
 161                 (returnOpenType==null) ? null :returnOpenType.getDescriptor()));
 162 
 163         // check parameters that should not be null or empty
 164         // (unfortunately it is not done in superclass :-( ! )
 165         //
 166         if (name == null || name.trim().equals("")) {
 167             throw new IllegalArgumentException("Argument name cannot " +
 168                                                "be null or empty");
 169         }
 170         if (description == null || description.trim().equals("")) {
 171             throw new IllegalArgumentException("Argument description cannot " +
 172                                                "be null or empty");
 173         }
 174         if (returnOpenType == null) {
 175             throw new IllegalArgumentException("Argument returnOpenType " +
 176                                                "cannot be null");
 177         }
 178 
 179         if (impact != ACTION && impact != ACTION_INFO && impact != INFO &&
 180                 impact != UNKNOWN) {
 181             throw new IllegalArgumentException("Argument impact can only be " +
 182                                                "one of ACTION, ACTION_INFO, " +
 183                                                "INFO, or UNKNOWN: " + impact);
 184         }
 185 
 186         this.returnOpenType = returnOpenType;
 187     }
 188 
 189 
 190     // Converts an array of OpenMBeanParameterInfo objects extending




 146                                          String description,
 147                                          OpenMBeanParameterInfo[] signature,
 148                                          OpenType<?> returnOpenType,
 149                                          int impact,
 150                                          Descriptor descriptor) {
 151         super(name,
 152               description,
 153               arrayCopyCast(signature),
 154               // must prevent NPE here - we will throw IAE later on if
 155               // returnOpenType is null
 156               (returnOpenType == null) ? null : returnOpenType.getClassName(),
 157               impact,
 158               ImmutableDescriptor.union(descriptor,
 159                 // must prevent NPE here - we will throw IAE later on if
 160                 // returnOpenType is null
 161                 (returnOpenType==null) ? null :returnOpenType.getDescriptor()));
 162 
 163         // check parameters that should not be null or empty
 164         // (unfortunately it is not done in superclass :-( ! )
 165         //
 166         if (name == null || name.trim().isEmpty()) {
 167             throw new IllegalArgumentException("Argument name cannot " +
 168                                                "be null or empty");
 169         }
 170         if (description == null || description.trim().isEmpty()) {
 171             throw new IllegalArgumentException("Argument description cannot " +
 172                                                "be null or empty");
 173         }
 174         if (returnOpenType == null) {
 175             throw new IllegalArgumentException("Argument returnOpenType " +
 176                                                "cannot be null");
 177         }
 178 
 179         if (impact != ACTION && impact != ACTION_INFO && impact != INFO &&
 180                 impact != UNKNOWN) {
 181             throw new IllegalArgumentException("Argument impact can only be " +
 182                                                "one of ACTION, ACTION_INFO, " +
 183                                                "INFO, or UNKNOWN: " + impact);
 184         }
 185 
 186         this.returnOpenType = returnOpenType;
 187     }
 188 
 189 
 190     // Converts an array of OpenMBeanParameterInfo objects extending


< prev index next >