Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[dsdp-tm-dev] Your latest changes on RemoteFile.java

Hi Dave,

before I release the Mapfile for todays I-build, I reviewed
all changes that happened yesterday, and I have a few questions
regarding your changes on RemoteFile.java v1.11:

			String otherHostAlias =
other.getParentRemoteFileSubSystem().getHostAliasName();
			return getHostName().equals(otherHost) &&
(path.equals(otherPath) || otherPath.equals(path));	
			//return
getParentRemoteFileSubSystem().getHostAliasName().equals(otherHostAlias)
;

* What is the difference between getHostName() and getHostAliasName() ?
  Why is the Alias computed but not used for comparison?

* The contract of Object.equals() says that it must be symmetric:
  if A.equals(B), then implementation MUST assure that also B.equals(A).
  See
http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Object.html#equals(jav
a.lang.Object)

  Therefore, I do not understand the code
     path.equals(otherPath) || otherPath.equals(path)

  Since "path" and "otherPath" are Strings, we can assume that the 
  equals() method is implemented correctly, i.e. it fulfills the 
  API contract and is symmetric indeed.

  --> Please change your code to remove the stuff after ||
  since it is misleading. Try to think about why that code
  was initially there, and find any problems this was trying
  to fix (but definitely did not fix due to the reason mentioned).

Perhaps you wanted something like
  ( path==null ? otherPath==null : path.equals(otherPath) )

Thanks,
--
Martin Oberhuber
Wind River Systems, Inc.
Target Management Project Lead, DSDP PMC Member
http://www.eclipse.org/dsdp/tm


Back to the top