From 505f9150d4a4a57c19328d5dbf79601a9746458b Mon Sep 17 00:00:00 2001 From: Sebastian Zarnekow Date: Fri, 13 Nov 2015 10:23:50 +0100 Subject: [PATCH] [482085] Fixed IllegalArgumentException in ImportNormalizer --- .../src/org/eclipse/xtext/scoping/impl/ImportNormalizer.java | 2 +- .../impl/ImportedNamespaceAwareLocalScopeProvider.java | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins/org.eclipse.xtext/src/org/eclipse/xtext/scoping/impl/ImportNormalizer.java b/plugins/org.eclipse.xtext/src/org/eclipse/xtext/scoping/impl/ImportNormalizer.java index d1b0fdcd5..63dd2c176 100644 --- a/plugins/org.eclipse.xtext/src/org/eclipse/xtext/scoping/impl/ImportNormalizer.java +++ b/plugins/org.eclipse.xtext/src/org/eclipse/xtext/scoping/impl/ImportNormalizer.java @@ -23,7 +23,7 @@ public class ImportNormalizer { public ImportNormalizer(QualifiedName importedNamespace, boolean wildCard, boolean ignoreCase) { this.ignoreCase = ignoreCase; - if (importedNamespace == null || importedNamespace.getSegmentCount() < 1) { + if (importedNamespace == null || importedNamespace.isEmpty()) { throw new IllegalArgumentException("Imported namespace must not be null / empty"); } hasWildCard = wildCard; diff --git a/plugins/org.eclipse.xtext/src/org/eclipse/xtext/scoping/impl/ImportedNamespaceAwareLocalScopeProvider.java b/plugins/org.eclipse.xtext/src/org/eclipse/xtext/scoping/impl/ImportedNamespaceAwareLocalScopeProvider.java index b989486c7..2e2881d95 100644 --- a/plugins/org.eclipse.xtext/src/org/eclipse/xtext/scoping/impl/ImportedNamespaceAwareLocalScopeProvider.java +++ b/plugins/org.eclipse.xtext/src/org/eclipse/xtext/scoping/impl/ImportedNamespaceAwareLocalScopeProvider.java @@ -161,7 +161,7 @@ public class ImportedNamespaceAwareLocalScopeProvider extends AbstractGlobalScop if (Strings.isEmpty(namespace)) return null; QualifiedName importedNamespace = qualifiedNameConverter.toQualifiedName(namespace); - if (importedNamespace == null || importedNamespace.getSegmentCount() < 1) { + if (importedNamespace == null || importedNamespace.isEmpty()) { return null; } boolean hasWildCard = ignoreCase ? @@ -191,7 +191,7 @@ public class ImportedNamespaceAwareLocalScopeProvider extends AbstractGlobalScop boolean ignoreCase = isIgnoreCase(reference); final List namespaceResolvers = getImportedNamespaceResolvers(context, ignoreCase); if (!namespaceResolvers.isEmpty()) { - if (isRelativeImport() && name!=null) { + if (isRelativeImport() && name!=null && !name.isEmpty()) { ImportNormalizer localNormalizer = doCreateImportNormalizer(name, true, ignoreCase); result = createImportScope(result, singletonList(localNormalizer), allDescriptions, reference.getEReferenceType(), isIgnoreCase(reference)); }