summaryrefslogtreecommitdiffstats
path: root/configserver
diff options
context:
space:
mode:
authorHåkon Hallingstad <hakon@yahoo-inc.com>2017-02-09 13:20:27 +0100
committerHåkon Hallingstad <hakon@yahoo-inc.com>2017-02-09 13:20:27 +0100
commit40330ae44631ec58ccbe9ddcc2f52753a10a2ac1 (patch)
tree316e502c1f2ee6a36c6154bcab62ffded5d6017c /configserver
parent10c9ce48d4f17da1271699091dc95d4c726ee4c6 (diff)
Use Not Found. Remove duplicate method.
Diffstat (limited to 'configserver')
-rw-r--r--configserver/src/main/java/com/yahoo/vespa/config/server/application/HttpProxy.java9
-rw-r--r--configserver/src/main/java/com/yahoo/vespa/config/server/http/v2/ApplicationHandler.java7
2 files changed, 5 insertions, 11 deletions
diff --git a/configserver/src/main/java/com/yahoo/vespa/config/server/application/HttpProxy.java b/configserver/src/main/java/com/yahoo/vespa/config/server/application/HttpProxy.java
index 78cf762671a..9a03bdc61ba 100644
--- a/configserver/src/main/java/com/yahoo/vespa/config/server/application/HttpProxy.java
+++ b/configserver/src/main/java/com/yahoo/vespa/config/server/application/HttpProxy.java
@@ -6,10 +6,9 @@ import com.yahoo.config.model.api.PortInfo;
import com.yahoo.config.model.api.ServiceInfo;
import com.yahoo.container.jdisc.HttpResponse;
import com.yahoo.log.LogLevel;
-import com.yahoo.vespa.config.server.http.BadRequestException;
import com.yahoo.vespa.config.server.http.HttpErrorResponse;
import com.yahoo.vespa.config.server.http.HttpFetcher;
-import com.yahoo.vespa.config.server.http.InternalServerException;
+import com.yahoo.vespa.config.server.http.NotFoundException;
import java.net.MalformedURLException;
import java.net.URL;
@@ -30,12 +29,12 @@ public class HttpProxy {
HostInfo host = application.getModel().getHosts().stream()
.filter(hostInfo -> hostInfo.getHostname().equals(hostName))
.findFirst()
- .orElseThrow(() -> new BadRequestException("Failed to find host " + hostName));
+ .orElseThrow(() -> new NotFoundException("Failed to find host " + hostName));
ServiceInfo service = host.getServices().stream()
.filter(serviceInfo -> serviceType.equals(serviceInfo.getServiceType()))
.findFirst()
- .orElseThrow(() -> new BadRequestException("Failed to find any service of type " + serviceType
+ .orElseThrow(() -> new NotFoundException("Failed to find any service of type " + serviceType
+ " on host " + hostName));
// "http" and "state" seems to uniquely identify an interesting HTTP port on each service
@@ -43,7 +42,7 @@ public class HttpProxy {
.filter(portInfo -> portInfo.getTags().stream().collect(Collectors.toSet()).containsAll(
Stream.of("http", "state").collect(Collectors.toSet())))
.findFirst()
- .orElseThrow(() -> new InternalServerException("Failed to find HTTP state port"));
+ .orElseThrow(() -> new NotFoundException("Failed to find HTTP state port"));
return internalGet(host.getHostname(), port.getPort(), relativePath);
}
diff --git a/configserver/src/main/java/com/yahoo/vespa/config/server/http/v2/ApplicationHandler.java b/configserver/src/main/java/com/yahoo/vespa/config/server/http/v2/ApplicationHandler.java
index a1c7f211765..ffbb2921134 100644
--- a/configserver/src/main/java/com/yahoo/vespa/config/server/http/v2/ApplicationHandler.java
+++ b/configserver/src/main/java/com/yahoo/vespa/config/server/http/v2/ApplicationHandler.java
@@ -63,7 +63,7 @@ public class ApplicationHandler extends HttpHandler {
Tenant tenant = verifyTenantAndApplication(applicationId);
if (isServiceConvergeRequest(request)) {
- return applicationRepository.serviceConvergenceCheck(tenant, applicationId, getHostFromRequest(request), request.getUri());
+ return applicationRepository.serviceConvergenceCheck(tenant, applicationId, getHostNameFromRequest(request), request.getUri());
}
if (isClusterControllerStatusRequest(request)) {
@@ -181,11 +181,6 @@ public class ApplicationHandler extends HttpHandler {
request.getUri().getPath().contains("/content/");
}
- private static String getHostFromRequest(HttpRequest req) {
- BindingMatch<?> bm = getBindingMatch(req);
- return bm.group(7);
- }
-
private static String getHostNameFromRequest(HttpRequest req) {
BindingMatch<?> bm = getBindingMatch(req);
return bm.group(7);