commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From scolebou...@apache.org
Subject cvs commit: jakarta-commons/lang/src/java/org/apache/commons/lang/enum Enum.java
Date Sat, 02 Nov 2002 13:16:31 GMT
scolebourne    2002/11/02 05:16:31

  Modified:    lang/src/java/org/apache/commons/lang/enum Enum.java
  Log:
  Ensure that duplicate enums cannot be created
  Bug found by Howard Lewis Ship
  
  Revision  Changes    Path
  1.4       +4 -1      jakarta-commons/lang/src/java/org/apache/commons/lang/enum/Enum.java
  
  Index: Enum.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/lang/src/java/org/apache/commons/lang/enum/Enum.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- Enum.java	30 Oct 2002 21:58:18 -0000	1.3
  +++ Enum.java	2 Nov 2002 13:16:30 -0000	1.4
  @@ -164,6 +164,9 @@
               entry = new Entry();
               cEnumClasses.put(getClass().getName(), entry);
           }
  +        if (entry.map.containsKey(name)) {
  +            throw new IllegalArgumentException("The Enum name must be unique, '" + name
+ "' has already been added");
  +        }
           entry.map.put(name, this);
           entry.list.add(this);
       }
  
  
  

--
To unsubscribe, e-mail:   <mailto:commons-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>


Mime
View raw message