W3C home > Mailing lists > Public > www-jigsaw@w3.org > July to August 1997

Possible bug in w3c.www.mime.MimeType.match(...), or am I misinterpreting?

From: Kyle Jamieson <jamieson@MIT.EDU>
Date: Wed, 23 Jul 1997 12:01:46 -0400
Message-Id: <3.0.32.19970723120145.009234a0@po7.mit.edu>
To: abs@w3.org
Cc: Benoit Mahe <bmahe@w3.org>, www-jigsaw@w3.org
Hello,

This is from the package w3c.www.mime.*; file MimeType.java.  I'm a bit
confused by the rationale you use to match types here; it seems to me that
if the types match (*** below) then we shouldn't return -1 if consequently,
the subtypes don't (**** below) ; we should instead return
MATCH_SPECIFIC_TYPE.

    public int match (MimeType other) {
	int match = -1;
	// match types:

if ( type.equals("*") || other.type.equals("*") ) {
	    match =
MATCH_TYPE;
	} else if ( ! type.equals (other.type) ) {
	    return -1 ;
	}
else {
	    match = MATCH_SPECIFIC_TYPE; // ***
	}
	// match subtypes:
	if
( subtype.equals("*") || other.subtype.equals("*") ) {
	    match =
MATCH_SUBTYPE ;
	} else if ( ! subtype.equals (other.subtype) ) {

return -1; // **** Executed even if match == MATCH_SPECIFIC_TYPE !!!!
	   // change to "return match;" possibly?
	} else {
	    match =
MATCH_SPECIFIC_SUBTYPE;
	}
	return match;
    }

Am I just misinterpreting the use of match, or is there really a problem here?

Kyle Jamieson
Received on Wednesday, 23 July 1997 12:01:53 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 9 April 2012 12:13:26 GMT