From 763d194c2386c671011f97d9b0ec9204f7ad1157 Mon Sep 17 00:00:00 2001 From: David McKnight Date: Fri, 7 Nov 2008 21:55:00 +0000 Subject: [PATCH] [252708] using compareStrings() for more robust string compare --- .../SystemConnectionPropertyPage.java | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/propertypages/SystemConnectionPropertyPage.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/propertypages/SystemConnectionPropertyPage.java index c3b37ae1815..8def9f3efb7 100644 --- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/propertypages/SystemConnectionPropertyPage.java +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/propertypages/SystemConnectionPropertyPage.java @@ -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 */