You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-dev@portals.apache.org by sh...@apache.org on 2001/03/08 17:18:59 UTC

cvs commit: jakarta-jetspeed/src/java/org/apache/jetspeed/util MimeType.java

shesmer     01/03/08 08:18:59

  Modified:    src/java/org/apache/jetspeed/util MimeType.java
  Log:
  more stable version of MimeType
  
  Revision  Changes    Path
  1.5       +10 -6     jakarta-jetspeed/src/java/org/apache/jetspeed/util/MimeType.java
  
  Index: MimeType.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/util/MimeType.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- MimeType.java	2001/03/07 06:49:56	1.4
  +++ MimeType.java	2001/03/08 16:18:55	1.5
  @@ -60,7 +60,7 @@
   utility manipulation methods.
   
   @author <a href="mailto:raphael@apache.org">Rapha�l Luta</a>
  -@version $Id: MimeType.java,v 1.4 2001/03/07 06:49:56 taylor Exp $
  +@version $Id: MimeType.java,v 1.5 2001/03/08 16:18:55 shesmer Exp $
   */
   public class MimeType {
   
  @@ -72,6 +72,9 @@
       private String mimeType = "";
       
       public MimeType( String mimeType ) {
  +        if(mimeType == null) {
  +            throw new NullPointerException();
  +        }
           this.mimeType = mimeType;
       }
       
  @@ -105,20 +108,21 @@
       public String toString() {
           return this.mimeType;
       }
  -    
  +
       /**
       Compare one MimeType to another
       */
       public boolean equals( Object obj ) {
  -        if ( obj.getClass().getName().equals( this.getClass().getName() ) ) {
  -            
  +        if ( this == obj) {
  +            return true;
  +        }
  +        
  +        if (obj instanceof MimeType) {
               MimeType comp = (MimeType)obj;
               return this.toString().equals( comp.toString() );
  -            
           } else {
               return false;
           }
  -        
       }
       
   }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jetspeed-dev-help@jakarta.apache.org