Skip to main content

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


Regarding the alias, that's the name of the connection (as opposed to the host name).  I was thinking that it should be the alias so that IRemoteFiles from two connections of the same hostname would stay inequal, but I found that they remained inequal.   For the path.equals() I just blindly took what was there but, you're right, having the both of them makes no sense (I'm not sure why both were there originally).

____________________________________
David McKnight    
Phone:   905-413-3902 , T/L:  969-3902
Internet: dmcknigh@xxxxxxxxxx
Mail:       D1/140/8200/TOR
____________________________________



"Oberhuber, Martin" <Martin.Oberhuber@xxxxxxxxxxxxx>

07/11/2006 04:19 AM

To
David McKnight/Toronto/IBM@IBMCA
cc
"Target Management developer discussions" <dsdp-tm-dev@xxxxxxxxxxx>
Subject
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