Description
All of the Hadoop RPC servers either ignore the protocol name or do:
if (protocol.equals(Prot1.class.getName()) {
return Prot1.versionId;
} else {
return Prot2.versionId;
}
A much better structure would be:
if (Prot1.class.getName().equals(protocol)) {
return Prot1.versionId;
} else if (Prot2.class.getName().equals(protocol)) {
return Prot2.versionId;
} else {
throw new VersionMismatchException("Expected protocol Prot1 or Prot2 and received: " + protocol);
}