From a6203845c998a73431d4cec89417d42dee4d1335 Mon Sep 17 00:00:00 2001 From: sinthuja Date: Mon, 24 Oct 2016 16:37:00 +0530 Subject: [PATCH] Fixing the empty methods for resources in the synapse configuration issue when auto publishing the apis for the REST service. --- .../publisher/APIPublisherServiceImpl.java | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/main/java/org/wso2/carbon/apimgt/webapp/publisher/APIPublisherServiceImpl.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/main/java/org/wso2/carbon/apimgt/webapp/publisher/APIPublisherServiceImpl.java index 13c9aa04ea..14a922b355 100644 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/main/java/org/wso2/carbon/apimgt/webapp/publisher/APIPublisherServiceImpl.java +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/main/java/org/wso2/carbon/apimgt/webapp/publisher/APIPublisherServiceImpl.java @@ -88,8 +88,8 @@ public class APIPublisherServiceImpl implements APIPublisherService { provider.updateAPI(api); if (log.isDebugEnabled()) { log.debug("An API already exists with the name '" + api.getId().getApiName() + - "', context '" + api.getContext() + "' and version '" - + api.getId().getVersion() + "'. Thus, the API config is updated"); + "', context '" + api.getContext() + "' and version '" + + api.getId().getVersion() + "'. Thus, the API config is updated"); } } } @@ -181,18 +181,10 @@ public class APIPublisherServiceImpl implements APIPublisherService { * * @param api The actual API model object */ - private void processHttpVerbs(API api){ - for (URITemplate uriTemplate : api.getUriTemplates()){ + private void processHttpVerbs(API api) { + for (URITemplate uriTemplate : api.getUriTemplates()) { String httpVerbString = uriTemplate.getHTTPVerb(); - String[] httpVerbs = uriTemplate.getMethodsAsString().split(" "); - boolean httpVerbStringExistsMethods = false; - for (String aHttpVerb: httpVerbs){ - if (aHttpVerb.trim().equalsIgnoreCase(httpVerbString)){ - httpVerbStringExistsMethods = true; - break; - } - } - if (!httpVerbStringExistsMethods){ + if (httpVerbString != null && !httpVerbString.isEmpty()) { uriTemplate.setHttpVerbs(httpVerbString); } }