Skip to content

Commit

Permalink
Fixed syntax errors (missing ;, mismatched curly braces, etc)
Browse files Browse the repository at this point in the history
  • Loading branch information
bikegeek committed Jul 9, 2024
1 parent f88bb22 commit 703eaf1
Showing 1 changed file with 36 additions and 50 deletions.
86 changes: 36 additions & 50 deletions java/edu/ucar/metviewer/MVServlet.java
Original file line number Diff line number Diff line change
Expand Up @@ -1031,17 +1031,18 @@ public void doGet(HttpServletRequest request, HttpServletResponse response) {
}


// if there is no specified database, print out the list of parameters for debugging
try {
PrintWriter printWriter = response.getWriter();
response.setContentType("text/plain");
printWriter.println("howdy from MVServlet");
} catch (IOException e) {
logger.error(e.getMessage());
// if there is no specified database, print out the list of parameters for debugging
try {
PrintWriter printWriter = response.getWriter();
response.setContentType("text/plain");
printWriter.println("howdy from MVServlet");
} catch (IOException e) {
logger.error(e.getMessage());
}
} catch (Exception e) {
logger.error(e.getMessage());
}
}

/**
* Override the parent's doPost() method with an implementation that reads XML from the body of
Expand Down Expand Up @@ -1113,17 +1114,13 @@ public void doPost(HttpServletRequest request, HttpServletResponse response) {
// if the request is not a file upload, read it directly
try {
requestBody.append(request.getReader().lines().collect(Collectors.joining()));
} catch (java.lang.Exception e) {
} catch (Exception e) {
logger.error(e.getMessage());
}


}
try {
logger.debug("doPost() - request (" + request.getRemoteHost() + "): " + requestBody);
} catch (java.lang.Exception e) {
logger.error(e.getMessage());
}
logger.debug("doPost() - request (" + request.getRemoteHost() + "): " + requestBody);

StringBuilder strResp = new StringBuilder();

Expand Down Expand Up @@ -1162,11 +1159,10 @@ public void doPost(HttpServletRequest request, HttpServletResponse response) {
try {
request.getRequestDispatcher("/metviewer1.jsp").forward(request, response);
} catch (IOException | ServletException e) {
logger.error(e.getMessage())
logger.error(e.getMessage());
}
}
}
}
} else {

// instantiate and configure the xml parser
Expand Down Expand Up @@ -1300,22 +1296,16 @@ public void doPost(HttpServletRequest request, HttpServletResponse response) {
handleClearListValCache();
handleClearListStatCache();
} catch (ParserConfigurationException e) {
throw new RuntimeException(e.getMessage());
logger.error(e.getMessage());
}

}

// <date> tag, which is used to prevent caching
try {
isDateTag = nodeCall.tag.equalsIgnoreCase("date")
} catch (java.lang.Exception e) {
logger.info(e.getMessage());
}
else if (isDateTag) {
else if (nodeCall.tag.equalsIgnoreCase("date")) {
//do nothing
}
// <db_con> node containing the database connection name

else if (nodeCall.tag.equalsIgnoreCase("db_con")) {
if (nodeCall.value.isEmpty()) {
currentDbName = new String[0];
Expand All @@ -1326,67 +1316,63 @@ else if (nodeCall.tag.equalsIgnoreCase("db_con")) {

// <list_val>
else if (nodeCall.tag.equalsIgnoreCase("list_val")) {
try {
strResp.append(handleListVal(nodeCall, requestBody.toString(), currentDbName));
} catch (ValidationException e) {
logger.info(e.getMessage());
//try {
strResp.append(handleListVal(nodeCall, requestBody.toString(), currentDbName));
//} catch (ValidationException e) {
// logger.info(e.getMessage());
}

// <list_stat>
else if (nodeCall.tag.equalsIgnoreCase("list_stat")) {
try {
strResp.append(handleListStat(nodeCall, requestBody.toString(), currentDbName));
} catch (ParserConfigurationException e) {
logger.error( e.getMessage());
logger.error(e.getMessage());
}
}
// <list_val_clear_cache>
try {
isClearCache = nodeCall.tag.equalsIgnoreCase("list_val_clear_cache")
} catch (java.lang.Exception e) {
logger.info(e.getMessage());
}
else if (isClearCache) {
else if (nodeCall.tag.equalsIgnoreCase("list_val_clear_cache")) {
try {
strResp.append(handleClearListValCache());
strResp.append(handleClearListValCache());
} catch (ParserConfigurationException e) {
logger.error( e.getMessage());
logger.error(e.getMessage());
}
}

// <list_val_cache_keys>
else if (nodeCall.tag.equalsIgnoreCase("list_val_cache_keys")) {
try {
strResp.append(handleListValCacheKeys());
strResp.append(handleListValCacheKeys());
} catch (ParserConfigurationException e) {
logger.error( e.getMessage());
logger.error(e.getMessage());
}
}

// <list_stat_clear_cache>
else if (nodeCall.tag.equalsIgnoreCase("list_stat_clear_cache")) {
try {
strResp.append(handleClearListStatCache());
strResp.append(handleClearListStatCache());
} catch (ParserConfigurationException e) {
logger.error( e.getMessage());
logger.error(e.getMessage());
}
}

// <list_stat_cache_keys>
else if (nodeCall.tag.equalsIgnoreCase("list_stat_cache_keys")) {
try {
strResp.append(handleListStatCacheKeys());
strResp.append(handleListStatCacheKeys());
} catch (ParserConfigurationException e) {
logger.error( e.getMessage());
logger.error(e.getMessage());
}
}

// <plot>
else if (nodeCall.tag.equalsIgnoreCase("plot")) {
try {
strResp.append(handlePlot(requestBody.toString(), currentDbName));
} catch (ParserConfigurationException | DatabaseException | ValidationException | IOException | SAXException e) {
logger.error( e.getMessage());
strResp.append(handlePlot(requestBody.toString(), currentDbName));
} catch (ParserConfigurationException | DatabaseException | ValidationException | IOException |
SAXException e) {
logger.error(e.getMessage());
}

}
Expand All @@ -1410,7 +1396,7 @@ else if (nodeCall.tag.equalsIgnoreCase("xml_upload")) {
try {
strResp.append(getAvailableResults(isShowAll));
} catch (ParserConfigurationException e) {
logger.error( e.getMessage());
logger.error(e.getMessage());
}

}
Expand All @@ -1435,12 +1421,12 @@ else if (nodeCall.tag.equalsIgnoreCase("xml_upload")) {
try (PrintWriter printWriter = response.getWriter()) {
printWriter.append(strResp);
} catch (IOException e) {
logger.info( e.getMessage());
}

logger.info(e.getMessage());
}

}
} catch (ParserConfigurationException | FileUploadException | IOException | SAXException | ValidationException
| DatabaseException | ServletException e) {
| ServletException e) {
errorStream.print("doPost() - caught " + e.getClass() + ": " + e.getMessage());
logger.info(INFO_MARKER, "doPost() - caught " + e.getClass() + ": " + e.getMessage());
System.out.println("doPost() - caught " + e.getClass() + ": " + e.getMessage());
Expand Down

0 comments on commit 703eaf1

Please sign in to comment.