From aaec465decb3784a756567cfdb3e72ac9ff8e0a0 Mon Sep 17 00:00:00 2001 From: Sasini_Sandamali Date: Fri, 17 Mar 2023 14:10:52 +0530 Subject: [PATCH] Fix formatting issues --- .../apimgt/webapp/publisher/APIConfig.java | 1 - .../webapp/publisher/APIPublisherUtil.java | 3 +- .../lifecycle/util/AnnotationProcessor.java | 43 +++++++++---------- 3 files changed, 23 insertions(+), 24 deletions(-) diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/main/java/org/wso2/carbon/apimgt/webapp/publisher/APIConfig.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/main/java/org/wso2/carbon/apimgt/webapp/publisher/APIConfig.java index 17a2c1f464..dd3efdeac8 100644 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/main/java/org/wso2/carbon/apimgt/webapp/publisher/APIConfig.java +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/main/java/org/wso2/carbon/apimgt/webapp/publisher/APIConfig.java @@ -28,7 +28,6 @@ import java.util.Set; /** * This bean class carries the properties used by some API that needs to be published within the underlying * API-Management infrastructure. - *

* A sample API configuration accepted by this particular bean class would look like what's shown below. * e.g. * diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/main/java/org/wso2/carbon/apimgt/webapp/publisher/APIPublisherUtil.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/main/java/org/wso2/carbon/apimgt/webapp/publisher/APIPublisherUtil.java index 438afef943..2b6a86fb06 100644 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/main/java/org/wso2/carbon/apimgt/webapp/publisher/APIPublisherUtil.java +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/main/java/org/wso2/carbon/apimgt/webapp/publisher/APIPublisherUtil.java @@ -336,7 +336,8 @@ public class APIPublisherUtil { String fullPaath = ""; if (!template.getUriTemplate().equals(AnnotationProcessor.WILD_CARD)) { fullPaath = apiConfig.getContext() + template.getUriTemplate(); - } else { + } + else { fullPaath = apiConfig.getContext(); } for (String context : resourcesList) { diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/main/java/org/wso2/carbon/apimgt/webapp/publisher/lifecycle/util/AnnotationProcessor.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/main/java/org/wso2/carbon/apimgt/webapp/publisher/lifecycle/util/AnnotationProcessor.java index 1784d487e3..f41c07967a 100644 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/main/java/org/wso2/carbon/apimgt/webapp/publisher/lifecycle/util/AnnotationProcessor.java +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/main/java/org/wso2/carbon/apimgt/webapp/publisher/lifecycle/util/AnnotationProcessor.java @@ -52,7 +52,6 @@ import java.util.*; public class AnnotationProcessor { - public static final String WILD_CARD = "/*"; private static final Log log = LogFactory.getLog(AnnotationProcessor.class); private static final String AUTH_TYPE = "Application & Application User"; private static final String STRING_ARR = "string_arr"; @@ -60,6 +59,7 @@ public class AnnotationProcessor { private static final String PACKAGE_ORG_APACHE = "org.apache"; private static final String PACKAGE_ORG_CODEHAUS = "org.codehaus"; private static final String PACKAGE_ORG_SPRINGFRAMEWORK = "org.springframework"; + public static final String WILD_CARD = "/*"; private static final String SWAGGER_ANNOTATIONS_INFO = "info"; private static final String SWAGGER_ANNOTATIONS_TAGS = "tags"; private static final String SWAGGER_ANNOTATIONS_EXTENSIONS = "extensions"; @@ -132,27 +132,6 @@ public class AnnotationProcessor { log.error("An error has occurred while loading classes ", e); } } - - /** - * Find the URL pointing to "/WEB-INF/classes" This method may not work in conjunction with IteratorFactory - * if your servlet container does not extract the /WEB-INF/classes into a real file-based directory - * - * @param servletContext - * @return null if cannot determin /WEB-INF/classes - */ - private static URL findWebInfClassesPath(ServletContext servletContext) { - String path = servletContext.getRealPath("/WEB-INF/classes"); - if (path == null) return null; - File fp = new File(path); - if (fp.exists() == false) return null; - try { - URI uri = fp.toURI(); - return uri.toURL(); - } catch (MalformedURLException e) { - throw new RuntimeException(e); - } - } - public Set scanStandardContext(String className) throws IOException { ExtendedAnnotationDB db = new ExtendedAnnotationDB(); db.addIgnoredPackages(PACKAGE_ORG_APACHE); @@ -511,6 +490,26 @@ public class AnnotationProcessor { } } + /** + * Find the URL pointing to "/WEB-INF/classes" This method may not work in conjunction with IteratorFactory + * if your servlet container does not extract the /WEB-INF/classes into a real file-based directory + * + * @param servletContext + * @return null if cannot determin /WEB-INF/classes + */ + private static URL findWebInfClassesPath(ServletContext servletContext) { + String path = servletContext.getRealPath("/WEB-INF/classes"); + if (path == null) return null; + File fp = new File(path); + if (fp.exists() == false) return null; + try { + URI uri = fp.toURI(); + return uri.toURL(); + } catch (MalformedURLException e) { + throw new RuntimeException(e); + } + } + private APIResource getAPiOperationExtensions(Annotation currentMethod, APIResource apiResource) throws Throwable { InvocationHandler methodHandler = Proxy.getInvocationHandler(currentMethod); Annotation[] extensions = (Annotation[]) methodHandler.invoke(currentMethod,