Ignore:
Timestamp:
03/04/10 12:11:07 (14 years ago)
Author:
oschonef
Message:
  • improve error handling
  • improve error messages and reporting
File:
1 edited

Legend:

Unmodified
Added
Removed
  • VirtualCollectionRegistry/trunk/VirtualCollectionRegistry/src/main/java/eu/clarin/cmdi/virtualcollectionregistry/model/User.java

    r191 r215  
    5252        public void setName(String name) {
    5353                if (name == null) {
    54                         throw new IllegalArgumentException("name == null");
     54                        throw new NullPointerException("name == null");
     55                }
     56                name = name.trim();
     57                if (name.isEmpty()) {
     58                        throw new IllegalArgumentException("empty name is not allowed");
    5559                }
    5660                this.name = name;
    5761        }
    58        
     62
    5963        public String getName() {
    6064                return name;
     
    6771        public boolean equals(Object o) {
    6872                if (o == null) {
    69                         throw new IllegalArgumentException("o == null");
     73                        throw new NullPointerException("o == null");
    7074                }
    7175                if (o instanceof User) {
     
    7882        public boolean equalsPrincipal(Principal principal) {
    7983                if (principal == null) {
    80                         throw new IllegalArgumentException("principal == null");
     84                        throw new NullPointerException("principal == null");
    8185                }
    8286                return name.equals(principal.getName());
Note: See TracChangeset for help on using the changeset viewer.