aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--container-core/src/main/java/com/yahoo/processing/request/CompoundName.java2
-rw-r--r--container-search/src/main/java/com/yahoo/search/query/profile/QueryProfileProperties.java2
2 files changed, 3 insertions, 1 deletions
diff --git a/container-core/src/main/java/com/yahoo/processing/request/CompoundName.java b/container-core/src/main/java/com/yahoo/processing/request/CompoundName.java
index 5e52f8d8b37..6af4811fa1b 100644
--- a/container-core/src/main/java/com/yahoo/processing/request/CompoundName.java
+++ b/container-core/src/main/java/com/yahoo/processing/request/CompoundName.java
@@ -175,6 +175,8 @@ public final class CompoundName {
if (compounds.size() < n)
throw new IllegalArgumentException("Asked for the first " + n + " components but '" +
this + "' only have " + compounds.size() + " components.");
+ if (compounds.size() == n) return this;
+ if (compounds.size() == 0) return empty;
return new CompoundName(compounds.subList(0, n));
}
diff --git a/container-search/src/main/java/com/yahoo/search/query/profile/QueryProfileProperties.java b/container-search/src/main/java/com/yahoo/search/query/profile/QueryProfileProperties.java
index 224f75e7034..f5d797b4b9f 100644
--- a/container-search/src/main/java/com/yahoo/search/query/profile/QueryProfileProperties.java
+++ b/container-search/src/main/java/com/yahoo/search/query/profile/QueryProfileProperties.java
@@ -357,7 +357,7 @@ public class QueryProfileProperties extends Properties {
if (profile.getTypes().isEmpty()) return name;
CompoundName unaliasedName = name;
- for (int i = 0; i<name.size(); i++) {
+ for (int i = 0; i < name.size(); i++) {
QueryProfileType type = profile.getType(name.first(i), context);
if (type == null) continue;
if (type.aliases() == null) continue; // TODO: Make never null