1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-06 15:55:47 +02:00

[252708] using compareStrings() for more robust string compare

This commit is contained in:
David McKnight 2008-11-07 21:55:00 +00:00
parent e927d71167
commit 763d194c23

View file

@ -101,16 +101,22 @@ public class SystemConnectionPropertyPage extends SystemBasePropertyPage
} }
private boolean hasConnectionChanged(IHost conn){ private boolean hasConnectionChanged(IHost conn){
if (!compareStrings(conn.getName(), form.getConnectionName()) ||
if (!conn.getName().equals(form.getConnectionName()) || !compareStrings(conn.getHostName(), form.getHostName()) ||
!conn.getHostName().equals(form.getHostName()) || !compareStrings(conn.getDescription(), form.getConnectionDescription()) ||
!conn.getDescription().equals(form.getConnectionDescription()) || !compareStrings(conn.getDefaultUserId(), form.getDefaultUserId())){
!conn.getDefaultUserId().equals(form.getDefaultUserId())){
return true; return true;
} }
return false; return false;
} }
private boolean compareStrings(String str1, String str2){
if (str1 == null || str1.length() == 0)
return (str2 == null || str2.length() == 0);
else
return (str2 == null || str2.length() == 0) ? false: str1.equals(str2);
}
/** /**
* Called by parent when user presses OK * Called by parent when user presses OK
*/ */