Skip to content

Commit

Permalink
DDF-5479 Ensure correct locale is used when calling toLowerCase on tr…
Browse files Browse the repository at this point in the history
…ansformer type before comparison (#5488)

(cherry picked from commit 0996a13)
  • Loading branch information
coyotesqrl authored and brjeter committed Oct 21, 2019
1 parent 4e4f1c5 commit f3b5b57
Showing 1 changed file with 4 additions and 3 deletions.
Expand Up @@ -18,6 +18,7 @@
import com.google.common.collect.ImmutableMap;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import java.util.Locale;
import java.util.Map;
import spark.servlet.SparkApplication;

Expand Down Expand Up @@ -62,15 +63,15 @@ public void init() {
"/transformers/:type/:id",
(req, res) -> {
String id = req.params(":id");
String type = req.params(":type").toLowerCase();
String type = req.params(":type").toLowerCase(Locale.US);

Map<String, String> descriptor;

res.type("application/json");

if (METACARD_TRANSFORMER.equals(type)) {
if (METACARD_TRANSFORMER.equalsIgnoreCase(type)) {
descriptor = descriptors.getMetacardTransformer(id);
} else if (QUERY_RESPONSE_TRANSFORMER.equals(type)) {
} else if (QUERY_RESPONSE_TRANSFORMER.equalsIgnoreCase(type)) {
descriptor = descriptors.getQueryResponseTransformer(id);
} else {
res.status(404);
Expand Down

0 comments on commit f3b5b57

Please sign in to comment.