You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by co...@apache.org on 2020/07/17 11:49:36 UTC

[camel] branch master updated: Switch from toUpperCase/toLowerCase.endsWith to regionMatches

This is an automated email from the ASF dual-hosted git repository.

coheigea pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/master by this push:
     new 84fb463  Switch from toUpperCase/toLowerCase.endsWith to regionMatches
84fb463 is described below

commit 84fb46317c284d7bc7b89f15fd904022ecdf85cf
Author: Colm O hEigeartaigh <co...@apache.org>
AuthorDate: Fri Jul 17 12:48:50 2020 +0100

    Switch from toUpperCase/toLowerCase.endsWith to regionMatches
---
 .../org/apache/camel/maven/generator/openapi/AbstractGenerateMojo.java | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tooling/maven/camel-restdsl-openapi-plugin/src/main/java/org/apache/camel/maven/generator/openapi/AbstractGenerateMojo.java b/tooling/maven/camel-restdsl-openapi-plugin/src/main/java/org/apache/camel/maven/generator/openapi/AbstractGenerateMojo.java
index 0eda5f5..5fab41f 100644
--- a/tooling/maven/camel-restdsl-openapi-plugin/src/main/java/org/apache/camel/maven/generator/openapi/AbstractGenerateMojo.java
+++ b/tooling/maven/camel-restdsl-openapi-plugin/src/main/java/org/apache/camel/maven/generator/openapi/AbstractGenerateMojo.java
@@ -285,7 +285,8 @@ abstract class AbstractGenerateMojo extends AbstractMojo {
             is = this.getClass().getClassLoader().getResourceAsStream(specificationUri);
         }
 
-        if (specificationUri.toLowerCase().endsWith(".yaml")) {
+        String suffix = ".yaml";
+        if (specificationUri.regionMatches(true, specificationUri.length() - suffix.length(), suffix, 0, suffix.length())) {
             Yaml loader = new Yaml();
             Map map = loader.load(is);
             JsonNode node = mapper.convertValue(map, JsonNode.class);