From aade4c37ca0d4ea3ed711d9a3ca18dab9b3e8a1b Mon Sep 17 00:00:00 2001 From: David Dykstal Date: Tue, 10 Oct 2006 02:00:29 +0000 Subject: [PATCH] Bug 160195 - provide a workaround by capitalizing the name using a locale that preserves the letter identity as specified in RFC1035. --- .../eclipse/rse/core/model/RSEModelObject.java | 2 +- .../org/eclipse/rse/internal/model/Host.java | 18 +++++++++++++----- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/RSEModelObject.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/RSEModelObject.java index 60266973248..cbeacf02976 100644 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/RSEModelObject.java +++ b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/RSEModelObject.java @@ -74,7 +74,7 @@ public abstract class RSEModelObject extends PropertySetContainer implements IRS protected boolean compareStrings(String s1, String s2) { boolean result = false; if (s1 == null) { - result = s1 == null; + result = (s2 == null); } else { result = s1.equals(s2); } diff --git a/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/internal/model/Host.java b/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/internal/model/Host.java index d2c1feb0df6..0bcfbe4ed52 100644 --- a/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/internal/model/Host.java +++ b/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/internal/model/Host.java @@ -16,6 +16,8 @@ package org.eclipse.rse.internal.model; +import java.util.Locale; + import org.eclipse.core.runtime.IAdaptable; import org.eclipse.core.runtime.Platform; import org.eclipse.rse.core.IRSESystemType; @@ -301,13 +303,19 @@ public class Host extends RSEModelObject implements IHost, IAdaptable } this.setSystemTypeGen(systemType); } + /** - * Intercept of setHostName so we can force it to uppercase + * Intercept of setHostName so we can force it to uppercase. + * IPv4 host names are case insensitive. Much data is stored using the host + * name as part of the key. Therefore, the host name is capitalized here so that + * these comparisons work naturally. + * However, this must be done using the US locale since IPv4 host names + * use can be compared using this locale. See RFC1035. */ - public void setHostName(String name) - { - if (name != null) - name = name.toUpperCase(); + public void setHostName(String name) { + if (name != null) { + name = name.toUpperCase(Locale.US); + } this.setHostNameGen(name); } /**