- From: Kyle Jamieson <jamieson@MIT.EDU>
- Date: Wed, 23 Jul 1997 12:01:46 -0400
- 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 UTC