Skip to content

Commit

Permalink
Polish the code from code review
Browse files Browse the repository at this point in the history
Signed-off-by:Ondro Mihalyi <mihalyi@omnifish.ee>
  • Loading branch information
OndroMih committed Sep 19, 2023
1 parent ea473ab commit de8746f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE glassfish-web-app PUBLIC "-//GlassFish.org//DTD GlassFish Application Server 3.1 Servlet 3.0//EN" "http://glassfish.org/dtds/glassfish-web-app_3_0-1.dtd">
<!--
Copyright (c) 2023 Contributors to the Eclipse Foundation.
Copyright (c) 1997, 2018 Oracle and/or its affiliates. All rights reserved.
This program and the accompanying materials are made available under the
Expand Down
Expand Up @@ -166,7 +166,7 @@ public void testContextInitialized() throws Exception {
// Deploy archive
Deployer deployer = glassfish.getDeployer();
String appname = deployer.deploy(warURI);
System.out.println("Deployed [" + appname + "]");
logger.log(INFO, "Deployed [" + appname + "]");
Assertions.assertEquals(appname, ARCHIVE_NAME);

get("http://localhost:8080/satest/" + ContextInitializedTestServlet.class.getSimpleName(),
Expand Down Expand Up @@ -198,9 +198,10 @@ private void get(String urlStr, String key, String value) throws Exception {
private List<String> getLinesFromUrl(URL url) throws Exception {
URLConnection yc = url.openConnection();
logger.log(DEBUG, "\nURLConnection [" + yc + "] : ");
BufferedReader in = new BufferedReader(new InputStreamReader(
yc.getInputStream()));
return in.lines().collect(toList());
try (BufferedReader in = new BufferedReader(new InputStreamReader(
yc.getInputStream()))) {
return in.lines().collect(toList());
}
}

void printContents(URI jarURI) throws IOException {
Expand Down
Expand Up @@ -33,9 +33,8 @@ public class ContextInitializedTestServlet extends HttpServlet {
@Override
protected void doGet(HttpServletRequest httpServletRequest,
HttpServletResponse httpServletResponse) throws ServletException, IOException {
PrintWriter out = httpServletResponse.getWriter();
out.println(LABEL_CONTEXT_INITIALIZED_COUNTER + ":" + ApplicationStatus.contextInitializedCounter);
out.flush();
out.close();
try (PrintWriter out = httpServletResponse.getWriter()) {
out.println(LABEL_CONTEXT_INITIALIZED_COUNTER + ":" + ApplicationStatus.contextInitializedCounter);
}
}
}

0 comments on commit de8746f

Please sign in to comment.