1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-03 14:25:37 +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){
if (!conn.getName().equals(form.getConnectionName()) ||
!conn.getHostName().equals(form.getHostName()) ||
!conn.getDescription().equals(form.getConnectionDescription()) ||
!conn.getDefaultUserId().equals(form.getDefaultUserId())){
if (!compareStrings(conn.getName(), form.getConnectionName()) ||
!compareStrings(conn.getHostName(), form.getHostName()) ||
!compareStrings(conn.getDescription(), form.getConnectionDescription()) ||
!compareStrings(conn.getDefaultUserId(), form.getDefaultUserId())){
return true;
}
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
*/