From 08be80a5f35e4d21aa51974385eb6e0bc45c3fe8 Mon Sep 17 00:00:00 2001 From: ishitas Date: Tue, 15 Oct 2024 00:17:59 +0000 Subject: [PATCH] Syntax edit to a method --- java/edu/ucar/metviewer/MVServlet.java | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/java/edu/ucar/metviewer/MVServlet.java b/java/edu/ucar/metviewer/MVServlet.java index 6e6f98e8..47ddecdc 100644 --- a/java/edu/ucar/metviewer/MVServlet.java +++ b/java/edu/ucar/metviewer/MVServlet.java @@ -145,13 +145,25 @@ private void handleDownload(HttpServletRequest request, HttpServletResponse resp private String resolveFilePath(HttpServletRequest request) { String plot = MVUtil.cleanString(request.getParameter("plot")); String type = request.getParameter("type"); - return switch (type) { - case "plot_xml_url" -> plotXml + DELIMITER + plot + ".xml"; - case "plot_sql_url" -> plotXml + DELIMITER + plot + ".sql"; - case "plot_image_url" -> plots + DELIMITER + plot + ".png"; - default -> plotXml + DELIMITER + plot + ".xml"; - }; - } + String filePath; + + switch (type) { + case "plot_xml_url": + filePath = plotXml + DELIMITER + plot + ".xml"; + break; + case "plot_sql_url": + filePath = plotXml + DELIMITER + plot + ".sql"; + break; + case "plot_image_url": + filePath = plots + DELIMITER + plot + ".png"; + break; + default: + filePath = plotXml + DELIMITER + plot + ".xml"; + break; + } + + return filePath; +} private void sendDebugInfo(HttpServletResponse response) throws IOException { response.setContentType("text/plain");