src/java.management/share/classes/javax/management/MBeanPermission.java
changeset 52902 e3398b2e1ab0
parent 47216 71c04702a3d5
equal deleted inserted replaced
52901:3ba9ff4d4aaf 52902:e3398b2e1ab0
   254         int mask;
   254         int mask;
   255 
   255 
   256         if (actions == null)
   256         if (actions == null)
   257             throw new IllegalArgumentException("MBeanPermission: " +
   257             throw new IllegalArgumentException("MBeanPermission: " +
   258                                                "actions can't be null");
   258                                                "actions can't be null");
   259         if (actions.equals(""))
   259         if (actions.isEmpty())
   260             throw new IllegalArgumentException("MBeanPermission: " +
   260             throw new IllegalArgumentException("MBeanPermission: " +
   261                                                "actions can't be empty");
   261                                                "actions can't be empty");
   262 
   262 
   263         mask = getMask(actions);
   263         mask = getMask(actions);
   264 
   264 
   277 
   277 
   278         if (name == null)
   278         if (name == null)
   279             throw new IllegalArgumentException("MBeanPermission name " +
   279             throw new IllegalArgumentException("MBeanPermission name " +
   280                                                "cannot be null");
   280                                                "cannot be null");
   281 
   281 
   282         if (name.equals(""))
   282         if (name.isEmpty())
   283             throw new IllegalArgumentException("MBeanPermission name " +
   283             throw new IllegalArgumentException("MBeanPermission name " +
   284                                                "cannot be empty");
   284                                                "cannot be empty");
   285 
   285 
   286         /* The name looks like "class#member[objectname]".  We subtract
   286         /* The name looks like "class#member[objectname]".  We subtract
   287            elements from the right as we parse, so after parsing the
   287            elements from the right as we parse, so after parsing the
   308                 try {
   308                 try {
   309                     // If "[]" then ObjectName("*:*")
   309                     // If "[]" then ObjectName("*:*")
   310                     //
   310                     //
   311                     String on = name.substring(openingBracket + 1,
   311                     String on = name.substring(openingBracket + 1,
   312                                                name.length() - 1);
   312                                                name.length() - 1);
   313                     if (on.equals(""))
   313                     if (on.isEmpty())
   314                         objectName = ObjectName.WILDCARD;
   314                         objectName = ObjectName.WILDCARD;
   315                     else if (on.equals("-"))
   315                     else if (on.equals("-"))
   316                         objectName = null;
   316                         objectName = null;
   317                     else
   317                     else
   318                         objectName = new ObjectName(on);
   318                         objectName = new ObjectName(on);
   357 
   357 
   358     private void setClassName(String className) {
   358     private void setClassName(String className) {
   359         if (className == null || className.equals("-")) {
   359         if (className == null || className.equals("-")) {
   360             classNamePrefix = null;
   360             classNamePrefix = null;
   361             classNameExactMatch = false;
   361             classNameExactMatch = false;
   362         } else if (className.equals("") || className.equals("*")) {
   362         } else if (className.isEmpty() || className.equals("*")) {
   363             classNamePrefix = "";
   363             classNamePrefix = "";
   364             classNameExactMatch = false;
   364             classNameExactMatch = false;
   365         } else if (className.endsWith(".*")) {
   365         } else if (className.endsWith(".*")) {
   366             // Note that we include the "." in the required prefix
   366             // Note that we include the "." in the required prefix
   367             classNamePrefix = className.substring(0, className.length() - 1);
   367             classNamePrefix = className.substring(0, className.length() - 1);
   373     }
   373     }
   374 
   374 
   375     private void setMember(String member) {
   375     private void setMember(String member) {
   376         if (member == null || member.equals("-"))
   376         if (member == null || member.equals("-"))
   377             this.member = null;
   377             this.member = null;
   378         else if (member.equals(""))
   378         else if (member.isEmpty())
   379             this.member = "*";
   379             this.member = "*";
   380         else
   380         else
   381             this.member = member;
   381             this.member = member;
   382     }
   382     }
   383 
   383