From a15e522f916d0da20ffcac89d0fdf43738eb850a Mon Sep 17 00:00:00 2001 From: Kohei Tamura Date: Wed, 25 Oct 2017 17:22:20 +0900 Subject: [PATCH] Refactor code --- .../easybuggy/core/dao/EmbeddedADS.java | 2 +- .../core/servlets/AbstractServlet.java | 173 ++++++++++++++++ .../core/servlets/AdminsMainServlet.java | 23 +-- .../core/servlets/DefaultLoginServlet.java | 113 +++++------ .../core/servlets/DefaultLogoutServlet.java | 3 +- .../easybuggy/core/servlets/ExitServlet.java | 8 +- .../easybuggy/core/servlets/PingServlet.java | 7 +- .../easybuggy/core/servlets/TestServlet.java | 7 +- .../easybuggy/core/utils/EmailUtils.java | 30 ++- .../core/utils/HTTPResponseCreator.java | 88 -------- .../easybuggy/core/utils/MessageUtils.java | 86 -------- .../core/utils/MultiPartFileUtils.java | 64 ++++++ .../errors/AssertionErrorServlet.java | 5 +- .../ExceptionInInitializerErrorServlet.java | 7 +- .../FactoryConfigurationErrorServlet.java | 5 +- .../GenericSignatureFormatErrorServlet.java | 5 +- .../errors/NoClassDefFoundErrorServlet.java | 4 +- .../errors/OutOfMemoryErrorServlet.java | 5 +- .../errors/OutOfMemoryErrorServlet2.java | 5 +- .../errors/OutOfMemoryErrorServlet3.java | 10 +- .../errors/OutOfMemoryErrorServlet4.java | 5 +- .../errors/OutOfMemoryErrorServlet5.java | 8 +- .../errors/OutOfMemoryErrorServlet6.java | 5 +- .../errors/StackOverflowErrorServlet.java | 5 +- ...ormerFactoryConfigurationErrorServlet.java | 5 +- .../errors/UnsatisfiedLinkErrorServlet.java | 5 +- .../ArithmeticExceptionServlet.java | 5 +- ...ArrayIndexOutOfBoundsExceptionServlet.java | 5 +- .../ArrayStoreExceptionServlet.java | 5 +- .../BufferOverflowExceptionServlet.java | 10 +- .../BufferUnderflowExceptionServlet.java | 5 +- .../CannotRedoExceptionServlet.java | 5 +- .../CannotUndoExceptionServlet.java | 5 +- .../exceptions/ClassCastExceptionServlet.java | 5 +- ...oncurrentModificationExceptionServlet.java | 5 +- .../EmptyStackExceptionServlet.java | 8 +- .../IllegalArgumentExceptionServlet.java | 5 +- .../IllegalMonitorStateExceptionServlet.java | 8 +- .../IllegalPathStateExceptionServlet.java | 5 +- .../IllegalStateExceptionServlet.java | 5 +- .../IllegalThreadStateExceptionServlet.java | 5 +- .../exceptions/ImagingOpExceptionServlet.java | 5 +- .../IndexOutOfBoundsExceptionServlet.java | 5 +- .../InputMismatchExceptionServlet.java | 5 +- ...rmedParameterizedTypeExceptionServlet.java | 5 +- .../MissingResourceExceptionServlet.java | 5 +- .../NegativeArraySizeExceptionServlet.java | 5 +- .../NoSuchElementExceptionServlet.java | 5 +- .../NullPointerExceptionServlet.java | 5 +- .../NumberFormatExceptionServlet.java | 5 +- .../exceptions/SecurityExceptionServlet.java | 5 +- .../UnsupportedCharsetExceptionServlet.java | 5 +- .../UnsupportedOperationExceptionServlet.java | 5 +- .../CreatingUnnecessaryObjectsServlet.java | 19 +- .../SlowRegularExpressionServlet.java | 27 +-- .../StringPlusOperationServlet.java | 37 ++-- .../troubles/DBConnectionLeakServlet.java | 30 ++- .../easybuggy/troubles/DeadlockServlet.java | 22 +- .../easybuggy/troubles/DeadlockServlet2.java | 37 ++-- .../troubles/EndlessWaitingServlet.java | 29 +-- .../troubles/FileDescriptorLeakServlet.java | 25 +-- .../troubles/ForwardLoopServlet.java | 5 +- .../troubles/InfiniteLoopServlet.java | 8 +- .../troubles/IntegerOverflowServlet.java | 23 +-- .../troubles/JVMCrashByEAVServlet.java | 8 +- .../troubles/LossOfTrailingDigitsServlet.java | 19 +- .../easybuggy/troubles/MemoryLeakServlet.java | 31 ++- .../troubles/MemoryLeakServlet2.java | 33 ++- .../troubles/MemoryLeakServlet3.java | 23 +-- .../easybuggy/troubles/MojibakeServlet.java | 25 +-- .../troubles/NetworkSocketLeakServlet.java | 29 +-- .../troubles/RedirectLoopServlet.java | 5 +- .../troubles/RoundOffErrorServlet.java | 19 +- .../easybuggy/troubles/ThreadLeakServlet.java | 17 +- .../troubles/TruncationErrorServlet.java | 21 +- .../vulnerabilities/CSRFServlet.java | 41 ++-- .../vulnerabilities/ClickJackingServlet.java | 56 ++---- .../vulnerabilities/CodeInjectionServlet.java | 36 ++-- .../vulnerabilities/LDAPInjectionServlet.java | 11 +- .../MailHeaderInjectionServlet.java | 63 ++---- .../NullByteInjectionServlet.java | 21 +- .../OGNLExpressionInjectionServlet.java | 31 ++- .../vulnerabilities/OpenRedirectServlet.java | 53 ++--- .../vulnerabilities/SQLInjectionServlet.java | 31 ++- .../UnrestrictedExtensionUploadServlet.java | 75 ++----- .../UnrestrictedSizeUploadServlet.java | 76 ++----- .../VerboseErrorMessageServlet.java | 34 +--- .../vulnerabilities/XEEandXXEServlet.java | 188 +++++++----------- .../easybuggy/vulnerabilities/XSSServlet.java | 25 +-- src/main/resources/indexpage_en.properties | 2 +- src/main/webapp/dfi/includable.jsp | 8 +- src/main/webapp/dt/includable.jsp | 6 +- src/main/webapp/images/easybuggy.png | Bin 19588 -> 19412 bytes src/main/webapp/index.jsp | 34 ++-- src/main/webapp/uid/clientinfo.jsp | 6 +- src/main/webapp/uid/serverinfo.jsp | 6 +- 96 files changed, 896 insertions(+), 1228 deletions(-) create mode 100644 src/main/java/org/t246osslab/easybuggy/core/servlets/AbstractServlet.java delete mode 100644 src/main/java/org/t246osslab/easybuggy/core/utils/HTTPResponseCreator.java delete mode 100644 src/main/java/org/t246osslab/easybuggy/core/utils/MessageUtils.java create mode 100644 src/main/java/org/t246osslab/easybuggy/core/utils/MultiPartFileUtils.java diff --git a/src/main/java/org/t246osslab/easybuggy/core/dao/EmbeddedADS.java b/src/main/java/org/t246osslab/easybuggy/core/dao/EmbeddedADS.java index a0e480ff..68fb4735 100644 --- a/src/main/java/org/t246osslab/easybuggy/core/dao/EmbeddedADS.java +++ b/src/main/java/org/t246osslab/easybuggy/core/dao/EmbeddedADS.java @@ -28,7 +28,7 @@ public final class EmbeddedADS { /** The directory service */ private static DirectoryService service; - /** + /* * Create an instance of EmbeddedADS and initialize it. */ static { diff --git a/src/main/java/org/t246osslab/easybuggy/core/servlets/AbstractServlet.java b/src/main/java/org/t246osslab/easybuggy/core/servlets/AbstractServlet.java new file mode 100644 index 00000000..a786d39c --- /dev/null +++ b/src/main/java/org/t246osslab/easybuggy/core/servlets/AbstractServlet.java @@ -0,0 +1,173 @@ +package org.t246osslab.easybuggy.core.servlets; + +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.servlet.http.HttpSession; + +import org.owasp.esapi.ESAPI; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.t246osslab.easybuggy.core.utils.Closer; + +import java.io.PrintWriter; +import java.text.MessageFormat; +import java.util.Locale; +import java.util.ResourceBundle; + +@SuppressWarnings("serial") +public abstract class AbstractServlet extends HttpServlet { + + protected Logger log = LoggerFactory.getLogger(this.getClass()); + + /** + * Send an HTTP response to the client. + * + * @param req HTTP servlet request. + * @param res HTTP servlet response. + * @param htmlTitle Title of HTML page. + * @param htmlBody Body of HTML page. + */ + protected void responseToClient(HttpServletRequest req, HttpServletResponse res, String htmlTitle, String htmlBody) { + PrintWriter writer = null; + HttpSession session = req.getSession(); + String userid = (String) session.getAttribute("userid"); + Locale locale = req.getLocale(); + try { + writer = res.getWriter(); + writer.write(""); + writer.write(""); + if (htmlTitle != null) { + writer.write("" + htmlTitle + ""); + } + writer.write(""); + writer.write(""); + writer.write(""); + writer.write(""); + writer.write(""); + writer.write(""); + writer.write(""); + + writer.write(""); + writer.write(""); + writer.write(""); + writer.write(""); + if (userid != null && req.getServletPath().startsWith("/admins")) { + writer.write(""); + } else { + writer.write(""); + } + writer.write(""); + writer.write("
"); + writer.write("

"); + writer.write(" "); + if (htmlTitle != null) { + writer.write(htmlTitle); + } + writer.write("

"); + writer.write("
"); + writer.write(getMsg("label.login.user.id", locale) + ": " + userid); + writer.write("
"); + writer.write("" + getMsg("label.logout", locale) + ""); + writer.write("
"); + writer.write("" + getMsg("label.go.to.main", locale) + ""); + writer.write("
"); + writer.write("
"); + writer.write(htmlBody); + writer.write(""); + writer.write(""); + + } catch (Exception e) { + log.error("Exception occurs: ", e); + } finally { + Closer.close(writer); + } + } + + /** + * Return a message for a given property key. + * + * @return A message for a given property key + */ + protected String getMsg(String propertyKey, Locale locale) { + return getMsg(propertyKey, null, locale); + } + + /** + * Return an information message for a given property key. + * + * @return An information message for a given property key + */ + protected String getInfoMsg(String propertyKey, Locale locale) { + return getInfoMsg(propertyKey, null, locale); + } + + /** + * Return an error message for a given property key. + * + * @return An error message for a given property key + */ + protected String getErrMsg(String propertyKey, Locale locale) { + return getErrMsg(propertyKey, null, locale); + } + + /** + * Return a message for a given property key, replaced with placeholders. + * + * @return A message for a given property key, replaced with placeholders + */ + protected String getMsg(String propertyKey, Object[] placeholders, Locale locale) { + String propertyValue = null; + try { + propertyValue = ResourceBundle.getBundle("messages", locale).getString(propertyKey); + if (placeholders != null) { + propertyValue = MessageFormat.format(propertyValue, placeholders); + } + } catch (Exception e) { + log.error("Exception occurs: ", e); + } + return propertyValue; + } + + /** + * Return an information message for a given property key, replaced with placeholders. + * + * @return An information message for a given property key, replaced with placeholders + */ + protected String getInfoMsg(String propertyKey, Object[] placeholders, Locale locale) { + return "
  " + + getMsg(propertyKey, placeholders, locale) + "
"; + } + + /** + * Return an error message for a given property key, replaced with placeholders. + * + * @return An error message for a given property key, replaced with placeholders + */ + protected String getErrMsg(String propertyKey, Object[] placeholders, Locale locale) { + return "
  " + + getMsg(propertyKey, placeholders, locale) + "
"; + } + + /** + * Encode data for use in HTML using HTML entity encoding + * Note that this method just call ESAPI.encoder().encodeForHTML(String). + * + * @param input the text to encode for HTML + * @return input encoded for HTML + */ + protected String encodeForHTML(String input) { + return ESAPI.encoder().encodeForHTML(input); + } + + /** + * Encode data for use in LDAP queries. + * Note that this method just call ESAPI.encoder().encodeForLDAP((String). + * + * @param input the text to encode for LDAP + * @return input encoded for use in LDAP + */ + protected String encodeForLDAP(String input) { + return ESAPI.encoder().encodeForLDAP(input); + } +} diff --git a/src/main/java/org/t246osslab/easybuggy/core/servlets/AdminsMainServlet.java b/src/main/java/org/t246osslab/easybuggy/core/servlets/AdminsMainServlet.java index 6de6f396..861da082 100644 --- a/src/main/java/org/t246osslab/easybuggy/core/servlets/AdminsMainServlet.java +++ b/src/main/java/org/t246osslab/easybuggy/core/servlets/AdminsMainServlet.java @@ -5,31 +5,26 @@ import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; -import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.t246osslab.easybuggy.core.utils.HTTPResponseCreator; -import org.t246osslab.easybuggy.core.utils.MessageUtils; - @SuppressWarnings("serial") @WebServlet(urlPatterns = { "/admins/main" }) -public class AdminsMainServlet extends HttpServlet { +public class AdminsMainServlet extends AbstractServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { Locale locale = req.getLocale(); StringBuilder bodyHtml = new StringBuilder(); - bodyHtml.append(MessageUtils.getMsg("msg.admin.page.top", locale)); + bodyHtml.append(getMsg("msg.admin.page.top", locale)); bodyHtml.append("

"); - HTTPResponseCreator.createSimpleResponse(req, res, MessageUtils.getMsg("title.adminmain.page", locale), - bodyHtml.toString()); + responseToClient(req, res, getMsg("title.adminmain.page", locale), bodyHtml.toString()); } } diff --git a/src/main/java/org/t246osslab/easybuggy/core/servlets/DefaultLoginServlet.java b/src/main/java/org/t246osslab/easybuggy/core/servlets/DefaultLoginServlet.java index b0b80c6c..f3da5483 100644 --- a/src/main/java/org/t246osslab/easybuggy/core/servlets/DefaultLoginServlet.java +++ b/src/main/java/org/t246osslab/easybuggy/core/servlets/DefaultLoginServlet.java @@ -8,7 +8,6 @@ import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; -import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; @@ -20,128 +19,112 @@ import org.apache.directory.shared.ldap.filter.SearchScope; import org.apache.directory.shared.ldap.message.AliasDerefMode; import org.apache.directory.shared.ldap.name.LdapDN; -import org.owasp.esapi.ESAPI; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import org.t246osslab.easybuggy.core.dao.EmbeddedADS; import org.t246osslab.easybuggy.core.model.User; import org.t246osslab.easybuggy.core.utils.ApplicationUtils; -import org.t246osslab.easybuggy.core.utils.HTTPResponseCreator; -import org.t246osslab.easybuggy.core.utils.MessageUtils; @SuppressWarnings("serial") @WebServlet(urlPatterns = { "/login" }) -public class DefaultLoginServlet extends HttpServlet { +public class DefaultLoginServlet extends AbstractServlet { /* User's login history using in-memory account locking */ protected ConcurrentHashMap userLoginHistory = new ConcurrentHashMap(); - private static final Logger log = LoggerFactory.getLogger(DefaultLoginServlet.class); - @Override public void doGet(HttpServletRequest req, HttpServletResponse res) throws IOException, ServletException { Locale locale = req.getLocale(); StringBuilder bodyHtml = new StringBuilder(); - bodyHtml.append("

" + MessageUtils.getMsg("msg.need.admin.privilege", locale) + " "); - bodyHtml.append(MessageUtils.getMsg("msg.enter.id.and.password", locale) + "

"); + bodyHtml.append("

" + getMsg("msg.need.admin.privilege", locale) + " "); + bodyHtml.append(getMsg("msg.enter.id.and.password", locale) + "

"); bodyHtml.append("
"); bodyHtml.append(""); bodyHtml.append(""); - bodyHtml.append(""); + bodyHtml.append(""); bodyHtml.append(""); bodyHtml.append(""); bodyHtml.append(""); - bodyHtml.append(""); + bodyHtml.append(""); bodyHtml.append(""); bodyHtml.append(""); bodyHtml.append(""); bodyHtml.append(""); - bodyHtml.append(""); + bodyHtml.append(""); bodyHtml.append(""); bodyHtml.append("
" + MessageUtils.getMsg("label.user.id", locale) + " : " + getMsg("label.user.id", locale) + " : 
" + MessageUtils.getMsg("label.password", locale) + " : " + getMsg("label.password", locale) + " : 
"); String queryString = req.getQueryString(); if (queryString != null) { bodyHtml.append(""); + + encodeForHTML(queryString) + "\">"); } Enumeration paramNames = req.getParameterNames(); while (paramNames.hasMoreElements()) { String paramName = (String) paramNames.nextElement(); String[] paramValues = req.getParameterValues(paramName); for (int i = 0; i < paramValues.length; i++) { - bodyHtml.append(""); + bodyHtml.append(""); } } HttpSession session = req.getSession(true); - if (session.getAttribute("authNMsg") != null && !"authenticated".equals(session.getAttribute("authNMsg"))) { - bodyHtml.append(MessageUtils.getErrMsg((String)session.getAttribute("authNMsg"), locale)); + if (session.getAttribute("authNMsg") != null + && !"authenticated".equals(session.getAttribute("authNMsg"))) { + bodyHtml.append(getErrMsg((String) session.getAttribute("authNMsg"), locale)); session.setAttribute("authNMsg", null); } if (req.getAttribute("login.page.note") != null) { - bodyHtml.append(MessageUtils.getInfoMsg((String) req.getAttribute("login.page.note"), locale)); + bodyHtml.append(getInfoMsg((String) req.getAttribute("login.page.note"), locale)); } bodyHtml.append("
"); - HTTPResponseCreator.createSimpleResponse(req, res, MessageUtils.getMsg("title.login.page", locale), - bodyHtml.toString()); + responseToClient(req, res, getMsg("title.login.page", locale), bodyHtml.toString()); } @Override - public void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { + public void doPost(HttpServletRequest req, HttpServletResponse res) throws IOException, ServletException { - String userid = StringUtils.trim(request.getParameter("userid")); - String password = StringUtils.trim(request.getParameter("password")); + String userid = StringUtils.trim(req.getParameter("userid")); + String password = StringUtils.trim(req.getParameter("password")); - HttpSession session = request.getSession(true); + HttpSession session = req.getSession(true); if (isAccountLocked(userid)) { session.setAttribute("authNMsg", "msg.account.locked"); - response.sendRedirect("/login"); + res.sendRedirect("/login"); } else if (authUser(userid, password)) { - /* Reset account lock */ - User admin = userLoginHistory.get(userid); - if (admin == null) { - User newAdmin = new User(); - newAdmin.setUserId(userid); - admin = userLoginHistory.putIfAbsent(userid, newAdmin); - if (admin == null) { - admin = newAdmin; - } - } - admin.setLoginFailedCount(0); - admin.setLastLoginFailedTime(null); + /* Reset account lock count */ + resetAccountLock(userid); session.setAttribute("authNMsg", "authenticated"); session.setAttribute("userid", userid); String target = (String) session.getAttribute("target"); if (target == null) { - response.sendRedirect("/admins/main"); + res.sendRedirect("/admins/main"); } else { session.removeAttribute("target"); - response.sendRedirect(target); + res.sendRedirect(target); } } else { /* account lock count +1 */ - User admin = userLoginHistory.get(userid); - if (admin == null) { - User newAdmin = new User(); - newAdmin.setUserId(userid); - admin = userLoginHistory.putIfAbsent(userid, newAdmin); - if (admin == null) { - admin = newAdmin; - } - } - admin.setLoginFailedCount(admin.getLoginFailedCount() + 1); - admin.setLastLoginFailedTime(new Date()); - + incrementAccountLockNum(userid); session.setAttribute("authNMsg", "msg.authentication.fail"); - doGet(request, response) ; + doGet(req, res) ; } } + protected void incrementAccountLockNum(String userid) { + User admin = getUser(userid); + admin.setLoginFailedCount(admin.getLoginFailedCount() + 1); + admin.setLastLoginFailedTime(new Date()); + } + + protected void resetAccountLock(String userid) { + User admin = getUser(userid); + admin.setLoginFailedCount(0); + admin.setLastLoginFailedTime(null); + } + protected boolean isAccountLocked(String userid) { User admin = userLoginHistory.get(userid); return (admin != null @@ -150,16 +133,16 @@ protected boolean isAccountLocked(String userid) { .getAccountLockTime())); } - protected boolean authUser(String username, String password) { + protected boolean authUser(String uid, String password) { - if (username == null || password == null) { + if (uid == null || password == null) { return false; } ExprNode filter = null; EntryFilteringCursor cursor = null; try { - filter = FilterParser.parse("(&(uid=" + ESAPI.encoder().encodeForLDAP(username.trim()) - + ")(userPassword=" + ESAPI.encoder().encodeForLDAP(password.trim()) + "))"); + filter = FilterParser.parse("(&(uid=" + encodeForLDAP(uid.trim()) + + ")(userPassword=" + encodeForLDAP(password.trim()) + "))"); cursor = EmbeddedADS.getAdminSession().search(new LdapDN("ou=people,dc=t246osslab,dc=org"), SearchScope.SUBTREE, filter, AliasDerefMode.NEVER_DEREF_ALIASES, null); if (cursor.available()) { @@ -178,4 +161,18 @@ protected boolean authUser(String username, String password) { } return false; } + + protected User getUser(String userid) { + User admin = userLoginHistory.get(userid); + if (admin == null) { + User newAdmin = new User(); + newAdmin.setUserId(userid); + admin = userLoginHistory.putIfAbsent(userid, newAdmin); + if (admin == null) { + admin = newAdmin; + } + } + return admin; + } + } diff --git a/src/main/java/org/t246osslab/easybuggy/core/servlets/DefaultLogoutServlet.java b/src/main/java/org/t246osslab/easybuggy/core/servlets/DefaultLogoutServlet.java index d594ee35..5e98ff10 100644 --- a/src/main/java/org/t246osslab/easybuggy/core/servlets/DefaultLogoutServlet.java +++ b/src/main/java/org/t246osslab/easybuggy/core/servlets/DefaultLogoutServlet.java @@ -4,14 +4,13 @@ import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; -import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; @SuppressWarnings("serial") @WebServlet(urlPatterns = { "/logout" }) -public class DefaultLogoutServlet extends HttpServlet { +public class DefaultLogoutServlet extends AbstractServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { diff --git a/src/main/java/org/t246osslab/easybuggy/core/servlets/ExitServlet.java b/src/main/java/org/t246osslab/easybuggy/core/servlets/ExitServlet.java index c872e1b6..b1e08859 100644 --- a/src/main/java/org/t246osslab/easybuggy/core/servlets/ExitServlet.java +++ b/src/main/java/org/t246osslab/easybuggy/core/servlets/ExitServlet.java @@ -4,18 +4,12 @@ import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; -import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - @SuppressWarnings("serial") @WebServlet(urlPatterns = { "/exit" }) -public class ExitServlet extends HttpServlet { - - private static final Logger log = LoggerFactory.getLogger(ExitServlet.class); +public class ExitServlet extends AbstractServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { diff --git a/src/main/java/org/t246osslab/easybuggy/core/servlets/PingServlet.java b/src/main/java/org/t246osslab/easybuggy/core/servlets/PingServlet.java index 2d0e407b..c58066ea 100644 --- a/src/main/java/org/t246osslab/easybuggy/core/servlets/PingServlet.java +++ b/src/main/java/org/t246osslab/easybuggy/core/servlets/PingServlet.java @@ -5,20 +5,15 @@ import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; -import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import org.t246osslab.easybuggy.core.utils.Closer; @SuppressWarnings("serial") @WebServlet(urlPatterns = { "/ping" }) -public class PingServlet extends HttpServlet { +public class PingServlet extends AbstractServlet { - private static final Logger log = LoggerFactory.getLogger(PingServlet.class); - @Override protected void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { diff --git a/src/main/java/org/t246osslab/easybuggy/core/servlets/TestServlet.java b/src/main/java/org/t246osslab/easybuggy/core/servlets/TestServlet.java index 649f0b15..311d0852 100644 --- a/src/main/java/org/t246osslab/easybuggy/core/servlets/TestServlet.java +++ b/src/main/java/org/t246osslab/easybuggy/core/servlets/TestServlet.java @@ -4,19 +4,16 @@ import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; -import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.t246osslab.easybuggy.core.utils.HTTPResponseCreator; - @SuppressWarnings("serial") @WebServlet(urlPatterns = { "/test" }) -public class TestServlet extends HttpServlet { +public class TestServlet extends AbstractServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { - HTTPResponseCreator.createSimpleResponse(req, res, "Test", "Test!!"); + responseToClient(req, res, "Test", "Test!!"); } } diff --git a/src/main/java/org/t246osslab/easybuggy/core/utils/EmailUtils.java b/src/main/java/org/t246osslab/easybuggy/core/utils/EmailUtils.java index 12e42032..0bed4040 100644 --- a/src/main/java/org/t246osslab/easybuggy/core/utils/EmailUtils.java +++ b/src/main/java/org/t246osslab/easybuggy/core/utils/EmailUtils.java @@ -1,5 +1,5 @@ package org.t246osslab.easybuggy.core.utils; - + import java.io.File; import java.io.IOException; import java.util.Date; @@ -13,6 +13,7 @@ import javax.mail.PasswordAuthentication; import javax.mail.Session; import javax.mail.Transport; +import javax.mail.internet.AddressException; import javax.mail.internet.InternetAddress; import javax.mail.internet.MimeBodyPart; import javax.mail.internet.MimeMessage; @@ -27,7 +28,7 @@ * */ public class EmailUtils { - + private static final Logger log = LoggerFactory.getLogger(EmailUtils.class); // squid:S1118: Utility classes should not have public constructors @@ -35,6 +36,9 @@ private EmailUtils() { throw new IllegalAccessError("Utility class"); } + /** + * Check if it is ready to send E-mail. + */ public static boolean isReadyToSendEmail() { return !(StringUtils.isBlank(ApplicationUtils.getSmtpHost()) || StringUtils.isBlank(ApplicationUtils.getSmtpPort()) @@ -43,6 +47,10 @@ public static boolean isReadyToSendEmail() { /** * Sends an e-mail message from a SMTP host with a list of attached files. + * + * @param subject Mail subject + * @param message Mail content + * @param attachedFiles Attached files */ public static void sendEmailWithAttachment(String subject, String message, List attachedFiles) throws MessagingException { @@ -101,4 +109,22 @@ public PasswordAuthentication getPasswordAuthentication() { // sends the e-mail Transport.send(msg); } + + + /** + * Validate the given string as E-mail address. + * + * @param mailAddress Mail address + */ + public static boolean isValidEmailAddress(String mailAddress) { + boolean result = true; + try { + InternetAddress emailAddr = new InternetAddress(mailAddress); + emailAddr.validate(); + } catch (AddressException e) { + log.debug("Mail address is invalid: " + mailAddress, e); + result = false; + } + return result; + } } \ No newline at end of file diff --git a/src/main/java/org/t246osslab/easybuggy/core/utils/HTTPResponseCreator.java b/src/main/java/org/t246osslab/easybuggy/core/utils/HTTPResponseCreator.java deleted file mode 100644 index e9be638c..00000000 --- a/src/main/java/org/t246osslab/easybuggy/core/utils/HTTPResponseCreator.java +++ /dev/null @@ -1,88 +0,0 @@ -package org.t246osslab.easybuggy.core.utils; - -import java.io.PrintWriter; -import java.util.Locale; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import javax.servlet.http.HttpSession; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * Utility class to create a HTTP response. - */ -public final class HTTPResponseCreator { - - private static final Logger log = LoggerFactory.getLogger(HTTPResponseCreator.class); - - // squid:S1118: Utility classes should not have public constructors - private HTTPResponseCreator() { - throw new IllegalAccessError("Utility class"); - } - - /** - * Create a simple HTTP response. - * - * @param req HTTP servlet request. - * @param res HTTP servlet response. - * @param htmlTitle Title of HTML page. - * @param htmlBody Body of HTML page. - */ - public static void createSimpleResponse(HttpServletRequest req, HttpServletResponse res, String htmlTitle, String htmlBody) { - PrintWriter writer = null; - HttpSession session = req.getSession(); - Object userid = session.getAttribute("userid"); - Locale locale = req.getLocale(); - try { - writer = res.getWriter(); - writer.write(""); - writer.write(""); - if (htmlTitle != null) { - writer.write("" + htmlTitle + ""); - } - writer.write(""); - writer.write(""); - writer.write(""); - writer.write(""); - writer.write(""); - writer.write(""); - writer.write(""); - - writer.write(""); - writer.write(""); - writer.write(""); - writer.write(""); - if (userid != null && req.getServletPath().startsWith("/admins")) { - writer.write(""); - } else { - writer.write(""); - } - writer.write(""); - writer.write("
"); - writer.write("

"); - writer.write(" "); - if (htmlTitle != null) { - writer.write(htmlTitle); - } - writer.write("

"); - writer.write("
"); - writer.write(MessageUtils.getMsg("label.login.user.id", locale) + ": " + userid); - writer.write("
"); - writer.write("" + MessageUtils.getMsg("label.logout", locale) + ""); - writer.write("
"); - writer.write("" + MessageUtils.getMsg("label.go.to.main", locale) + ""); - writer.write("
"); - writer.write("
"); - writer.write(htmlBody); - writer.write(""); - writer.write(""); - - } catch (Exception e) { - log.error("Exception occurs: ", e); - } finally { - Closer.close(writer); - } - } -} diff --git a/src/main/java/org/t246osslab/easybuggy/core/utils/MessageUtils.java b/src/main/java/org/t246osslab/easybuggy/core/utils/MessageUtils.java deleted file mode 100644 index 483448c2..00000000 --- a/src/main/java/org/t246osslab/easybuggy/core/utils/MessageUtils.java +++ /dev/null @@ -1,86 +0,0 @@ -package org.t246osslab.easybuggy.core.utils; - -import java.text.MessageFormat; -import java.util.Locale; -import java.util.ResourceBundle; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * Utility class to provide message properties. - */ -public final class MessageUtils { - - private static final Logger log = LoggerFactory.getLogger(MessageUtils.class); - - // squid:S1118: Utility classes should not have public constructors - private MessageUtils() { - throw new IllegalAccessError("Utility class"); - } - - /** - * Return a message for a given property key. - * - * @return A message for a given property key - */ - public static String getMsg(String propertyKey, Locale locale) { - return getMsg(propertyKey, (Object[]) null, locale); - } - - /** - * Return an information message for a given property key. - * - * @return An information message for a given property key - */ - public static String getInfoMsg(String propertyKey, Locale locale) { - return getInfoMsg(propertyKey, (Object[]) null, locale); - } - - /** - * Return an error message for a given property key. - * - * @return An error message for a given property key - */ - public static String getErrMsg(String propertyKey, Locale locale) { - return getErrMsg(propertyKey, (Object[]) null, locale); - } - - /** - * Return a message for a given property key, replaced with placeholders. - * - * @return A message for a given property key, replaced with placeholders - */ - public static String getMsg(String propertyKey, Object[] placeholders, Locale locale) { - String propertyValue = null; - try { - propertyValue = ResourceBundle.getBundle("messages", locale).getString(propertyKey); - if (placeholders != null) { - propertyValue = MessageFormat.format(propertyValue, placeholders); - } - } catch (Exception e) { - log.error("Exception occurs: ", e); - } - return propertyValue; - } - - /** - * Return an information message for a given property key, replaced with placeholders. - * - * @return An information message for a given property key, replaced with placeholders - */ - public static String getInfoMsg(String propertyKey, Object[] placeholders, Locale locale) { - return "
  " - + getMsg(propertyKey, placeholders, locale) + "
"; - } - - /** - * Return an error message for a given property key, replaced with placeholders. - * - * @return An error message for a given property key, replaced with placeholders - */ - public static String getErrMsg(String propertyKey, Object[] placeholders, Locale locale) { - return "
  " - + getMsg(propertyKey, placeholders, locale) + "
"; - } -} diff --git a/src/main/java/org/t246osslab/easybuggy/core/utils/MultiPartFileUtils.java b/src/main/java/org/t246osslab/easybuggy/core/utils/MultiPartFileUtils.java new file mode 100644 index 00000000..a47d2869 --- /dev/null +++ b/src/main/java/org/t246osslab/easybuggy/core/utils/MultiPartFileUtils.java @@ -0,0 +1,64 @@ +package org.t246osslab.easybuggy.core.utils; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import javax.servlet.http.Part; +import java.io.*; + +/** + * Utility class to handle multi part files. + */ +public final class MultiPartFileUtils { + + private static final Logger log = LoggerFactory.getLogger(MultiPartFileUtils.class); + + // squid:S1118: Utility classes should not have public constructors + private MultiPartFileUtils() { + throw new IllegalAccessError("Utility class"); + } + + /** + * Write uploaded file to the given path. + * + * @param part A part or form item that was received within a multipart/form-data POST request. + * @param savePath Path to save an uploaded file. + * @param fileName The uploaded file name. + */ + public static boolean writeFile(Part part, String savePath, String fileName) throws IOException { + boolean isConverted = false; + OutputStream out = null; + InputStream in = null; + try { + out = new FileOutputStream(savePath + File.separator + fileName); + in = part.getInputStream(); + int read; + final byte[] bytes = new byte[1024]; + while ((read = in.read(bytes)) != -1) { + out.write(bytes, 0, read); + } + } catch (FileNotFoundException e) { + // Ignore because file already exists (converted and Windows locked the file) + log.debug("Exception occurs: ", e); + isConverted = true; + } finally { + Closer.close(out, in); + } + return isConverted; + } + + + /** + * Retrieves file name of a upload part from its HTTP header + * + * @param part A part or form item that was received within a multipart/form-data POST request. + */ + public static String getFileName(final Part part) { + for (String content : part.getHeader("content-disposition").split(";")) { + if (content.trim().startsWith("filename")) { + return content.substring(content.indexOf('=') + 1).trim().replace("\"", ""); + } + } + return null; + } +} diff --git a/src/main/java/org/t246osslab/easybuggy/errors/AssertionErrorServlet.java b/src/main/java/org/t246osslab/easybuggy/errors/AssertionErrorServlet.java index aca935b4..a13ab18c 100644 --- a/src/main/java/org/t246osslab/easybuggy/errors/AssertionErrorServlet.java +++ b/src/main/java/org/t246osslab/easybuggy/errors/AssertionErrorServlet.java @@ -4,13 +4,14 @@ import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; -import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; +import org.t246osslab.easybuggy.core.servlets.AbstractServlet; + @SuppressWarnings("serial") @WebServlet(urlPatterns = { "/asserr" }) -public class AssertionErrorServlet extends HttpServlet { +public class AssertionErrorServlet extends AbstractServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { diff --git a/src/main/java/org/t246osslab/easybuggy/errors/ExceptionInInitializerErrorServlet.java b/src/main/java/org/t246osslab/easybuggy/errors/ExceptionInInitializerErrorServlet.java index 2ce09a49..e276f6d1 100644 --- a/src/main/java/org/t246osslab/easybuggy/errors/ExceptionInInitializerErrorServlet.java +++ b/src/main/java/org/t246osslab/easybuggy/errors/ExceptionInInitializerErrorServlet.java @@ -5,18 +5,15 @@ import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; -import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.t246osslab.easybuggy.core.servlets.AbstractServlet; @SuppressWarnings("serial") @WebServlet(urlPatterns = { "/eie" }) -public class ExceptionInInitializerErrorServlet extends HttpServlet { - - private static final Logger log = LoggerFactory.getLogger(ExceptionInInitializerErrorServlet.class); +public class ExceptionInInitializerErrorServlet extends AbstractServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { diff --git a/src/main/java/org/t246osslab/easybuggy/errors/FactoryConfigurationErrorServlet.java b/src/main/java/org/t246osslab/easybuggy/errors/FactoryConfigurationErrorServlet.java index 4a9a613b..9d82a160 100644 --- a/src/main/java/org/t246osslab/easybuggy/errors/FactoryConfigurationErrorServlet.java +++ b/src/main/java/org/t246osslab/easybuggy/errors/FactoryConfigurationErrorServlet.java @@ -4,14 +4,15 @@ import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; -import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.xml.parsers.SAXParserFactory; +import org.t246osslab.easybuggy.core.servlets.AbstractServlet; + @SuppressWarnings("serial") @WebServlet(urlPatterns = { "/fce" }) -public class FactoryConfigurationErrorServlet extends HttpServlet { +public class FactoryConfigurationErrorServlet extends AbstractServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { diff --git a/src/main/java/org/t246osslab/easybuggy/errors/GenericSignatureFormatErrorServlet.java b/src/main/java/org/t246osslab/easybuggy/errors/GenericSignatureFormatErrorServlet.java index be27aa07..9fbd569e 100644 --- a/src/main/java/org/t246osslab/easybuggy/errors/GenericSignatureFormatErrorServlet.java +++ b/src/main/java/org/t246osslab/easybuggy/errors/GenericSignatureFormatErrorServlet.java @@ -4,13 +4,14 @@ import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; -import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; +import org.t246osslab.easybuggy.core.servlets.AbstractServlet; + @SuppressWarnings("serial") @WebServlet(urlPatterns = { "/gsfe" }) -public class GenericSignatureFormatErrorServlet extends HttpServlet { +public class GenericSignatureFormatErrorServlet extends AbstractServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { diff --git a/src/main/java/org/t246osslab/easybuggy/errors/NoClassDefFoundErrorServlet.java b/src/main/java/org/t246osslab/easybuggy/errors/NoClassDefFoundErrorServlet.java index fa32c223..a8735828 100644 --- a/src/main/java/org/t246osslab/easybuggy/errors/NoClassDefFoundErrorServlet.java +++ b/src/main/java/org/t246osslab/easybuggy/errors/NoClassDefFoundErrorServlet.java @@ -4,15 +4,15 @@ import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; -import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; +import org.t246osslab.easybuggy.core.servlets.AbstractServlet; import org.t246osslab.easybuggy.core.utils.DeleteClassWhileMavenBuild; @SuppressWarnings("serial") @WebServlet(urlPatterns = { "/ncdfe" }) -public class NoClassDefFoundErrorServlet extends HttpServlet { +public class NoClassDefFoundErrorServlet extends AbstractServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { diff --git a/src/main/java/org/t246osslab/easybuggy/errors/OutOfMemoryErrorServlet.java b/src/main/java/org/t246osslab/easybuggy/errors/OutOfMemoryErrorServlet.java index fc6099ab..9d12664f 100644 --- a/src/main/java/org/t246osslab/easybuggy/errors/OutOfMemoryErrorServlet.java +++ b/src/main/java/org/t246osslab/easybuggy/errors/OutOfMemoryErrorServlet.java @@ -4,13 +4,14 @@ import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; -import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; +import org.t246osslab.easybuggy.core.servlets.AbstractServlet; + @SuppressWarnings("serial") @WebServlet(urlPatterns = { "/oome" }) -public class OutOfMemoryErrorServlet extends HttpServlet { +public class OutOfMemoryErrorServlet extends AbstractServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { diff --git a/src/main/java/org/t246osslab/easybuggy/errors/OutOfMemoryErrorServlet2.java b/src/main/java/org/t246osslab/easybuggy/errors/OutOfMemoryErrorServlet2.java index 11493be8..a9dda74e 100644 --- a/src/main/java/org/t246osslab/easybuggy/errors/OutOfMemoryErrorServlet2.java +++ b/src/main/java/org/t246osslab/easybuggy/errors/OutOfMemoryErrorServlet2.java @@ -4,13 +4,14 @@ import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; -import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; +import org.t246osslab.easybuggy.core.servlets.AbstractServlet; + @SuppressWarnings("serial") @WebServlet(urlPatterns = { "/oome2" }) -public class OutOfMemoryErrorServlet2 extends HttpServlet { +public class OutOfMemoryErrorServlet2 extends AbstractServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { diff --git a/src/main/java/org/t246osslab/easybuggy/errors/OutOfMemoryErrorServlet3.java b/src/main/java/org/t246osslab/easybuggy/errors/OutOfMemoryErrorServlet3.java index a8550493..7ac79718 100644 --- a/src/main/java/org/t246osslab/easybuggy/errors/OutOfMemoryErrorServlet3.java +++ b/src/main/java/org/t246osslab/easybuggy/errors/OutOfMemoryErrorServlet3.java @@ -4,25 +4,21 @@ import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; -import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; +import org.t246osslab.easybuggy.core.servlets.AbstractServlet; @SuppressWarnings("serial") @WebServlet(urlPatterns = { "/oome3" }) -public class OutOfMemoryErrorServlet3 extends HttpServlet { - - private static final Logger log = LoggerFactory.getLogger(OutOfMemoryErrorServlet3.class); +public class OutOfMemoryErrorServlet3 extends AbstractServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { while (true) { new Thread() { - @Override + @Override public void run() { try { Thread.sleep(10000); diff --git a/src/main/java/org/t246osslab/easybuggy/errors/OutOfMemoryErrorServlet4.java b/src/main/java/org/t246osslab/easybuggy/errors/OutOfMemoryErrorServlet4.java index 106aa205..ea09509c 100644 --- a/src/main/java/org/t246osslab/easybuggy/errors/OutOfMemoryErrorServlet4.java +++ b/src/main/java/org/t246osslab/easybuggy/errors/OutOfMemoryErrorServlet4.java @@ -6,13 +6,14 @@ import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; -import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; +import org.t246osslab.easybuggy.core.servlets.AbstractServlet; + @SuppressWarnings("serial") @WebServlet(urlPatterns = { "/oome4" }) -public class OutOfMemoryErrorServlet4 extends HttpServlet { +public class OutOfMemoryErrorServlet4 extends AbstractServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { diff --git a/src/main/java/org/t246osslab/easybuggy/errors/OutOfMemoryErrorServlet5.java b/src/main/java/org/t246osslab/easybuggy/errors/OutOfMemoryErrorServlet5.java index 62d09280..adfa90bb 100644 --- a/src/main/java/org/t246osslab/easybuggy/errors/OutOfMemoryErrorServlet5.java +++ b/src/main/java/org/t246osslab/easybuggy/errors/OutOfMemoryErrorServlet5.java @@ -6,18 +6,14 @@ import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; -import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; +import org.t246osslab.easybuggy.core.servlets.AbstractServlet; @SuppressWarnings("serial") @WebServlet(urlPatterns = { "/oome5" }) -public class OutOfMemoryErrorServlet5 extends HttpServlet { - - private static final Logger log = LoggerFactory.getLogger(OutOfMemoryErrorServlet5.class); +public class OutOfMemoryErrorServlet5 extends AbstractServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { diff --git a/src/main/java/org/t246osslab/easybuggy/errors/OutOfMemoryErrorServlet6.java b/src/main/java/org/t246osslab/easybuggy/errors/OutOfMemoryErrorServlet6.java index a157749c..4a27784d 100644 --- a/src/main/java/org/t246osslab/easybuggy/errors/OutOfMemoryErrorServlet6.java +++ b/src/main/java/org/t246osslab/easybuggy/errors/OutOfMemoryErrorServlet6.java @@ -5,13 +5,14 @@ import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; -import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; +import org.t246osslab.easybuggy.core.servlets.AbstractServlet; + @SuppressWarnings("serial") @WebServlet(urlPatterns = { "/oome6" }) -public class OutOfMemoryErrorServlet6 extends HttpServlet { +public class OutOfMemoryErrorServlet6 extends AbstractServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { diff --git a/src/main/java/org/t246osslab/easybuggy/errors/StackOverflowErrorServlet.java b/src/main/java/org/t246osslab/easybuggy/errors/StackOverflowErrorServlet.java index 03dcffd0..1dd60ec3 100644 --- a/src/main/java/org/t246osslab/easybuggy/errors/StackOverflowErrorServlet.java +++ b/src/main/java/org/t246osslab/easybuggy/errors/StackOverflowErrorServlet.java @@ -4,13 +4,14 @@ import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; -import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; +import org.t246osslab.easybuggy.core.servlets.AbstractServlet; + @WebServlet(urlPatterns = { "/sofe" }) @SuppressWarnings("serial") -public class StackOverflowErrorServlet extends HttpServlet { +public class StackOverflowErrorServlet extends AbstractServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { diff --git a/src/main/java/org/t246osslab/easybuggy/errors/TransformerFactoryConfigurationErrorServlet.java b/src/main/java/org/t246osslab/easybuggy/errors/TransformerFactoryConfigurationErrorServlet.java index b8f63660..05d3872c 100644 --- a/src/main/java/org/t246osslab/easybuggy/errors/TransformerFactoryConfigurationErrorServlet.java +++ b/src/main/java/org/t246osslab/easybuggy/errors/TransformerFactoryConfigurationErrorServlet.java @@ -4,14 +4,15 @@ import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; -import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.xml.transform.TransformerFactory; +import org.t246osslab.easybuggy.core.servlets.AbstractServlet; + @SuppressWarnings("serial") @WebServlet(urlPatterns = { "/tfce" }) -public class TransformerFactoryConfigurationErrorServlet extends HttpServlet { +public class TransformerFactoryConfigurationErrorServlet extends AbstractServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { diff --git a/src/main/java/org/t246osslab/easybuggy/errors/UnsatisfiedLinkErrorServlet.java b/src/main/java/org/t246osslab/easybuggy/errors/UnsatisfiedLinkErrorServlet.java index 2da58f11..950531b3 100644 --- a/src/main/java/org/t246osslab/easybuggy/errors/UnsatisfiedLinkErrorServlet.java +++ b/src/main/java/org/t246osslab/easybuggy/errors/UnsatisfiedLinkErrorServlet.java @@ -6,16 +6,17 @@ import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; -import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; +import org.t246osslab.easybuggy.core.servlets.AbstractServlet; + /** * This servlet causes a JNI error. */ @WebServlet(urlPatterns = { "/jnicall" }) @SuppressWarnings("serial") -public class UnsatisfiedLinkErrorServlet extends HttpServlet { +public class UnsatisfiedLinkErrorServlet extends AbstractServlet { private static native NetworkInterface getByName0(String name) throws SocketException; diff --git a/src/main/java/org/t246osslab/easybuggy/exceptions/ArithmeticExceptionServlet.java b/src/main/java/org/t246osslab/easybuggy/exceptions/ArithmeticExceptionServlet.java index 44845a57..c64107a5 100644 --- a/src/main/java/org/t246osslab/easybuggy/exceptions/ArithmeticExceptionServlet.java +++ b/src/main/java/org/t246osslab/easybuggy/exceptions/ArithmeticExceptionServlet.java @@ -4,13 +4,14 @@ import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; -import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; +import org.t246osslab.easybuggy.core.servlets.AbstractServlet; + @SuppressWarnings("serial") @WebServlet(urlPatterns = { "/ae" }) -public class ArithmeticExceptionServlet extends HttpServlet { +public class ArithmeticExceptionServlet extends AbstractServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { diff --git a/src/main/java/org/t246osslab/easybuggy/exceptions/ArrayIndexOutOfBoundsExceptionServlet.java b/src/main/java/org/t246osslab/easybuggy/exceptions/ArrayIndexOutOfBoundsExceptionServlet.java index 24ec8278..1d45d440 100644 --- a/src/main/java/org/t246osslab/easybuggy/exceptions/ArrayIndexOutOfBoundsExceptionServlet.java +++ b/src/main/java/org/t246osslab/easybuggy/exceptions/ArrayIndexOutOfBoundsExceptionServlet.java @@ -4,13 +4,14 @@ import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; -import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; +import org.t246osslab.easybuggy.core.servlets.AbstractServlet; + @SuppressWarnings("serial") @WebServlet(urlPatterns = { "/aioobe" }) -public class ArrayIndexOutOfBoundsExceptionServlet extends HttpServlet { +public class ArrayIndexOutOfBoundsExceptionServlet extends AbstractServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { diff --git a/src/main/java/org/t246osslab/easybuggy/exceptions/ArrayStoreExceptionServlet.java b/src/main/java/org/t246osslab/easybuggy/exceptions/ArrayStoreExceptionServlet.java index 7e40b446..485794ce 100644 --- a/src/main/java/org/t246osslab/easybuggy/exceptions/ArrayStoreExceptionServlet.java +++ b/src/main/java/org/t246osslab/easybuggy/exceptions/ArrayStoreExceptionServlet.java @@ -4,13 +4,14 @@ import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; -import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; +import org.t246osslab.easybuggy.core.servlets.AbstractServlet; + @SuppressWarnings("serial") @WebServlet(urlPatterns = { "/ase" }) -public class ArrayStoreExceptionServlet extends HttpServlet { +public class ArrayStoreExceptionServlet extends AbstractServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { diff --git a/src/main/java/org/t246osslab/easybuggy/exceptions/BufferOverflowExceptionServlet.java b/src/main/java/org/t246osslab/easybuggy/exceptions/BufferOverflowExceptionServlet.java index 2faf1cde..165c819a 100644 --- a/src/main/java/org/t246osslab/easybuggy/exceptions/BufferOverflowExceptionServlet.java +++ b/src/main/java/org/t246osslab/easybuggy/exceptions/BufferOverflowExceptionServlet.java @@ -10,19 +10,15 @@ import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; -import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; +import org.t246osslab.easybuggy.core.servlets.AbstractServlet; import org.t246osslab.easybuggy.core.utils.Closer; @SuppressWarnings("serial") -@WebServlet(urlPatterns = { "/boe" }) -public class BufferOverflowExceptionServlet extends HttpServlet { - - private static final Logger log = LoggerFactory.getLogger(BufferOverflowExceptionServlet.class); +@WebServlet(urlPatterns = {"/boe"}) +public class BufferOverflowExceptionServlet extends AbstractServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { diff --git a/src/main/java/org/t246osslab/easybuggy/exceptions/BufferUnderflowExceptionServlet.java b/src/main/java/org/t246osslab/easybuggy/exceptions/BufferUnderflowExceptionServlet.java index c04afad6..aec58a1a 100644 --- a/src/main/java/org/t246osslab/easybuggy/exceptions/BufferUnderflowExceptionServlet.java +++ b/src/main/java/org/t246osslab/easybuggy/exceptions/BufferUnderflowExceptionServlet.java @@ -5,13 +5,14 @@ import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; -import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; +import org.t246osslab.easybuggy.core.servlets.AbstractServlet; + @SuppressWarnings("serial") @WebServlet(urlPatterns = { "/bue" }) -public class BufferUnderflowExceptionServlet extends HttpServlet { +public class BufferUnderflowExceptionServlet extends AbstractServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { diff --git a/src/main/java/org/t246osslab/easybuggy/exceptions/CannotRedoExceptionServlet.java b/src/main/java/org/t246osslab/easybuggy/exceptions/CannotRedoExceptionServlet.java index ffb27040..4d912fb7 100644 --- a/src/main/java/org/t246osslab/easybuggy/exceptions/CannotRedoExceptionServlet.java +++ b/src/main/java/org/t246osslab/easybuggy/exceptions/CannotRedoExceptionServlet.java @@ -4,14 +4,15 @@ import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; -import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.swing.undo.UndoManager; +import org.t246osslab.easybuggy.core.servlets.AbstractServlet; + @SuppressWarnings("serial") @WebServlet(urlPatterns = { "/cre" }) -public class CannotRedoExceptionServlet extends HttpServlet { +public class CannotRedoExceptionServlet extends AbstractServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { diff --git a/src/main/java/org/t246osslab/easybuggy/exceptions/CannotUndoExceptionServlet.java b/src/main/java/org/t246osslab/easybuggy/exceptions/CannotUndoExceptionServlet.java index 1301f0bc..84a9ad78 100644 --- a/src/main/java/org/t246osslab/easybuggy/exceptions/CannotUndoExceptionServlet.java +++ b/src/main/java/org/t246osslab/easybuggy/exceptions/CannotUndoExceptionServlet.java @@ -4,14 +4,15 @@ import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; -import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.swing.undo.UndoManager; +import org.t246osslab.easybuggy.core.servlets.AbstractServlet; + @SuppressWarnings("serial") @WebServlet(urlPatterns = { "/cue" }) -public class CannotUndoExceptionServlet extends HttpServlet { +public class CannotUndoExceptionServlet extends AbstractServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { diff --git a/src/main/java/org/t246osslab/easybuggy/exceptions/ClassCastExceptionServlet.java b/src/main/java/org/t246osslab/easybuggy/exceptions/ClassCastExceptionServlet.java index ec196ced..69195a07 100644 --- a/src/main/java/org/t246osslab/easybuggy/exceptions/ClassCastExceptionServlet.java +++ b/src/main/java/org/t246osslab/easybuggy/exceptions/ClassCastExceptionServlet.java @@ -4,13 +4,14 @@ import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; -import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; +import org.t246osslab.easybuggy.core.servlets.AbstractServlet; + @SuppressWarnings("serial") @WebServlet(urlPatterns = { "/cce" }) -public class ClassCastExceptionServlet extends HttpServlet { +public class ClassCastExceptionServlet extends AbstractServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { diff --git a/src/main/java/org/t246osslab/easybuggy/exceptions/ConcurrentModificationExceptionServlet.java b/src/main/java/org/t246osslab/easybuggy/exceptions/ConcurrentModificationExceptionServlet.java index d7688404..ab427fe9 100644 --- a/src/main/java/org/t246osslab/easybuggy/exceptions/ConcurrentModificationExceptionServlet.java +++ b/src/main/java/org/t246osslab/easybuggy/exceptions/ConcurrentModificationExceptionServlet.java @@ -7,13 +7,14 @@ import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; -import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; +import org.t246osslab.easybuggy.core.servlets.AbstractServlet; + @SuppressWarnings("serial") @WebServlet(urlPatterns = { "/cme" }) -public class ConcurrentModificationExceptionServlet extends HttpServlet { +public class ConcurrentModificationExceptionServlet extends AbstractServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { diff --git a/src/main/java/org/t246osslab/easybuggy/exceptions/EmptyStackExceptionServlet.java b/src/main/java/org/t246osslab/easybuggy/exceptions/EmptyStackExceptionServlet.java index 8e5aaed5..85a25f0b 100644 --- a/src/main/java/org/t246osslab/easybuggy/exceptions/EmptyStackExceptionServlet.java +++ b/src/main/java/org/t246osslab/easybuggy/exceptions/EmptyStackExceptionServlet.java @@ -5,18 +5,14 @@ import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; -import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; +import org.t246osslab.easybuggy.core.servlets.AbstractServlet; @SuppressWarnings("serial") @WebServlet(urlPatterns = { "/ese" }) -public class EmptyStackExceptionServlet extends HttpServlet { - - private static final Logger log = LoggerFactory.getLogger(EmptyStackExceptionServlet.class); +public class EmptyStackExceptionServlet extends AbstractServlet { @Override protected void service(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { diff --git a/src/main/java/org/t246osslab/easybuggy/exceptions/IllegalArgumentExceptionServlet.java b/src/main/java/org/t246osslab/easybuggy/exceptions/IllegalArgumentExceptionServlet.java index ecac63e6..a948fa6e 100644 --- a/src/main/java/org/t246osslab/easybuggy/exceptions/IllegalArgumentExceptionServlet.java +++ b/src/main/java/org/t246osslab/easybuggy/exceptions/IllegalArgumentExceptionServlet.java @@ -5,13 +5,14 @@ import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; -import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; +import org.t246osslab.easybuggy.core.servlets.AbstractServlet; + @SuppressWarnings("serial") @WebServlet(urlPatterns = { "/iae" }) -public class IllegalArgumentExceptionServlet extends HttpServlet { +public class IllegalArgumentExceptionServlet extends AbstractServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { diff --git a/src/main/java/org/t246osslab/easybuggy/exceptions/IllegalMonitorStateExceptionServlet.java b/src/main/java/org/t246osslab/easybuggy/exceptions/IllegalMonitorStateExceptionServlet.java index 4d259cc2..fae9fb5d 100644 --- a/src/main/java/org/t246osslab/easybuggy/exceptions/IllegalMonitorStateExceptionServlet.java +++ b/src/main/java/org/t246osslab/easybuggy/exceptions/IllegalMonitorStateExceptionServlet.java @@ -4,18 +4,14 @@ import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; -import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; +import org.t246osslab.easybuggy.core.servlets.AbstractServlet; @SuppressWarnings("serial") @WebServlet(urlPatterns = { "/imse" }) -public class IllegalMonitorStateExceptionServlet extends HttpServlet { - - private static final Logger log = LoggerFactory.getLogger(IllegalMonitorStateExceptionServlet.class); +public class IllegalMonitorStateExceptionServlet extends AbstractServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { diff --git a/src/main/java/org/t246osslab/easybuggy/exceptions/IllegalPathStateExceptionServlet.java b/src/main/java/org/t246osslab/easybuggy/exceptions/IllegalPathStateExceptionServlet.java index 4bf14b14..2eb483d1 100644 --- a/src/main/java/org/t246osslab/easybuggy/exceptions/IllegalPathStateExceptionServlet.java +++ b/src/main/java/org/t246osslab/easybuggy/exceptions/IllegalPathStateExceptionServlet.java @@ -5,13 +5,14 @@ import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; -import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; +import org.t246osslab.easybuggy.core.servlets.AbstractServlet; + @SuppressWarnings("serial") @WebServlet(urlPatterns = { "/ipse" }) -public class IllegalPathStateExceptionServlet extends HttpServlet { +public class IllegalPathStateExceptionServlet extends AbstractServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { diff --git a/src/main/java/org/t246osslab/easybuggy/exceptions/IllegalStateExceptionServlet.java b/src/main/java/org/t246osslab/easybuggy/exceptions/IllegalStateExceptionServlet.java index add2a7fd..38ca3158 100644 --- a/src/main/java/org/t246osslab/easybuggy/exceptions/IllegalStateExceptionServlet.java +++ b/src/main/java/org/t246osslab/easybuggy/exceptions/IllegalStateExceptionServlet.java @@ -8,13 +8,14 @@ import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; -import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; +import org.t246osslab.easybuggy.core.servlets.AbstractServlet; + @SuppressWarnings("serial") @WebServlet(urlPatterns = { "/iase" }) -public class IllegalStateExceptionServlet extends HttpServlet { +public class IllegalStateExceptionServlet extends AbstractServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { diff --git a/src/main/java/org/t246osslab/easybuggy/exceptions/IllegalThreadStateExceptionServlet.java b/src/main/java/org/t246osslab/easybuggy/exceptions/IllegalThreadStateExceptionServlet.java index 7277faac..3a4cdd62 100644 --- a/src/main/java/org/t246osslab/easybuggy/exceptions/IllegalThreadStateExceptionServlet.java +++ b/src/main/java/org/t246osslab/easybuggy/exceptions/IllegalThreadStateExceptionServlet.java @@ -4,13 +4,14 @@ import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; -import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; +import org.t246osslab.easybuggy.core.servlets.AbstractServlet; + @SuppressWarnings("serial") @WebServlet(urlPatterns = { "/itse" }) -public class IllegalThreadStateExceptionServlet extends HttpServlet { +public class IllegalThreadStateExceptionServlet extends AbstractServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { diff --git a/src/main/java/org/t246osslab/easybuggy/exceptions/ImagingOpExceptionServlet.java b/src/main/java/org/t246osslab/easybuggy/exceptions/ImagingOpExceptionServlet.java index acebfd9c..3d2dff40 100644 --- a/src/main/java/org/t246osslab/easybuggy/exceptions/ImagingOpExceptionServlet.java +++ b/src/main/java/org/t246osslab/easybuggy/exceptions/ImagingOpExceptionServlet.java @@ -7,13 +7,14 @@ import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; -import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; +import org.t246osslab.easybuggy.core.servlets.AbstractServlet; + @SuppressWarnings("serial") @WebServlet(urlPatterns = { "/imoe" }) -public class ImagingOpExceptionServlet extends HttpServlet { +public class ImagingOpExceptionServlet extends AbstractServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { diff --git a/src/main/java/org/t246osslab/easybuggy/exceptions/IndexOutOfBoundsExceptionServlet.java b/src/main/java/org/t246osslab/easybuggy/exceptions/IndexOutOfBoundsExceptionServlet.java index 195e693e..2b3fc5db 100644 --- a/src/main/java/org/t246osslab/easybuggy/exceptions/IndexOutOfBoundsExceptionServlet.java +++ b/src/main/java/org/t246osslab/easybuggy/exceptions/IndexOutOfBoundsExceptionServlet.java @@ -5,13 +5,14 @@ import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; -import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; +import org.t246osslab.easybuggy.core.servlets.AbstractServlet; + @SuppressWarnings("serial") @WebServlet(urlPatterns = { "/ioobe" }) -public class IndexOutOfBoundsExceptionServlet extends HttpServlet { +public class IndexOutOfBoundsExceptionServlet extends AbstractServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { diff --git a/src/main/java/org/t246osslab/easybuggy/exceptions/InputMismatchExceptionServlet.java b/src/main/java/org/t246osslab/easybuggy/exceptions/InputMismatchExceptionServlet.java index 5812ef58..e4ec616c 100644 --- a/src/main/java/org/t246osslab/easybuggy/exceptions/InputMismatchExceptionServlet.java +++ b/src/main/java/org/t246osslab/easybuggy/exceptions/InputMismatchExceptionServlet.java @@ -5,13 +5,14 @@ import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; -import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; +import org.t246osslab.easybuggy.core.servlets.AbstractServlet; + @SuppressWarnings("serial") @WebServlet(urlPatterns = { "/ime" }) -public class InputMismatchExceptionServlet extends HttpServlet { +public class InputMismatchExceptionServlet extends AbstractServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { diff --git a/src/main/java/org/t246osslab/easybuggy/exceptions/MalformedParameterizedTypeExceptionServlet.java b/src/main/java/org/t246osslab/easybuggy/exceptions/MalformedParameterizedTypeExceptionServlet.java index 11b6d38d..ae70ca17 100644 --- a/src/main/java/org/t246osslab/easybuggy/exceptions/MalformedParameterizedTypeExceptionServlet.java +++ b/src/main/java/org/t246osslab/easybuggy/exceptions/MalformedParameterizedTypeExceptionServlet.java @@ -6,15 +6,16 @@ import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; -import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; +import org.t246osslab.easybuggy.core.servlets.AbstractServlet; + import sun.reflect.generics.reflectiveObjects.ParameterizedTypeImpl; @SuppressWarnings("serial") @WebServlet(urlPatterns = { "/mpte" }) -public class MalformedParameterizedTypeExceptionServlet extends HttpServlet { +public class MalformedParameterizedTypeExceptionServlet extends AbstractServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { diff --git a/src/main/java/org/t246osslab/easybuggy/exceptions/MissingResourceExceptionServlet.java b/src/main/java/org/t246osslab/easybuggy/exceptions/MissingResourceExceptionServlet.java index d09a1cf4..9868512f 100644 --- a/src/main/java/org/t246osslab/easybuggy/exceptions/MissingResourceExceptionServlet.java +++ b/src/main/java/org/t246osslab/easybuggy/exceptions/MissingResourceExceptionServlet.java @@ -5,13 +5,14 @@ import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; -import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; +import org.t246osslab.easybuggy.core.servlets.AbstractServlet; + @SuppressWarnings("serial") @WebServlet(urlPatterns = { "/mre" }) -public class MissingResourceExceptionServlet extends HttpServlet { +public class MissingResourceExceptionServlet extends AbstractServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { diff --git a/src/main/java/org/t246osslab/easybuggy/exceptions/NegativeArraySizeExceptionServlet.java b/src/main/java/org/t246osslab/easybuggy/exceptions/NegativeArraySizeExceptionServlet.java index 7a2e1560..783964ab 100644 --- a/src/main/java/org/t246osslab/easybuggy/exceptions/NegativeArraySizeExceptionServlet.java +++ b/src/main/java/org/t246osslab/easybuggy/exceptions/NegativeArraySizeExceptionServlet.java @@ -4,13 +4,14 @@ import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; -import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; +import org.t246osslab.easybuggy.core.servlets.AbstractServlet; + @SuppressWarnings("serial") @WebServlet(urlPatterns = { "/nase" }) -public class NegativeArraySizeExceptionServlet extends HttpServlet { +public class NegativeArraySizeExceptionServlet extends AbstractServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { diff --git a/src/main/java/org/t246osslab/easybuggy/exceptions/NoSuchElementExceptionServlet.java b/src/main/java/org/t246osslab/easybuggy/exceptions/NoSuchElementExceptionServlet.java index aa78b95c..21cfed56 100644 --- a/src/main/java/org/t246osslab/easybuggy/exceptions/NoSuchElementExceptionServlet.java +++ b/src/main/java/org/t246osslab/easybuggy/exceptions/NoSuchElementExceptionServlet.java @@ -5,13 +5,14 @@ import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; -import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; +import org.t246osslab.easybuggy.core.servlets.AbstractServlet; + @SuppressWarnings("serial") @WebServlet(urlPatterns = { "/nsee" }) -public class NoSuchElementExceptionServlet extends HttpServlet { +public class NoSuchElementExceptionServlet extends AbstractServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { diff --git a/src/main/java/org/t246osslab/easybuggy/exceptions/NullPointerExceptionServlet.java b/src/main/java/org/t246osslab/easybuggy/exceptions/NullPointerExceptionServlet.java index e2fcfd3c..ffd1937a 100644 --- a/src/main/java/org/t246osslab/easybuggy/exceptions/NullPointerExceptionServlet.java +++ b/src/main/java/org/t246osslab/easybuggy/exceptions/NullPointerExceptionServlet.java @@ -4,13 +4,14 @@ import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; -import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; +import org.t246osslab.easybuggy.core.servlets.AbstractServlet; + @SuppressWarnings("serial") @WebServlet(urlPatterns = { "/npe" }) -public class NullPointerExceptionServlet extends HttpServlet { +public class NullPointerExceptionServlet extends AbstractServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { diff --git a/src/main/java/org/t246osslab/easybuggy/exceptions/NumberFormatExceptionServlet.java b/src/main/java/org/t246osslab/easybuggy/exceptions/NumberFormatExceptionServlet.java index b493bd81..7ce3f452 100644 --- a/src/main/java/org/t246osslab/easybuggy/exceptions/NumberFormatExceptionServlet.java +++ b/src/main/java/org/t246osslab/easybuggy/exceptions/NumberFormatExceptionServlet.java @@ -4,13 +4,14 @@ import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; -import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; +import org.t246osslab.easybuggy.core.servlets.AbstractServlet; + @SuppressWarnings("serial") @WebServlet(urlPatterns = { "/nfe" }) -public class NumberFormatExceptionServlet extends HttpServlet { +public class NumberFormatExceptionServlet extends AbstractServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { diff --git a/src/main/java/org/t246osslab/easybuggy/exceptions/SecurityExceptionServlet.java b/src/main/java/org/t246osslab/easybuggy/exceptions/SecurityExceptionServlet.java index bdd97514..051fb2cf 100644 --- a/src/main/java/org/t246osslab/easybuggy/exceptions/SecurityExceptionServlet.java +++ b/src/main/java/org/t246osslab/easybuggy/exceptions/SecurityExceptionServlet.java @@ -4,13 +4,14 @@ import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; -import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; +import org.t246osslab.easybuggy.core.servlets.AbstractServlet; + @SuppressWarnings("serial") @WebServlet(urlPatterns = { "/se" }) -public class SecurityExceptionServlet extends HttpServlet { +public class SecurityExceptionServlet extends AbstractServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { diff --git a/src/main/java/org/t246osslab/easybuggy/exceptions/UnsupportedCharsetExceptionServlet.java b/src/main/java/org/t246osslab/easybuggy/exceptions/UnsupportedCharsetExceptionServlet.java index 2222b185..8e1a08b8 100644 --- a/src/main/java/org/t246osslab/easybuggy/exceptions/UnsupportedCharsetExceptionServlet.java +++ b/src/main/java/org/t246osslab/easybuggy/exceptions/UnsupportedCharsetExceptionServlet.java @@ -5,13 +5,14 @@ import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; -import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; +import org.t246osslab.easybuggy.core.servlets.AbstractServlet; + @SuppressWarnings("serial") @WebServlet(urlPatterns = { "/uce" }) -public class UnsupportedCharsetExceptionServlet extends HttpServlet { +public class UnsupportedCharsetExceptionServlet extends AbstractServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { diff --git a/src/main/java/org/t246osslab/easybuggy/exceptions/UnsupportedOperationExceptionServlet.java b/src/main/java/org/t246osslab/easybuggy/exceptions/UnsupportedOperationExceptionServlet.java index f5e858a3..1797ebc3 100644 --- a/src/main/java/org/t246osslab/easybuggy/exceptions/UnsupportedOperationExceptionServlet.java +++ b/src/main/java/org/t246osslab/easybuggy/exceptions/UnsupportedOperationExceptionServlet.java @@ -7,13 +7,14 @@ import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; -import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; +import org.t246osslab.easybuggy.core.servlets.AbstractServlet; + @SuppressWarnings("serial") @WebServlet(urlPatterns = { "/uoe" }) -public class UnsupportedOperationExceptionServlet extends HttpServlet { +public class UnsupportedOperationExceptionServlet extends AbstractServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { diff --git a/src/main/java/org/t246osslab/easybuggy/performance/CreatingUnnecessaryObjectsServlet.java b/src/main/java/org/t246osslab/easybuggy/performance/CreatingUnnecessaryObjectsServlet.java index 1dafc4f0..e4ca285c 100644 --- a/src/main/java/org/t246osslab/easybuggy/performance/CreatingUnnecessaryObjectsServlet.java +++ b/src/main/java/org/t246osslab/easybuggy/performance/CreatingUnnecessaryObjectsServlet.java @@ -5,21 +5,15 @@ import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; -import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.commons.lang.math.NumberUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.t246osslab.easybuggy.core.utils.HTTPResponseCreator; -import org.t246osslab.easybuggy.core.utils.MessageUtils; +import org.t246osslab.easybuggy.core.servlets.AbstractServlet; @SuppressWarnings("serial") @WebServlet(urlPatterns = { "/createobjects" }) -public class CreatingUnnecessaryObjectsServlet extends HttpServlet { - - private static final Logger log = LoggerFactory.getLogger(CreatingUnnecessaryObjectsServlet.class); +public class CreatingUnnecessaryObjectsServlet extends AbstractServlet { @Override protected void service(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { @@ -28,7 +22,7 @@ protected void service(HttpServletRequest req, HttpServletResponse res) throws S int number = NumberUtils.toInt(strNumber, -1); StringBuilder bodyHtml = new StringBuilder(); bodyHtml.append("
"); - bodyHtml.append(MessageUtils.getMsg("msg.calc.sym.natural.numbers", locale)); + bodyHtml.append(getMsg("msg.calc.sym.natural.numbers", locale)); bodyHtml.append("

n = "); if (number > 0) { bodyHtml.append(""); @@ -66,13 +60,12 @@ protected void service(HttpServletRequest req, HttpServletResponse res) throws S log.info("{} ms", (System.nanoTime() - start) / 1000000f); } bodyHtml.append("

"); - bodyHtml.append(""); + bodyHtml.append(""); bodyHtml.append("

"); - bodyHtml.append(MessageUtils.getInfoMsg("msg.note.createobjects", locale)); + bodyHtml.append(getInfoMsg("msg.note.createobjects", locale)); bodyHtml.append("
"); - HTTPResponseCreator.createSimpleResponse(req, res, MessageUtils.getMsg("title.createobjects.page", locale), - bodyHtml.toString()); + responseToClient(req, res, getMsg("title.createobjects.page", locale), bodyHtml.toString()); } private Long calcSum1(int number) { diff --git a/src/main/java/org/t246osslab/easybuggy/performance/SlowRegularExpressionServlet.java b/src/main/java/org/t246osslab/easybuggy/performance/SlowRegularExpressionServlet.java index 05b2692c..bff753a5 100644 --- a/src/main/java/org/t246osslab/easybuggy/performance/SlowRegularExpressionServlet.java +++ b/src/main/java/org/t246osslab/easybuggy/performance/SlowRegularExpressionServlet.java @@ -8,21 +8,15 @@ import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; -import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.commons.lang.StringUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.t246osslab.easybuggy.core.utils.HTTPResponseCreator; -import org.t246osslab.easybuggy.core.utils.MessageUtils; +import org.t246osslab.easybuggy.core.servlets.AbstractServlet; @SuppressWarnings("serial") @WebServlet(urlPatterns = { "/slowre" }) -public class SlowRegularExpressionServlet extends HttpServlet { - - private static final Logger log = LoggerFactory.getLogger(SlowRegularExpressionServlet.class); +public class SlowRegularExpressionServlet extends AbstractServlet { @Override protected void service(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { @@ -34,14 +28,14 @@ protected void service(HttpServletRequest req, HttpServletResponse res) throws S StringBuilder bodyHtml = new StringBuilder(); bodyHtml.append("
"); - bodyHtml.append(MessageUtils.getMsg("description.test.regular.expression", locale)); + bodyHtml.append(getMsg("description.test.regular.expression", locale)); bodyHtml.append("

"); bodyHtml.append(""); bodyHtml.append("

"); - bodyHtml.append(MessageUtils.getMsg("label.string", locale) + ": "); + bodyHtml.append(getMsg("label.string", locale) + ": "); bodyHtml.append(""); bodyHtml.append("

"); - bodyHtml.append(""); + bodyHtml.append(""); bodyHtml.append("

"); if (!StringUtils.isBlank(word)) { @@ -51,19 +45,18 @@ protected void service(HttpServletRequest req, HttpServletResponse res) throws S boolean matches = matcher.matches(); log.info("End Date: {}", new Date()); if (matches) { - bodyHtml.append(MessageUtils.getMsg("msg.match.regular.expression", locale)); + bodyHtml.append(getMsg("msg.match.regular.expression", locale)); } else { - bodyHtml.append(MessageUtils.getMsg("msg.not.match.regular.expression", locale)); + bodyHtml.append(getMsg("msg.not.match.regular.expression", locale)); } } else { - bodyHtml.append(MessageUtils.getMsg("msg.enter.string", locale)); + bodyHtml.append(getMsg("msg.enter.string", locale)); } bodyHtml.append("

"); - bodyHtml.append(MessageUtils.getInfoMsg("msg.note.slowregex", locale)); + bodyHtml.append(getInfoMsg("msg.note.slowregex", locale)); bodyHtml.append("
"); - HTTPResponseCreator.createSimpleResponse(req, res, MessageUtils.getMsg("title.slowregex.page", locale), - bodyHtml.toString()); + responseToClient(req, res, getMsg("title.slowregex.page", locale), bodyHtml.toString()); } catch (Exception e) { log.error("Exception occurs: ", e); diff --git a/src/main/java/org/t246osslab/easybuggy/performance/StringPlusOperationServlet.java b/src/main/java/org/t246osslab/easybuggy/performance/StringPlusOperationServlet.java index 0cae6bdc..40682487 100644 --- a/src/main/java/org/t246osslab/easybuggy/performance/StringPlusOperationServlet.java +++ b/src/main/java/org/t246osslab/easybuggy/performance/StringPlusOperationServlet.java @@ -7,22 +7,16 @@ import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; -import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.commons.lang.math.NumberUtils; import org.owasp.esapi.ESAPI; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.t246osslab.easybuggy.core.utils.HTTPResponseCreator; -import org.t246osslab.easybuggy.core.utils.MessageUtils; +import org.t246osslab.easybuggy.core.servlets.AbstractServlet; @SuppressWarnings("serial") @WebServlet(urlPatterns = { "/strplusopr" }) -public class StringPlusOperationServlet extends HttpServlet { - - private static final Logger log = LoggerFactory.getLogger(StringPlusOperationServlet.class); +public class StringPlusOperationServlet extends AbstractServlet { private static final int MAX_LENGTH = 1000000; private static final String[] ALL_NUMBERS = { "1", "2", "3", "4", "5", "6", "7", "8", "9", "0" }; @@ -44,25 +38,25 @@ protected void service(HttpServletRequest req, HttpServletResponse res) throws S StringBuilder bodyHtml = new StringBuilder(); bodyHtml.append("
"); - bodyHtml.append(MessageUtils.getMsg("description.random.string.generator", locale)); + bodyHtml.append(getMsg("description.random.string.generator", locale)); bodyHtml.append("

"); - bodyHtml.append(MessageUtils.getMsg("label.character.count", locale) + ": "); + bodyHtml.append(getMsg("label.character.count", locale) + ": "); bodyHtml.append("
"); if (length > 0) { - bodyHtml.append( - ""); + bodyHtml.append(""); } else { bodyHtml.append(""); } bodyHtml.append("

"); - bodyHtml.append("

" + MessageUtils.getMsg("label.available.characters", locale) + "

"); + bodyHtml.append("

" + getMsg("label.available.characters", locale) + "

"); appendCheckBox(characters, locale, bodyHtml, ALL_NUMBERS, "label.numbers"); appendCheckBox(characters, locale, bodyHtml, ALL_UPPER_CHARACTERS, "label.uppercase.characters"); appendCheckBox(characters, locale, bodyHtml, ALL_LOWER_CHARACTERS, "label.lowercase.characters"); appendCheckBox(characters, locale, bodyHtml, ALL_SIGNS, "label.signs"); - bodyHtml.append(""); + bodyHtml.append(""); bodyHtml.append("

"); if (length > 0) { @@ -77,18 +71,17 @@ protected void service(HttpServletRequest req, HttpServletResponse res) throws S } log.info("End Date: {}", new Date()); } - bodyHtml.append(MessageUtils.getMsg("label.execution.result", locale)); + bodyHtml.append(getMsg("label.execution.result", locale)); bodyHtml.append("

"); - // bodyHtml.append(ESAPI.encoder().encodeForHTML(builder.toString())); - bodyHtml.append(ESAPI.encoder().encodeForHTML(s)); + // bodyHtml.append(encodeForHTML(builder.toString())); + bodyHtml.append(encodeForHTML(s)); } else { - bodyHtml.append(MessageUtils.getMsg("msg.enter.positive.number", locale)); + bodyHtml.append(getMsg("msg.enter.positive.number", locale)); } bodyHtml.append("

"); - bodyHtml.append(MessageUtils.getInfoMsg("msg.note.strplusopr", locale)); + bodyHtml.append(getInfoMsg("msg.note.strplusopr", locale)); bodyHtml.append("
"); - HTTPResponseCreator.createSimpleResponse(req, res, MessageUtils.getMsg("title.strplusopr.page", locale), - bodyHtml.toString()); + responseToClient(req, res, getMsg("title.strplusopr.page", locale), bodyHtml.toString()); } catch (Exception e) { log.error("Exception occurs: ", e); @@ -97,7 +90,7 @@ protected void service(HttpServletRequest req, HttpServletResponse res) throws S private void appendCheckBox(String[] characters, Locale locale, StringBuilder bodyHtml, String[] allCharacters, String label) { - bodyHtml.append("

" + MessageUtils.getMsg(label, locale) + "

"); + bodyHtml.append("

" + getMsg(label, locale) + "

"); bodyHtml.append("

"); for (int i = 0; i < allCharacters.length; i++) { bodyHtml.append(" 0) { result = "" + sb.toString() + "
" - + MessageUtils.getMsg("label.user.id", locale) + "" - + MessageUtils.getMsg("label.name", locale) + "" - + MessageUtils.getMsg("label.phone", locale) + "" - + MessageUtils.getMsg("label.mail", locale) + "
"; + + getMsg("label.user.id", locale) + "" + + getMsg("label.name", locale) + "" + + getMsg("label.phone", locale) + "" + + getMsg("label.mail", locale) + "" + sb.toString() + ""; } } catch (Exception e) { - result = MessageUtils.getErrMsg("msg.db.access.error.occur", locale); + result = getErrMsg("msg.db.access.error.occur", locale); log.error("Exception occurs: ", e); } finally { /* A DB connection leaks because the following lines are commented out. diff --git a/src/main/java/org/t246osslab/easybuggy/troubles/DeadlockServlet.java b/src/main/java/org/t246osslab/easybuggy/troubles/DeadlockServlet.java index 7c696bb9..a1d03eea 100644 --- a/src/main/java/org/t246osslab/easybuggy/troubles/DeadlockServlet.java +++ b/src/main/java/org/t246osslab/easybuggy/troubles/DeadlockServlet.java @@ -8,20 +8,14 @@ import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; -import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.t246osslab.easybuggy.core.utils.HTTPResponseCreator; -import org.t246osslab.easybuggy.core.utils.MessageUtils; +import org.t246osslab.easybuggy.core.servlets.AbstractServlet; @SuppressWarnings("serial") @WebServlet(urlPatterns = { "/deadlock" }) -public class DeadlockServlet extends HttpServlet { - - private static final Logger log = LoggerFactory.getLogger(DeadlockServlet.class); +public class DeadlockServlet extends AbstractServlet { private final Object lock1 = new Object(); private final Object lock2 = new Object(); @@ -42,7 +36,7 @@ protected void service(HttpServletRequest req, HttpServletResponse res) throws S ThreadMXBean bean = ManagementFactory.getThreadMXBean(); long[] threadIds = bean.findDeadlockedThreads(); if (threadIds != null) { - bodyHtml.append(MessageUtils.getMsg("msg.dead.lock.detected", locale)); + bodyHtml.append(getMsg("msg.dead.lock.detected", locale)); bodyHtml.append("

"); bodyHtml.append(""); ThreadInfo[] infos = bean.getThreadInfo(threadIds); @@ -51,17 +45,15 @@ protected void service(HttpServletRequest req, HttpServletResponse res) throws S } bodyHtml.append("
"); } else { - bodyHtml.append(MessageUtils.getMsg("msg.dead.lock.not.occur", locale)); + bodyHtml.append(getMsg("msg.dead.lock.not.occur", locale)); bodyHtml.append("

"); } - bodyHtml.append(MessageUtils.getInfoMsg("msg.note.deadlock", locale)); + bodyHtml.append(getInfoMsg("msg.note.deadlock", locale)); } catch (Exception e) { log.error("Exception occurs: ", e); - bodyHtml.append( - MessageUtils.getErrMsg("msg.unknown.exception.occur", new String[] { e.getMessage() }, locale)); + bodyHtml.append(getErrMsg("msg.unknown.exception.occur", new String[] { e.getMessage() }, locale)); } finally { - HTTPResponseCreator.createSimpleResponse(req, res, MessageUtils.getMsg("title.deadlock.page", locale), - bodyHtml.toString()); + responseToClient(req, res, getMsg("title.deadlock.page", locale), bodyHtml.toString()); } } diff --git a/src/main/java/org/t246osslab/easybuggy/troubles/DeadlockServlet2.java b/src/main/java/org/t246osslab/easybuggy/troubles/DeadlockServlet2.java index 4915f07d..f28116e3 100644 --- a/src/main/java/org/t246osslab/easybuggy/troubles/DeadlockServlet2.java +++ b/src/main/java/org/t246osslab/easybuggy/troubles/DeadlockServlet2.java @@ -12,23 +12,17 @@ import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; -import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import org.t246osslab.easybuggy.core.dao.DBClient; import org.t246osslab.easybuggy.core.model.User; +import org.t246osslab.easybuggy.core.servlets.AbstractServlet; import org.t246osslab.easybuggy.core.utils.Closer; -import org.t246osslab.easybuggy.core.utils.HTTPResponseCreator; -import org.t246osslab.easybuggy.core.utils.MessageUtils; @SuppressWarnings("serial") @WebServlet(urlPatterns = { "/deadlock2" }) -public class DeadlockServlet2 extends HttpServlet { - - private static final Logger log = LoggerFactory.getLogger(DeadlockServlet2.class); +public class DeadlockServlet2 extends AbstractServlet { @Override protected void service(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { @@ -62,11 +56,10 @@ protected void service(HttpServletRequest req, HttpServletResponse res) throws S } catch (Exception e) { log.error("Exception occurs: ", e); bodyHtml.append( - MessageUtils.getErrMsg("msg.unknown.exception.occur", new String[] { e.getMessage() }, locale)); + getErrMsg("msg.unknown.exception.occur", new String[] { e.getMessage() }, locale)); bodyHtml.append(e.getLocalizedMessage()); } finally { - HTTPResponseCreator.createSimpleResponse(req, res, - MessageUtils.getMsg("title.xxe.page", locale), bodyHtml.toString()); + responseToClient(req, res, getMsg("title.xxe.page", locale), bodyHtml.toString()); } } @@ -84,22 +77,22 @@ private void createHTMLUserTable(Locale locale, StringBuilder bodyHtml, ArrayLis String updateResult) { bodyHtml.append("

"); - bodyHtml.append(MessageUtils.getMsg("msg.update.users", locale)); + bodyHtml.append(getMsg("msg.update.users", locale)); bodyHtml.append("

"); - bodyHtml.append(""); + bodyHtml.append(""); bodyHtml.append("

"); bodyHtml.append( ""); + bodyHtml.append(getMsg("label.name", locale) + ""); int rownum = 1; for (User user : users) { bodyHtml.append("
"); - bodyHtml.append("" + MessageUtils.getMsg("label.user.id", locale)); + bodyHtml.append("" + getMsg("label.user.id", locale)); if ("desc".equals(order)) { bodyHtml.append(" "); } else { bodyHtml.append(" "); } bodyHtml.append(""); - bodyHtml.append(MessageUtils.getMsg("label.name", locale) + ""); - bodyHtml.append(MessageUtils.getMsg("label.phone", locale) + ""); - bodyHtml.append(MessageUtils.getMsg("label.mail", locale) + ""); + bodyHtml.append(getMsg("label.phone", locale) + ""); + bodyHtml.append(getMsg("label.mail", locale) + "
"); bodyHtml.append(updateResult); - bodyHtml.append(MessageUtils.getInfoMsg("msg.note.deadlock2", locale)); + bodyHtml.append(getInfoMsg("msg.note.deadlock2", locale)); bodyHtml.append(""); } @@ -170,20 +163,20 @@ private String updateUsers(ArrayList users, Locale locale) { Thread.sleep(500); } conn.commit(); - resultMessage = MessageUtils.getMsg("msg.update.records", new Object[] { executeUpdate }, locale) + resultMessage = getMsg("msg.update.records", new Object[] { executeUpdate }, locale) + "

"; } catch (SQLTransactionRollbackException e) { - resultMessage = MessageUtils.getErrMsg("msg.deadlock.occurs", locale); + resultMessage = getErrMsg("msg.deadlock.occurs", locale); log.error("SQLTransactionRollbackException occurs: ", e); rollbak(conn); } catch (SQLException e) { - resultMessage = MessageUtils.getErrMsg("msg.unknown.exception.occur", new String[] { e.getMessage() }, + resultMessage = getErrMsg("msg.unknown.exception.occur", new String[] { e.getMessage() }, locale); log.error("SQLException occurs: ", e); rollbak(conn); } catch (Exception e) { - resultMessage = MessageUtils.getErrMsg("msg.unknown.exception.occur", new String[] { e.getMessage() }, + resultMessage = getErrMsg("msg.unknown.exception.occur", new String[] { e.getMessage() }, locale); log.error("Exception occurs: ", e); rollbak(conn); diff --git a/src/main/java/org/t246osslab/easybuggy/troubles/EndlessWaitingServlet.java b/src/main/java/org/t246osslab/easybuggy/troubles/EndlessWaitingServlet.java index f6d6b511..6fc8edee 100644 --- a/src/main/java/org/t246osslab/easybuggy/troubles/EndlessWaitingServlet.java +++ b/src/main/java/org/t246osslab/easybuggy/troubles/EndlessWaitingServlet.java @@ -11,22 +11,16 @@ import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; -import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.commons.lang.math.NumberUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; +import org.t246osslab.easybuggy.core.servlets.AbstractServlet; import org.t246osslab.easybuggy.core.utils.Closer; -import org.t246osslab.easybuggy.core.utils.HTTPResponseCreator; -import org.t246osslab.easybuggy.core.utils.MessageUtils; @SuppressWarnings("serial") @WebServlet(urlPatterns = { "/endlesswaiting" }) -public class EndlessWaitingServlet extends HttpServlet { - - private static final Logger log = LoggerFactory.getLogger(EndlessWaitingServlet.class); +public class EndlessWaitingServlet extends AbstractServlet { private static final int MAX_COUNT = 100000; @@ -40,12 +34,12 @@ protected void service(HttpServletRequest req, HttpServletResponse res) throws S StringBuilder bodyHtml = new StringBuilder(); bodyHtml.append("
"); - bodyHtml.append(MessageUtils.getMsg("description.endless.waiting", locale)); + bodyHtml.append(getMsg("description.endless.waiting", locale)); bodyHtml.append("

"); - bodyHtml.append(MessageUtils.getMsg("label.character.count", locale) + ": "); + bodyHtml.append(getMsg("label.character.count", locale) + ": "); bodyHtml.append(""); bodyHtml.append("

"); - bodyHtml.append(""); + bodyHtml.append(""); bodyHtml.append("

"); if (count > 0) { @@ -53,28 +47,27 @@ protected void service(HttpServletRequest req, HttpServletResponse res) throws S File batFile = createBatchFile(count, req.getServletContext().getAttribute("javax.servlet.context.tempdir").toString()); if (batFile == null) { - bodyHtml.append(MessageUtils.getMsg("msg.cant.create.batch", locale)); + bodyHtml.append(getMsg("msg.cant.create.batch", locale)); } else { /* execte the batch */ ProcessBuilder pb = new ProcessBuilder(batFile.getAbsolutePath()); Process process = pb.start(); process.waitFor(); - bodyHtml.append(MessageUtils.getMsg("msg.executed.batch", locale) + batFile.getAbsolutePath()); + bodyHtml.append(getMsg("msg.executed.batch", locale) + batFile.getAbsolutePath()); bodyHtml.append("

"); - bodyHtml.append(MessageUtils.getMsg("label.execution.result", locale)); + bodyHtml.append(getMsg("label.execution.result", locale)); bodyHtml.append("

"); bodyHtml.append(printInputStream(process.getInputStream())); bodyHtml.append(printInputStream(process.getErrorStream())); } } else { - bodyHtml.append(MessageUtils.getMsg("msg.enter.positive.number", locale)); + bodyHtml.append(getMsg("msg.enter.positive.number", locale)); bodyHtml.append("
"); } bodyHtml.append("
"); - bodyHtml.append(MessageUtils.getInfoMsg("msg.note.endlesswaiting", locale)); + bodyHtml.append(getInfoMsg("msg.note.endlesswaiting", locale)); bodyHtml.append("
"); - HTTPResponseCreator.createSimpleResponse(req, res, MessageUtils.getMsg("title.endlesswaiting.page", locale), - bodyHtml.toString()); + responseToClient(req, res, getMsg("title.endlesswaiting.page", locale), bodyHtml.toString()); } catch (Exception e) { log.error("Exception occurs: ", e); diff --git a/src/main/java/org/t246osslab/easybuggy/troubles/FileDescriptorLeakServlet.java b/src/main/java/org/t246osslab/easybuggy/troubles/FileDescriptorLeakServlet.java index e6200ab8..4cdbcb30 100644 --- a/src/main/java/org/t246osslab/easybuggy/troubles/FileDescriptorLeakServlet.java +++ b/src/main/java/org/t246osslab/easybuggy/troubles/FileDescriptorLeakServlet.java @@ -11,21 +11,16 @@ import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; -import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.t246osslab.easybuggy.core.utils.HTTPResponseCreator; -import org.t246osslab.easybuggy.core.utils.MessageUtils; +import org.t246osslab.easybuggy.core.servlets.AbstractServlet; @SuppressWarnings("serial") @WebServlet(urlPatterns = { "/filedescriptorleak" }) -public class FileDescriptorLeakServlet extends HttpServlet { +public class FileDescriptorLeakServlet extends AbstractServlet { private static final int MAX_DISPLAY_COUNT = 15; - private static final Logger log = LoggerFactory.getLogger(FileDescriptorLeakServlet.class); private long count = 0; @Override @@ -47,12 +42,12 @@ protected void doGet(HttpServletRequest req, HttpServletResponse res) throws Ser count++; BufferedReader br = new BufferedReader(new FileReader(file)); - bodyHtml.append("

" + MessageUtils.getMsg("description.access.history", req.getLocale()) + "

"); + bodyHtml.append("

" + getMsg("description.access.history", req.getLocale()) + "

"); bodyHtml.append( ""); - bodyHtml.append(""); - bodyHtml.append(""); - bodyHtml.append(""); + bodyHtml.append(""); + bodyHtml.append(""); + bodyHtml.append(""); int headerLength = bodyHtml.length(); String line; long currentLineNum = 0; @@ -65,13 +60,11 @@ protected void doGet(HttpServletRequest req, HttpServletResponse res) throws Ser bodyHtml.append("
" + MessageUtils.getMsg("label.access.time", locale) + "" + MessageUtils.getMsg("label.ip.address", locale) + "" + MessageUtils.getMsg("label.session.id", locale) + "" + getMsg("label.access.time", locale) + "" + getMsg("label.ip.address", locale) + "" + getMsg("label.session.id", locale) + "
"); } catch (Exception e) { log.error("Exception occurs: ", e); - bodyHtml.append( - MessageUtils.getErrMsg("msg.unknown.exception.occur", new String[] { e.getMessage() }, locale)); + bodyHtml.append(getErrMsg("msg.unknown.exception.occur", new String[] { e.getMessage() }, locale)); bodyHtml.append(e.getLocalizedMessage()); } finally { - bodyHtml.append(MessageUtils.getInfoMsg("msg.note.filedescriptorleak", req.getLocale())); - HTTPResponseCreator.createSimpleResponse(req, res, MessageUtils.getMsg("title.filedescriptorleak.page", locale), - bodyHtml.toString()); + bodyHtml.append(getInfoMsg("msg.note.filedescriptorleak", req.getLocale())); + responseToClient(req, res, getMsg("title.filedescriptorleak.page", locale), bodyHtml.toString()); } } } diff --git a/src/main/java/org/t246osslab/easybuggy/troubles/ForwardLoopServlet.java b/src/main/java/org/t246osslab/easybuggy/troubles/ForwardLoopServlet.java index 53df17f9..248e1164 100644 --- a/src/main/java/org/t246osslab/easybuggy/troubles/ForwardLoopServlet.java +++ b/src/main/java/org/t246osslab/easybuggy/troubles/ForwardLoopServlet.java @@ -5,13 +5,14 @@ import javax.servlet.RequestDispatcher; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; -import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; +import org.t246osslab.easybuggy.core.servlets.AbstractServlet; + @SuppressWarnings("serial") @WebServlet(urlPatterns = { "/forwardloop" }) -public class ForwardLoopServlet extends HttpServlet { +public class ForwardLoopServlet extends AbstractServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { diff --git a/src/main/java/org/t246osslab/easybuggy/troubles/InfiniteLoopServlet.java b/src/main/java/org/t246osslab/easybuggy/troubles/InfiniteLoopServlet.java index 1cff9d46..38ddd4dd 100644 --- a/src/main/java/org/t246osslab/easybuggy/troubles/InfiniteLoopServlet.java +++ b/src/main/java/org/t246osslab/easybuggy/troubles/InfiniteLoopServlet.java @@ -4,18 +4,14 @@ import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; -import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; +import org.t246osslab.easybuggy.core.servlets.AbstractServlet; @SuppressWarnings("serial") @WebServlet(urlPatterns = { "/infiniteloop" }) -public class InfiniteLoopServlet extends HttpServlet { - - private static final Logger log = LoggerFactory.getLogger(InfiniteLoopServlet.class); +public class InfiniteLoopServlet extends AbstractServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { diff --git a/src/main/java/org/t246osslab/easybuggy/troubles/IntegerOverflowServlet.java b/src/main/java/org/t246osslab/easybuggy/troubles/IntegerOverflowServlet.java index 49354051..718934ba 100644 --- a/src/main/java/org/t246osslab/easybuggy/troubles/IntegerOverflowServlet.java +++ b/src/main/java/org/t246osslab/easybuggy/troubles/IntegerOverflowServlet.java @@ -6,21 +6,15 @@ import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; -import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.commons.lang.math.NumberUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.t246osslab.easybuggy.core.utils.HTTPResponseCreator; -import org.t246osslab.easybuggy.core.utils.MessageUtils; +import org.t246osslab.easybuggy.core.servlets.AbstractServlet; @SuppressWarnings("serial") @WebServlet(urlPatterns = { "/iof" }) -public class IntegerOverflowServlet extends HttpServlet { - - private static final Logger log = LoggerFactory.getLogger(IntegerOverflowServlet.class); +public class IntegerOverflowServlet extends AbstractServlet { @Override protected void service(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { @@ -45,7 +39,7 @@ protected void service(HttpServletRequest req, HttpServletResponse res) throws S StringBuilder bodyHtml = new StringBuilder(); bodyHtml.append("
"); - bodyHtml.append(MessageUtils.getMsg("msg.question.reach.the.moon", locale)); + bodyHtml.append(getMsg("msg.question.reach.the.moon", locale)); bodyHtml.append("

"); if (times >= 0) { bodyHtml.append( @@ -54,7 +48,7 @@ protected void service(HttpServletRequest req, HttpServletResponse res) throws S bodyHtml.append(""); } bodyHtml.append("  "); - bodyHtml.append(MessageUtils.getMsg("label.times", locale) + " : "); + bodyHtml.append(getMsg("label.times", locale) + " : "); if (times >= 0) { bodyHtml.append(thickness + " mm"); if (thicknessM != null && thicknessKm != null) { @@ -62,17 +56,16 @@ protected void service(HttpServletRequest req, HttpServletResponse res) throws S bodyHtml.append(thicknessKm.intValue() >= 1 ? " = " + thicknessKm + " km" : ""); } if (times == 42) { - bodyHtml.append(" : " + MessageUtils.getMsg("msg.answer.is.correct", locale)); + bodyHtml.append(" : " + getMsg("msg.answer.is.correct", locale)); } } bodyHtml.append("

"); - bodyHtml.append(""); + bodyHtml.append(""); bodyHtml.append("

"); - bodyHtml.append(MessageUtils.getInfoMsg("msg.note.intoverflow", locale)); + bodyHtml.append(getInfoMsg("msg.note.intoverflow", locale)); bodyHtml.append("
"); - HTTPResponseCreator.createSimpleResponse(req, res, MessageUtils.getMsg("title.intoverflow.page", locale), - bodyHtml.toString()); + responseToClient(req, res, getMsg("title.intoverflow.page", locale), bodyHtml.toString()); } catch (Exception e) { log.error("Exception occurs: ", e); diff --git a/src/main/java/org/t246osslab/easybuggy/troubles/JVMCrashByEAVServlet.java b/src/main/java/org/t246osslab/easybuggy/troubles/JVMCrashByEAVServlet.java index 044b8ad1..0d8fe2f0 100644 --- a/src/main/java/org/t246osslab/easybuggy/troubles/JVMCrashByEAVServlet.java +++ b/src/main/java/org/t246osslab/easybuggy/troubles/JVMCrashByEAVServlet.java @@ -5,20 +5,16 @@ import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; -import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; +import org.t246osslab.easybuggy.core.servlets.AbstractServlet; import sun.misc.Unsafe; @SuppressWarnings("serial") @WebServlet(urlPatterns = { "/jvmcrasheav" }) -public class JVMCrashByEAVServlet extends HttpServlet { - - private static final Logger log = LoggerFactory.getLogger(JVMCrashByEAVServlet.class); +public class JVMCrashByEAVServlet extends AbstractServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { diff --git a/src/main/java/org/t246osslab/easybuggy/troubles/LossOfTrailingDigitsServlet.java b/src/main/java/org/t246osslab/easybuggy/troubles/LossOfTrailingDigitsServlet.java index 8f27d023..f7fbb054 100644 --- a/src/main/java/org/t246osslab/easybuggy/troubles/LossOfTrailingDigitsServlet.java +++ b/src/main/java/org/t246osslab/easybuggy/troubles/LossOfTrailingDigitsServlet.java @@ -5,21 +5,15 @@ import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; -import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.commons.lang.math.NumberUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.t246osslab.easybuggy.core.utils.HTTPResponseCreator; -import org.t246osslab.easybuggy.core.utils.MessageUtils; +import org.t246osslab.easybuggy.core.servlets.AbstractServlet; @SuppressWarnings("serial") @WebServlet(urlPatterns = { "/lotd" }) -public class LossOfTrailingDigitsServlet extends HttpServlet { - - private static final Logger log = LoggerFactory.getLogger(LossOfTrailingDigitsServlet.class); +public class LossOfTrailingDigitsServlet extends AbstractServlet { @Override protected void service(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { @@ -34,7 +28,7 @@ protected void service(HttpServletRequest req, HttpServletResponse res) throws S StringBuilder bodyHtml = new StringBuilder(); bodyHtml.append("
"); - bodyHtml.append(MessageUtils.getMsg("msg.enter.decimal.value", locale)); + bodyHtml.append(getMsg("msg.enter.decimal.value", locale)); bodyHtml.append("

"); if (!Double.isNaN(number) && isValid) { bodyHtml.append("
"); - bodyHtml.append(""); + bodyHtml.append(""); bodyHtml.append("

"); - bodyHtml.append(MessageUtils.getInfoMsg("msg.note.lossoftrailingdigits", locale)); + bodyHtml.append(getInfoMsg("msg.note.lossoftrailingdigits", locale)); bodyHtml.append("
"); - HTTPResponseCreator.createSimpleResponse(req, res, - MessageUtils.getMsg("title.lossoftrailingdigits.page", locale), bodyHtml.toString()); + responseToClient(req, res, getMsg("title.lossoftrailingdigits.page", locale), bodyHtml.toString()); } catch (Exception e) { log.error("Exception occurs: ", e); diff --git a/src/main/java/org/t246osslab/easybuggy/troubles/MemoryLeakServlet.java b/src/main/java/org/t246osslab/easybuggy/troubles/MemoryLeakServlet.java index 820568f4..977b5d50 100644 --- a/src/main/java/org/t246osslab/easybuggy/troubles/MemoryLeakServlet.java +++ b/src/main/java/org/t246osslab/easybuggy/troubles/MemoryLeakServlet.java @@ -11,20 +11,14 @@ import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; -import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.t246osslab.easybuggy.core.utils.HTTPResponseCreator; -import org.t246osslab.easybuggy.core.utils.MessageUtils; +import org.t246osslab.easybuggy.core.servlets.AbstractServlet; @SuppressWarnings("serial") @WebServlet(urlPatterns = { "/memoryleak" }) -public class MemoryLeakServlet extends HttpServlet { - - private static final Logger log = LoggerFactory.getLogger(MemoryLeakServlet.class); +public class MemoryLeakServlet extends AbstractServlet { private HashMap cache = new HashMap(); @@ -41,25 +35,24 @@ protected void doGet(HttpServletRequest req, HttpServletResponse res) throws Ser bodyHtml.append("

" + memoryPoolMXBean.getName() + "

"); bodyHtml.append(""); bodyHtml.append(""); - bodyHtml.append(""); - bodyHtml.append(""); - bodyHtml.append(""); - bodyHtml.append(""); - writeUsageRow(bodyHtml, memoryPoolMXBean.getUsage(), MessageUtils.getMsg("label.memory.usage", locale)); - writeUsageRow(bodyHtml, memoryPoolMXBean.getPeakUsage(), MessageUtils.getMsg("label.memory.peak.usage", locale)); - writeUsageRow(bodyHtml, memoryPoolMXBean.getCollectionUsage(), MessageUtils.getMsg("label.memory.collection.usage", locale)); + bodyHtml.append(""); + bodyHtml.append(""); + bodyHtml.append(""); + bodyHtml.append(""); + writeUsageRow(bodyHtml, memoryPoolMXBean.getUsage(), getMsg("label.memory.usage", locale)); + writeUsageRow(bodyHtml, memoryPoolMXBean.getPeakUsage(), getMsg("label.memory.peak.usage", locale)); + writeUsageRow(bodyHtml, memoryPoolMXBean.getCollectionUsage(), getMsg("label.memory.collection.usage", locale)); bodyHtml.append("
" + MessageUtils.getMsg("label.memory.init", locale) + "" + MessageUtils.getMsg("label.memory.used", locale) + "" + MessageUtils.getMsg("label.memory.committed", locale) + "" + MessageUtils.getMsg("label.memory.max", locale) + "
" + getMsg("label.memory.init", locale) + "" + getMsg("label.memory.used", locale) + "" + getMsg("label.memory.committed", locale) + "" + getMsg("label.memory.max", locale) + "
"); } } - bodyHtml.append(MessageUtils.getInfoMsg("msg.note.memoryleak", req.getLocale())); + bodyHtml.append(getInfoMsg("msg.note.memoryleak", req.getLocale())); } catch (Exception e) { log.error("Exception occurs: ", e); - bodyHtml.append(MessageUtils.getErrMsg("msg.unknown.exception.occur", new String[] { e.getMessage() }, + bodyHtml.append(getErrMsg("msg.unknown.exception.occur", new String[] { e.getMessage() }, locale)); } finally { - HTTPResponseCreator.createSimpleResponse(req, res, MessageUtils.getMsg("title.memoryleak.page", locale), - bodyHtml.toString()); + responseToClient(req, res, getMsg("title.memoryleak.page", locale), bodyHtml.toString()); } } diff --git a/src/main/java/org/t246osslab/easybuggy/troubles/MemoryLeakServlet2.java b/src/main/java/org/t246osslab/easybuggy/troubles/MemoryLeakServlet2.java index 2f6b58b5..ab6cec34 100644 --- a/src/main/java/org/t246osslab/easybuggy/troubles/MemoryLeakServlet2.java +++ b/src/main/java/org/t246osslab/easybuggy/troubles/MemoryLeakServlet2.java @@ -13,20 +13,14 @@ import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; -import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.t246osslab.easybuggy.core.utils.HTTPResponseCreator; -import org.t246osslab.easybuggy.core.utils.MessageUtils; +import org.t246osslab.easybuggy.core.servlets.AbstractServlet; @SuppressWarnings("serial") @WebServlet(urlPatterns = { "/memoryleak2" }) -public class MemoryLeakServlet2 extends HttpServlet { - - private static final Logger log = LoggerFactory.getLogger(MemoryLeakServlet2.class); +public class MemoryLeakServlet2 extends AbstractServlet { private int i = 0; @@ -43,27 +37,26 @@ protected void doGet(HttpServletRequest req, HttpServletResponse res) throws Ser bodyHtml.append("

" + memoryPoolMXBean.getName() + "

"); bodyHtml.append(""); bodyHtml.append(""); - bodyHtml.append(""); - bodyHtml.append(""); - bodyHtml.append(""); - bodyHtml.append(""); - writeUsageRow(bodyHtml, memoryPoolMXBean.getUsage(), MessageUtils.getMsg("label.memory.usage", locale)); - writeUsageRow(bodyHtml, memoryPoolMXBean.getPeakUsage(), MessageUtils.getMsg("label.memory.peak.usage", locale)); - writeUsageRow(bodyHtml, memoryPoolMXBean.getCollectionUsage(), MessageUtils.getMsg("label.memory.collection.usage", locale)); + bodyHtml.append(""); + bodyHtml.append(""); + bodyHtml.append(""); + bodyHtml.append(""); + writeUsageRow(bodyHtml, memoryPoolMXBean.getUsage(), getMsg("label.memory.usage", locale)); + writeUsageRow(bodyHtml, memoryPoolMXBean.getPeakUsage(), getMsg("label.memory.peak.usage", locale)); + writeUsageRow(bodyHtml, memoryPoolMXBean.getCollectionUsage(), getMsg("label.memory.collection.usage", locale)); bodyHtml.append("
" + MessageUtils.getMsg("label.memory.init", locale) + "" + MessageUtils.getMsg("label.memory.used", locale) + "" + MessageUtils.getMsg("label.memory.committed", locale) + "" + MessageUtils.getMsg("label.memory.max", locale) + "
" + getMsg("label.memory.init", locale) + "" + getMsg("label.memory.used", locale) + "" + getMsg("label.memory.committed", locale) + "" + getMsg("label.memory.max", locale) + "
"); } } String permName = (System.getProperty("java.version").startsWith("1.6") || System.getProperty("java.version").startsWith("1.7")) - ? MessageUtils.getMsg("label.permgen.space", locale) : MessageUtils.getMsg("label.metaspace",locale); - bodyHtml.append(MessageUtils.getInfoMsg("msg.permgen.space.leak.occur", new String[] { permName }, req.getLocale())); + ? getMsg("label.permgen.space", locale) : getMsg("label.metaspace",locale); + bodyHtml.append(getInfoMsg("msg.permgen.space.leak.occur", new String[] { permName }, req.getLocale())); } catch (Exception e) { log.error("Exception occurs: ", e); - bodyHtml.append(MessageUtils.getErrMsg("msg.unknown.exception.occur", new String[] { e.getMessage() }, + bodyHtml.append(getErrMsg("msg.unknown.exception.occur", new String[] { e.getMessage() }, locale)); } finally { - HTTPResponseCreator.createSimpleResponse(req, res, MessageUtils.getMsg("title.memoryleak2.page", locale), - bodyHtml.toString()); + responseToClient(req, res, getMsg("title.memoryleak2.page", locale), bodyHtml.toString()); } } diff --git a/src/main/java/org/t246osslab/easybuggy/troubles/MemoryLeakServlet3.java b/src/main/java/org/t246osslab/easybuggy/troubles/MemoryLeakServlet3.java index fa2e35cf..11262f18 100644 --- a/src/main/java/org/t246osslab/easybuggy/troubles/MemoryLeakServlet3.java +++ b/src/main/java/org/t246osslab/easybuggy/troubles/MemoryLeakServlet3.java @@ -7,20 +7,14 @@ import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; -import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.t246osslab.easybuggy.core.utils.HTTPResponseCreator; -import org.t246osslab.easybuggy.core.utils.MessageUtils; +import org.t246osslab.easybuggy.core.servlets.AbstractServlet; @SuppressWarnings("serial") @WebServlet(urlPatterns = { "/memoryleak3" }) -public class MemoryLeakServlet3 extends HttpServlet { - - private static final Logger log = LoggerFactory.getLogger(MemoryLeakServlet3.class); +public class MemoryLeakServlet3 extends AbstractServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { @@ -28,25 +22,24 @@ protected void doGet(HttpServletRequest req, HttpServletResponse res) throws Ser Locale locale = req.getLocale(); TimeZone tz = TimeZone.getDefault(); bodyHtml.append(""); - bodyHtml.append(""); + bodyHtml.append(""); bodyHtml.append(""); - bodyHtml.append(""); + bodyHtml.append(""); bodyHtml.append(""); - bodyHtml.append(""); + bodyHtml.append(""); bodyHtml.append(""); bodyHtml.append("
" + MessageUtils.getMsg("label.timezone.id", req.getLocale()) + "
" + getMsg("label.timezone.id", req.getLocale()) + "" + tz.getID() + "
" + MessageUtils.getMsg("label.timezone.name", req.getLocale()) + "
" + getMsg("label.timezone.name", req.getLocale()) + "" + tz.getDisplayName() + "
" + MessageUtils.getMsg("label.timezone.offset", req.getLocale()) + "
" + getMsg("label.timezone.offset", req.getLocale()) + "" + tz.getRawOffset() + "
"); try { toDoRemove(); - bodyHtml.append(MessageUtils.getInfoMsg("msg.note.memoryleak3", req.getLocale())); + bodyHtml.append(getInfoMsg("msg.note.memoryleak3", req.getLocale())); } catch (Exception e) { log.error("Exception occurs: ", e); - bodyHtml.append(MessageUtils.getErrMsg("msg.unknown.exception.occur", new String[] { e.getMessage() }, + bodyHtml.append(getErrMsg("msg.unknown.exception.occur", new String[] { e.getMessage() }, locale)); } finally { - HTTPResponseCreator.createSimpleResponse(req, res, MessageUtils.getMsg("title.memoryleak3.page", locale), - bodyHtml.toString()); + responseToClient(req, res, getMsg("title.memoryleak3.page", locale), bodyHtml.toString()); } } diff --git a/src/main/java/org/t246osslab/easybuggy/troubles/MojibakeServlet.java b/src/main/java/org/t246osslab/easybuggy/troubles/MojibakeServlet.java index 9d42f9a7..2a367044 100644 --- a/src/main/java/org/t246osslab/easybuggy/troubles/MojibakeServlet.java +++ b/src/main/java/org/t246osslab/easybuggy/troubles/MojibakeServlet.java @@ -5,23 +5,17 @@ import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; -import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.commons.lang.WordUtils; import org.owasp.esapi.ESAPI; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.t246osslab.easybuggy.core.utils.HTTPResponseCreator; -import org.t246osslab.easybuggy.core.utils.MessageUtils; +import org.t246osslab.easybuggy.core.servlets.AbstractServlet; // EncodingFilter excludes /mojibake. @SuppressWarnings("serial") @WebServlet(urlPatterns = { "/mojibake" }) -public class MojibakeServlet extends HttpServlet { - - private static final Logger log = LoggerFactory.getLogger(MojibakeServlet.class); +public class MojibakeServlet extends AbstractServlet { @Override protected void service(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { @@ -35,27 +29,26 @@ protected void service(HttpServletRequest req, HttpServletResponse res) throws S StringBuilder bodyHtml = new StringBuilder(); bodyHtml.append("
"); - bodyHtml.append(MessageUtils.getMsg("description.capitalize.string", locale)); + bodyHtml.append(getMsg("description.capitalize.string", locale)); bodyHtml.append("

"); - bodyHtml.append(MessageUtils.getMsg("label.string", locale) + ": "); + bodyHtml.append(getMsg("label.string", locale) + ": "); bodyHtml.append(""); bodyHtml.append("

"); - bodyHtml.append(""); + bodyHtml.append(""); bodyHtml.append("

"); if (string != null && !"".equals(string)) { // Capitalize the given string String capitalizeName = WordUtils.capitalize(string); - bodyHtml.append(MessageUtils.getMsg("label.capitalized.string", locale) + " : " + ESAPI.encoder().encodeForHTML(capitalizeName)); + bodyHtml.append(getMsg("label.capitalized.string", locale) + " : " + encodeForHTML(capitalizeName)); } else { - bodyHtml.append(MessageUtils.getMsg("msg.enter.string", locale)); + bodyHtml.append(getMsg("msg.enter.string", locale)); } bodyHtml.append("

"); - bodyHtml.append(MessageUtils.getInfoMsg("msg.note.mojibake", locale)); + bodyHtml.append(getInfoMsg("msg.note.mojibake", locale)); bodyHtml.append("
"); - HTTPResponseCreator.createSimpleResponse(req, res, MessageUtils.getMsg("title.mojibake.page", locale), - bodyHtml.toString()); + responseToClient(req, res, getMsg("title.mojibake.page", locale), bodyHtml.toString()); } catch (Exception e) { log.error("Exception occurs: ", e); diff --git a/src/main/java/org/t246osslab/easybuggy/troubles/NetworkSocketLeakServlet.java b/src/main/java/org/t246osslab/easybuggy/troubles/NetworkSocketLeakServlet.java index 7ab2637d..fbff0d7a 100644 --- a/src/main/java/org/t246osslab/easybuggy/troubles/NetworkSocketLeakServlet.java +++ b/src/main/java/org/t246osslab/easybuggy/troubles/NetworkSocketLeakServlet.java @@ -7,26 +7,20 @@ import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; -import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.t246osslab.easybuggy.core.utils.HTTPResponseCreator; -import org.t246osslab.easybuggy.core.utils.MessageUtils; +import org.t246osslab.easybuggy.core.servlets.AbstractServlet; @SuppressWarnings("serial") @WebServlet(urlPatterns = { "/netsocketleak" }) -public class NetworkSocketLeakServlet extends HttpServlet { - - private static final Logger log = LoggerFactory.getLogger(NetworkSocketLeakServlet.class); +public class NetworkSocketLeakServlet extends AbstractServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { - HttpURLConnection connection = null; - URL url = null; + HttpURLConnection connection; + URL url; StringBuilder bodyHtml = new StringBuilder(); Locale locale = req.getLocale(); try { @@ -42,24 +36,23 @@ protected void doGet(HttpServletRequest req, HttpServletResponse res) throws Ser int responseCode = connection.getResponseCode(); long end = System.currentTimeMillis(); - bodyHtml.append("

"+MessageUtils.getMsg("description.response.time", req.getLocale())+"

"); + bodyHtml.append("

"+getMsg("description.response.time", req.getLocale())+"

"); bodyHtml.append(""); - bodyHtml.append(""); + bodyHtml.append(""); bodyHtml.append(""); - bodyHtml.append(""); + bodyHtml.append(""); bodyHtml.append(""); - bodyHtml.append(""); + bodyHtml.append(""); bodyHtml.append(""); bodyHtml.append("
" + MessageUtils.getMsg("label.ping.url", locale) + "
" + getMsg("label.ping.url", locale) + "" + pingURL + "
" + MessageUtils.getMsg("label.response.code", req.getLocale()) + "
" + getMsg("label.response.code", req.getLocale()) + "" + responseCode + "
" + MessageUtils.getMsg("label.response.time", locale) + "
" + getMsg("label.response.time", locale) + "" + (end - start) + "
"); - bodyHtml.append(MessageUtils.getInfoMsg("msg.note.netsocketleak", req.getLocale())); + bodyHtml.append(getInfoMsg("msg.note.netsocketleak", req.getLocale())); } catch (Exception e) { log.error("Exception occurs: ", e); - bodyHtml.append(MessageUtils.getErrMsg("msg.unknown.exception.occur", new String[] { e.getMessage() }, + bodyHtml.append(getErrMsg("msg.unknown.exception.occur", new String[] { e.getMessage() }, locale)); } finally { - HTTPResponseCreator.createSimpleResponse(req, res, MessageUtils.getMsg("title.netsocketleak.page", locale), - bodyHtml.toString()); + responseToClient(req, res, getMsg("title.netsocketleak.page", locale), bodyHtml.toString()); } } } diff --git a/src/main/java/org/t246osslab/easybuggy/troubles/RedirectLoopServlet.java b/src/main/java/org/t246osslab/easybuggy/troubles/RedirectLoopServlet.java index 75a74fcf..fe67265b 100644 --- a/src/main/java/org/t246osslab/easybuggy/troubles/RedirectLoopServlet.java +++ b/src/main/java/org/t246osslab/easybuggy/troubles/RedirectLoopServlet.java @@ -4,13 +4,14 @@ import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; -import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; +import org.t246osslab.easybuggy.core.servlets.AbstractServlet; + @SuppressWarnings("serial") @WebServlet(urlPatterns = { "/redirectloop" }) -public class RedirectLoopServlet extends HttpServlet { +public class RedirectLoopServlet extends AbstractServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { diff --git a/src/main/java/org/t246osslab/easybuggy/troubles/RoundOffErrorServlet.java b/src/main/java/org/t246osslab/easybuggy/troubles/RoundOffErrorServlet.java index 28a4fbb8..1da3c9e6 100644 --- a/src/main/java/org/t246osslab/easybuggy/troubles/RoundOffErrorServlet.java +++ b/src/main/java/org/t246osslab/easybuggy/troubles/RoundOffErrorServlet.java @@ -5,21 +5,15 @@ import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; -import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.commons.lang.math.NumberUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.t246osslab.easybuggy.core.utils.HTTPResponseCreator; -import org.t246osslab.easybuggy.core.utils.MessageUtils; +import org.t246osslab.easybuggy.core.servlets.AbstractServlet; @SuppressWarnings("serial") @WebServlet(urlPatterns = { "/roe" }) -public class RoundOffErrorServlet extends HttpServlet { - - private static final Logger log = LoggerFactory.getLogger(RoundOffErrorServlet.class); +public class RoundOffErrorServlet extends AbstractServlet { @Override protected void service(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { @@ -30,7 +24,7 @@ protected void service(HttpServletRequest req, HttpServletResponse res) throws S StringBuilder bodyHtml = new StringBuilder(); bodyHtml.append("
"); - bodyHtml.append(MessageUtils.getMsg("msg.enter.positive.number", locale)); + bodyHtml.append(getMsg("msg.enter.positive.number", locale)); bodyHtml.append("

"); if (1 <= number && number <= 9) { bodyHtml.append("
"); - bodyHtml.append(""); + bodyHtml.append(""); bodyHtml.append("

"); - bodyHtml.append(MessageUtils.getInfoMsg("msg.note.roundofferror", locale)); + bodyHtml.append(getInfoMsg("msg.note.roundofferror", locale)); bodyHtml.append("
"); - HTTPResponseCreator.createSimpleResponse(req, res, MessageUtils.getMsg("title.roundofferror.page", locale), - bodyHtml.toString()); + responseToClient(req, res, getMsg("title.roundofferror.page", locale), bodyHtml.toString()); } catch (Exception e) { log.error("Exception occurs: ", e); diff --git a/src/main/java/org/t246osslab/easybuggy/troubles/ThreadLeakServlet.java b/src/main/java/org/t246osslab/easybuggy/troubles/ThreadLeakServlet.java index 555b0251..44538f8b 100644 --- a/src/main/java/org/t246osslab/easybuggy/troubles/ThreadLeakServlet.java +++ b/src/main/java/org/t246osslab/easybuggy/troubles/ThreadLeakServlet.java @@ -7,20 +7,16 @@ import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; -import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.t246osslab.easybuggy.core.utils.HTTPResponseCreator; -import org.t246osslab.easybuggy.core.utils.MessageUtils; +import org.t246osslab.easybuggy.core.servlets.AbstractServlet; @SuppressWarnings("serial") @WebServlet(urlPatterns = { "/threadleak" }) -public class ThreadLeakServlet extends HttpServlet { - - private static final Logger log = LoggerFactory.getLogger(ThreadLeakServlet.class); +public class ThreadLeakServlet extends AbstractServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { @@ -31,18 +27,17 @@ protected void doGet(HttpServletRequest req, HttpServletResponse res) throws Ser sub.start(); ThreadMXBean bean = ManagementFactory.getThreadMXBean(); - bodyHtml.append(MessageUtils.getMsg("label.current.thread.count", locale) + ": "); + bodyHtml.append(getMsg("label.current.thread.count", locale) + ": "); bodyHtml.append(bean.getAllThreadIds().length); bodyHtml.append("

"); - bodyHtml.append(MessageUtils.getInfoMsg("msg.note.threadleak", req.getLocale())); + bodyHtml.append(getInfoMsg("msg.note.threadleak", req.getLocale())); } catch (Exception e) { log.error("Exception occurs: ", e); - bodyHtml.append(MessageUtils.getErrMsg("msg.unknown.exception.occur", new String[] { e.getMessage() }, + bodyHtml.append(getErrMsg("msg.unknown.exception.occur", new String[] { e.getMessage() }, locale)); } finally { - HTTPResponseCreator.createSimpleResponse(req, res, - MessageUtils.getMsg("title.threadleak.page", locale), bodyHtml.toString()); + responseToClient(req, res, getMsg("title.threadleak.page", locale), bodyHtml.toString()); } } } diff --git a/src/main/java/org/t246osslab/easybuggy/troubles/TruncationErrorServlet.java b/src/main/java/org/t246osslab/easybuggy/troubles/TruncationErrorServlet.java index 4e091750..29f9f17f 100644 --- a/src/main/java/org/t246osslab/easybuggy/troubles/TruncationErrorServlet.java +++ b/src/main/java/org/t246osslab/easybuggy/troubles/TruncationErrorServlet.java @@ -5,21 +5,15 @@ import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; -import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.commons.lang.math.NumberUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.t246osslab.easybuggy.core.utils.HTTPResponseCreator; -import org.t246osslab.easybuggy.core.utils.MessageUtils; +import org.t246osslab.easybuggy.core.servlets.AbstractServlet; @SuppressWarnings("serial") @WebServlet(urlPatterns = { "/te" }) -public class TruncationErrorServlet extends HttpServlet { - - private static final Logger log = LoggerFactory.getLogger(TruncationErrorServlet.class); +public class TruncationErrorServlet extends AbstractServlet { @Override protected void service(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { @@ -29,9 +23,9 @@ protected void service(HttpServletRequest req, HttpServletResponse res) throws S try { StringBuilder bodyHtml = new StringBuilder(); bodyHtml.append("
"); - bodyHtml.append(MessageUtils.getMsg("msg.enter.positive.number", locale)); + bodyHtml.append(getMsg("msg.enter.positive.number", locale)); bodyHtml.append("

"); - bodyHtml.append("10.0 " + MessageUtils.getMsg("label.obelus", locale) + " "); + bodyHtml.append("10.0 " + getMsg("label.obelus", locale) + " "); if (0 < number && number < 10) { bodyHtml.append( ""); @@ -43,12 +37,11 @@ protected void service(HttpServletRequest req, HttpServletResponse res) throws S bodyHtml.append(String.valueOf(10.0 / number)); } bodyHtml.append("

"); - bodyHtml.append(""); + bodyHtml.append(""); bodyHtml.append("

"); - bodyHtml.append(MessageUtils.getInfoMsg("msg.note.truncationerror", locale)); + bodyHtml.append(getInfoMsg("msg.note.truncationerror", locale)); bodyHtml.append("
"); - HTTPResponseCreator.createSimpleResponse(req, res, - MessageUtils.getMsg("title.truncationerror.page", locale), bodyHtml.toString()); + responseToClient(req, res, getMsg("title.truncationerror.page", locale), bodyHtml.toString()); } catch (Exception e) { log.error("Exception occurs: ", e); diff --git a/src/main/java/org/t246osslab/easybuggy/vulnerabilities/CSRFServlet.java b/src/main/java/org/t246osslab/easybuggy/vulnerabilities/CSRFServlet.java index 7457d999..aef00256 100644 --- a/src/main/java/org/t246osslab/easybuggy/vulnerabilities/CSRFServlet.java +++ b/src/main/java/org/t246osslab/easybuggy/vulnerabilities/CSRFServlet.java @@ -5,7 +5,6 @@ import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; -import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; @@ -16,40 +15,33 @@ import org.apache.directory.shared.ldap.entry.client.DefaultClientAttribute; import org.apache.directory.shared.ldap.message.ModifyRequestImpl; import org.apache.directory.shared.ldap.name.LdapDN; -import org.owasp.esapi.ESAPI; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import org.t246osslab.easybuggy.core.dao.EmbeddedADS; -import org.t246osslab.easybuggy.core.utils.HTTPResponseCreator; -import org.t246osslab.easybuggy.core.utils.MessageUtils; +import org.t246osslab.easybuggy.core.servlets.AbstractServlet; @SuppressWarnings("serial") @WebServlet(urlPatterns = { "/admins/csrf" }) -public class CSRFServlet extends HttpServlet { +public class CSRFServlet extends AbstractServlet { - private static final Logger log = LoggerFactory.getLogger(CSRFServlet.class); - @Override protected void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { Locale locale = req.getLocale(); StringBuilder bodyHtml = new StringBuilder(); bodyHtml.append("
"); - bodyHtml.append(MessageUtils.getMsg("msg.enter.passwd", locale)); + bodyHtml.append(getMsg("msg.enter.passwd", locale)); bodyHtml.append("

"); - bodyHtml.append(MessageUtils.getMsg("label.password", locale) + ": "); + bodyHtml.append(getMsg("label.password", locale) + ": "); bodyHtml.append(""); bodyHtml.append("

"); - bodyHtml.append(""); + bodyHtml.append(""); bodyHtml.append("

"); String errorMessage = (String) req.getAttribute("errorMessage"); if (errorMessage != null) { bodyHtml.append(errorMessage); } - bodyHtml.append(MessageUtils.getInfoMsg("msg.note.csrf", locale)); + bodyHtml.append(getInfoMsg("msg.note.csrf", locale)); bodyHtml.append("
"); - HTTPResponseCreator.createSimpleResponse(req, res, MessageUtils.getMsg("title.csrf.page", locale), - bodyHtml.toString()); + responseToClient(req, res, getMsg("title.csrf.page", locale), bodyHtml.toString()); } @Override @@ -64,36 +56,33 @@ protected void doPost(HttpServletRequest req, HttpServletResponse res) throws Se String password = StringUtils.trim(req.getParameter("password")); if (!StringUtils.isBlank(userid) && !StringUtils.isBlank(password) && password.length() >= 8) { try { - DefaultClientAttribute entryAttribute = new DefaultClientAttribute("userPassword", ESAPI.encoder() - .encodeForLDAP(password.trim())); + DefaultClientAttribute entryAttribute = new DefaultClientAttribute("userPassword", encodeForLDAP(password.trim())); ClientModification clientModification = new ClientModification(); clientModification.setAttribute(entryAttribute); clientModification.setOperation(ModificationOperation.REPLACE_ATTRIBUTE); ModifyRequestImpl modifyRequest = new ModifyRequestImpl(1); - modifyRequest.setName(new LdapDN("uid=" + ESAPI.encoder().encodeForLDAP(userid.trim()) + modifyRequest.setName(new LdapDN("uid=" + encodeForLDAP(userid.trim()) + ",ou=people,dc=t246osslab,dc=org")); modifyRequest.addModification(clientModification); EmbeddedADS.getAdminSession().modify(modifyRequest); StringBuilder bodyHtml = new StringBuilder(); bodyHtml.append("
"); - bodyHtml.append(MessageUtils.getMsg("msg.passwd.changed", locale)); + bodyHtml.append(getMsg("msg.passwd.changed", locale)); bodyHtml.append("

"); - bodyHtml.append("" + MessageUtils.getMsg("label.goto.admin.page", locale) - + ""); + bodyHtml.append("" + getMsg("label.goto.admin.page", locale) + ""); bodyHtml.append("
"); - HTTPResponseCreator.createSimpleResponse(req, res, MessageUtils.getMsg("title.csrf.page", locale), - bodyHtml.toString()); + responseToClient(req, res, getMsg("title.csrf.page", locale), bodyHtml.toString()); } catch (Exception e) { log.error("Exception occurs: ", e); - req.setAttribute("errorMessage", MessageUtils.getErrMsg("msg.passwd.change.failed", locale)); + req.setAttribute("errorMessage", getErrMsg("msg.passwd.change.failed", locale)); doGet(req, res); } } else { if (StringUtils.isBlank(password) || password.length() < 8) { - req.setAttribute("errorMessage", MessageUtils.getErrMsg("msg.passwd.is.too.short", locale)); + req.setAttribute("errorMessage", getErrMsg("msg.passwd.is.too.short", locale)); } else { - req.setAttribute("errorMessage", MessageUtils.getErrMsg("msg.unknown.exception.occur", + req.setAttribute("errorMessage", getErrMsg("msg.unknown.exception.occur", new String[] { "userid: " + userid }, locale)); } doGet(req, res); diff --git a/src/main/java/org/t246osslab/easybuggy/vulnerabilities/ClickJackingServlet.java b/src/main/java/org/t246osslab/easybuggy/vulnerabilities/ClickJackingServlet.java index bed1988f..ac592c79 100644 --- a/src/main/java/org/t246osslab/easybuggy/vulnerabilities/ClickJackingServlet.java +++ b/src/main/java/org/t246osslab/easybuggy/vulnerabilities/ClickJackingServlet.java @@ -3,11 +3,8 @@ import java.io.IOException; import java.util.Locale; -import javax.mail.internet.AddressException; -import javax.mail.internet.InternetAddress; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; -import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; @@ -18,40 +15,34 @@ import org.apache.directory.shared.ldap.entry.client.DefaultClientAttribute; import org.apache.directory.shared.ldap.message.ModifyRequestImpl; import org.apache.directory.shared.ldap.name.LdapDN; -import org.owasp.esapi.ESAPI; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import org.t246osslab.easybuggy.core.dao.EmbeddedADS; -import org.t246osslab.easybuggy.core.utils.HTTPResponseCreator; -import org.t246osslab.easybuggy.core.utils.MessageUtils; +import org.t246osslab.easybuggy.core.servlets.AbstractServlet; +import org.t246osslab.easybuggy.core.utils.EmailUtils; @SuppressWarnings("serial") @WebServlet(urlPatterns = { "/admins/clickjacking" }) -public class ClickJackingServlet extends HttpServlet { +public class ClickJackingServlet extends AbstractServlet { - private static final Logger log = LoggerFactory.getLogger(ClickJackingServlet.class); - @Override protected void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { Locale locale = req.getLocale(); StringBuilder bodyHtml = new StringBuilder(); bodyHtml.append("
"); - bodyHtml.append(MessageUtils.getMsg("msg.enter.mail", locale)); + bodyHtml.append(getMsg("msg.enter.mail", locale)); bodyHtml.append("

"); - bodyHtml.append(MessageUtils.getMsg("label.mail", locale) + ": "); + bodyHtml.append(getMsg("label.mail", locale) + ": "); bodyHtml.append(""); bodyHtml.append("

"); - bodyHtml.append(""); + bodyHtml.append(""); bodyHtml.append("

"); String errorMessage = (String) req.getAttribute("errorMessage"); if (errorMessage != null) { bodyHtml.append(errorMessage); } - bodyHtml.append(MessageUtils.getInfoMsg("msg.note.clickjacking", locale)); + bodyHtml.append(getInfoMsg("msg.note.clickjacking", locale)); bodyHtml.append("
"); - HTTPResponseCreator.createSimpleResponse(req, res, MessageUtils.getMsg("title.clickjacking.page", locale), - bodyHtml.toString()); + responseToClient(req, res, getMsg("title.clickjacking.page", locale), bodyHtml.toString()); } @Override @@ -68,48 +59,33 @@ protected void doPost(HttpServletRequest req, HttpServletResponse res) throws Se return; } String mail = StringUtils.trim(req.getParameter("mail")); - if (!StringUtils.isBlank(mail) && isValidEmailAddress(mail)) { + if (!StringUtils.isBlank(mail) && EmailUtils.isValidEmailAddress(mail)) { try { - DefaultClientAttribute entryAttribute = new DefaultClientAttribute("mail", ESAPI.encoder() - .encodeForLDAP(mail.trim())); + DefaultClientAttribute entryAttribute = new DefaultClientAttribute("mail", encodeForLDAP(mail.trim())); ClientModification clientModification = new ClientModification(); clientModification.setAttribute(entryAttribute); clientModification.setOperation(ModificationOperation.REPLACE_ATTRIBUTE); ModifyRequestImpl modifyRequest = new ModifyRequestImpl(1); - modifyRequest.setName(new LdapDN("uid=" + ESAPI.encoder().encodeForLDAP(userid.trim()) + modifyRequest.setName(new LdapDN("uid=" + encodeForLDAP(userid.trim()) + ",ou=people,dc=t246osslab,dc=org")); modifyRequest.addModification(clientModification); EmbeddedADS.getAdminSession().modify(modifyRequest); StringBuilder bodyHtml = new StringBuilder(); bodyHtml.append("
"); - bodyHtml.append(MessageUtils.getMsg("msg.mail.changed", locale)); + bodyHtml.append(getMsg("msg.mail.changed", locale)); bodyHtml.append("

"); - bodyHtml.append("" + MessageUtils.getMsg("label.goto.admin.page", locale) - + ""); + bodyHtml.append("" + getMsg("label.goto.admin.page", locale) + ""); bodyHtml.append("
"); - HTTPResponseCreator.createSimpleResponse(req, res, MessageUtils.getMsg("title.clickjacking.page", locale), - bodyHtml.toString()); + responseToClient(req, res, getMsg("title.clickjacking.page", locale), bodyHtml.toString()); } catch (Exception e) { log.error("Exception occurs: ", e); - req.setAttribute("errorMessage", MessageUtils.getErrMsg("msg.mail.change.failed", locale)); + req.setAttribute("errorMessage", getErrMsg("msg.mail.change.failed", locale)); doGet(req, res); } } else { - req.setAttribute("errorMessage", MessageUtils.getErrMsg("msg.mail.format.is.invalid", locale)); + req.setAttribute("errorMessage", getErrMsg("msg.mail.format.is.invalid", locale)); doGet(req, res); } } - - public boolean isValidEmailAddress(String email) { - boolean result = true; - try { - InternetAddress emailAddr = new InternetAddress(email); - emailAddr.validate(); - } catch (AddressException e) { - log.debug("Mail address is invalid: " + email, e); - result = false; - } - return result; - } } diff --git a/src/main/java/org/t246osslab/easybuggy/vulnerabilities/CodeInjectionServlet.java b/src/main/java/org/t246osslab/easybuggy/vulnerabilities/CodeInjectionServlet.java index 3650cd88..5293842c 100644 --- a/src/main/java/org/t246osslab/easybuggy/vulnerabilities/CodeInjectionServlet.java +++ b/src/main/java/org/t246osslab/easybuggy/vulnerabilities/CodeInjectionServlet.java @@ -8,22 +8,16 @@ import javax.script.ScriptException; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; -import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.commons.lang.StringUtils; import org.owasp.esapi.ESAPI; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.t246osslab.easybuggy.core.utils.HTTPResponseCreator; -import org.t246osslab.easybuggy.core.utils.MessageUtils; +import org.t246osslab.easybuggy.core.servlets.AbstractServlet; @SuppressWarnings("serial") @WebServlet(urlPatterns = { "/codeijc" }) -public class CodeInjectionServlet extends HttpServlet { - - private static final Logger log = LoggerFactory.getLogger(CodeInjectionServlet.class); +public class CodeInjectionServlet extends AbstractServlet { @Override protected void service(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { @@ -35,17 +29,16 @@ protected void service(HttpServletRequest req, HttpServletResponse res) throws S StringBuilder bodyHtml = new StringBuilder(); bodyHtml.append("
"); - bodyHtml.append(MessageUtils.getMsg("description.parse.json", locale)); + bodyHtml.append(getMsg("description.parse.json", locale)); bodyHtml.append("

"); - bodyHtml.append(MessageUtils.getMsg("label.json.string", locale) + ": "); + bodyHtml.append(getMsg("label.json.string", locale) + ": "); + bodyHtml.append(""); - } else { - bodyHtml.append(""); + bodyHtml.append(encodeForHTML(jsonString)); } + bodyHtml.append(""); bodyHtml.append("

"); - bodyHtml.append(""); + bodyHtml.append(""); bodyHtml.append("

"); if (!StringUtils.isBlank(jsonString)) { @@ -54,14 +47,13 @@ protected void service(HttpServletRequest req, HttpServletResponse res) throws S jsonString = jsonString.replaceAll("\n", ""); parseJson(jsonString, locale, bodyHtml); } else { - bodyHtml.append(MessageUtils.getMsg("msg.enter.json.string", locale)); + bodyHtml.append(getMsg("msg.enter.json.string", locale)); bodyHtml.append("

"); } - bodyHtml.append(MessageUtils.getInfoMsg("msg.note.codeinjection", locale)); + bodyHtml.append(getInfoMsg("msg.note.codeinjection", locale)); bodyHtml.append("
"); - HTTPResponseCreator.createSimpleResponse(req, res, MessageUtils.getMsg("title.codeinjection.page", locale), - bodyHtml.toString()); + responseToClient(req, res, getMsg("title.codeinjection.page", locale), bodyHtml.toString()); } catch (Exception e) { log.error("Exception occurs: ", e); } @@ -72,14 +64,14 @@ private void parseJson(String jsonString, Locale locale, StringBuilder bodyHtml) ScriptEngineManager manager = new ScriptEngineManager(); ScriptEngine scriptEngine = manager.getEngineByName("JavaScript"); scriptEngine.eval("JSON.parse('" + jsonString + "')"); - bodyHtml.append(MessageUtils.getMsg("msg.valid.json", locale)); + bodyHtml.append(getMsg("msg.valid.json", locale)); bodyHtml.append("

"); } catch (ScriptException e) { - bodyHtml.append(MessageUtils.getErrMsg("msg.invalid.json", new String[] { ESAPI.encoder() + bodyHtml.append(getErrMsg("msg.invalid.json", new String[] { ESAPI.encoder() .encodeForHTML(e.getMessage()) }, locale)); } catch (Exception e) { log.error("Exception occurs: ", e); - bodyHtml.append(MessageUtils.getErrMsg("msg.invalid.json", new String[] { ESAPI.encoder() + bodyHtml.append(getErrMsg("msg.invalid.json", new String[] { ESAPI.encoder() .encodeForHTML(e.getMessage()) }, locale)); } } diff --git a/src/main/java/org/t246osslab/easybuggy/vulnerabilities/LDAPInjectionServlet.java b/src/main/java/org/t246osslab/easybuggy/vulnerabilities/LDAPInjectionServlet.java index b18c8123..d4d1aa70 100644 --- a/src/main/java/org/t246osslab/easybuggy/vulnerabilities/LDAPInjectionServlet.java +++ b/src/main/java/org/t246osslab/easybuggy/vulnerabilities/LDAPInjectionServlet.java @@ -14,8 +14,6 @@ import org.apache.directory.shared.ldap.filter.SearchScope; import org.apache.directory.shared.ldap.message.AliasDerefMode; import org.apache.directory.shared.ldap.name.LdapDN; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import org.t246osslab.easybuggy.core.dao.EmbeddedADS; import org.t246osslab.easybuggy.core.servlets.DefaultLoginServlet; @@ -23,8 +21,6 @@ @WebServlet(urlPatterns = { "/ldapijc/login" }) public class LDAPInjectionServlet extends DefaultLoginServlet { - private static final Logger log = LoggerFactory.getLogger(LDAPInjectionServlet.class); - @Override public void doGet(HttpServletRequest req, HttpServletResponse res) throws IOException, ServletException { req.setAttribute("login.page.note", "msg.note.ldap.injection"); @@ -32,17 +28,16 @@ public void doGet(HttpServletRequest req, HttpServletResponse res) throws IOExce } @Override - protected boolean authUser(String username, String password) { + protected boolean authUser(String uid, String password) { - if (StringUtils.isBlank(username) || username.length() < 5 || StringUtils.isBlank(password) - || password.length() < 8) { + if (StringUtils.isBlank(uid) || uid.length() < 5 || StringUtils.isBlank(password) || password.length() < 8) { return false; } ExprNode filter = null; EntryFilteringCursor cursor = null; try { - filter = FilterParser.parse("(&(uid=" + username.trim() + ")(userPassword=" + password.trim() + "))"); + filter = FilterParser.parse("(&(uid=" + uid.trim() + ")(userPassword=" + password.trim() + "))"); cursor = EmbeddedADS.getAdminSession().search(new LdapDN("ou=people,dc=t246osslab,dc=org"), SearchScope.SUBTREE, filter, AliasDerefMode.NEVER_DEREF_ALIASES, null); if (cursor.available()) { diff --git a/src/main/java/org/t246osslab/easybuggy/vulnerabilities/MailHeaderInjectionServlet.java b/src/main/java/org/t246osslab/easybuggy/vulnerabilities/MailHeaderInjectionServlet.java index 9582c9df..4ff4536d 100644 --- a/src/main/java/org/t246osslab/easybuggy/vulnerabilities/MailHeaderInjectionServlet.java +++ b/src/main/java/org/t246osslab/easybuggy/vulnerabilities/MailHeaderInjectionServlet.java @@ -12,18 +12,15 @@ import javax.servlet.ServletException; import javax.servlet.annotation.MultipartConfig; import javax.servlet.annotation.WebServlet; -import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.Part; import org.apache.commons.lang.StringUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; +import org.t246osslab.easybuggy.core.servlets.AbstractServlet; import org.t246osslab.easybuggy.core.utils.Closer; import org.t246osslab.easybuggy.core.utils.EmailUtils; -import org.t246osslab.easybuggy.core.utils.HTTPResponseCreator; -import org.t246osslab.easybuggy.core.utils.MessageUtils; +import org.t246osslab.easybuggy.core.utils.MultiPartFileUtils; /** * A servlet that takes message details from user and send it as a new mail through an SMTP server. @@ -34,47 +31,44 @@ @MultipartConfig(fileSizeThreshold = 1024 * 1024 * 2, // 2MB maxFileSize = 1024 * 1024 * 10, // 10MB maxRequestSize = 1024 * 1024 * 50) // 50MB -public class MailHeaderInjectionServlet extends HttpServlet { +public class MailHeaderInjectionServlet extends AbstractServlet { - private static final Logger log = LoggerFactory.getLogger(MailHeaderInjectionServlet.class); - @Override protected void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { Locale locale = req.getLocale(); if (!EmailUtils.isReadyToSendEmail()) { - HTTPResponseCreator.createSimpleResponse(req, res, - MessageUtils.getMsg("title.mailheaderinjection.page", locale), - MessageUtils.getInfoMsg("msg.smtp.server.not.setup", locale)); + responseToClient(req, res, getMsg("title.mailheaderinjection.page", locale), + getInfoMsg("msg.smtp.server.not.setup", locale)); return; } StringBuilder bodyHtml = new StringBuilder(); - bodyHtml.append(MessageUtils.getMsg("description.send.mail", locale)); + bodyHtml.append(getMsg("description.send.mail", locale)); bodyHtml.append("

"); bodyHtml.append("
"); bodyHtml.append(""); bodyHtml.append(""); - bodyHtml.append(""); + bodyHtml.append(""); bodyHtml.append(""); bodyHtml.append(""); bodyHtml.append(""); - bodyHtml.append(""); + bodyHtml.append(""); bodyHtml.append(""); bodyHtml.append(""); bodyHtml.append(""); - bodyHtml.append(""); + bodyHtml.append(""); bodyHtml.append(""); bodyHtml.append(""); bodyHtml.append(""); - bodyHtml.append(""); + bodyHtml.append(""); bodyHtml.append(""); bodyHtml.append(""); bodyHtml.append(""); - bodyHtml.append(""); + bodyHtml.append(""); bodyHtml.append(""); bodyHtml.append(""); bodyHtml.append(""); bodyHtml.append(""); + + getMsg("label.submit", locale) + "\"/>"); bodyHtml.append(""); bodyHtml.append("
" + MessageUtils.getMsg("label.your.name", locale) + ": 

" + getMsg("label.your.name", locale) + ": 



" + MessageUtils.getMsg("label.your.mail", locale) + ": 

" + getMsg("label.your.mail", locale) + ": 



" + MessageUtils.getMsg("label.subject", locale) + ": 

" + getMsg("label.subject", locale) + ": 



" + MessageUtils.getMsg("label.content", locale) + ": 

" + getMsg("label.content", locale) + ": 



" + MessageUtils.getMsg("label.attach.file", locale) + ": 

" + getMsg("label.attach.file", locale) + ": 


"); bodyHtml.append("
"); @@ -82,10 +76,9 @@ protected void doGet(HttpServletRequest req, HttpServletResponse res) throws Ser bodyHtml.append(req.getAttribute("message") + "

"); req.setAttribute("message", null); } - bodyHtml.append(MessageUtils.getInfoMsg("msg.note.mailheaderinjection", locale)); + bodyHtml.append(getInfoMsg("msg.note.mailheaderinjection", locale)); bodyHtml.append("
"); - HTTPResponseCreator.createSimpleResponse(req, res, MessageUtils.getMsg("title.mailheaderinjection.page", locale), - bodyHtml.toString()); + responseToClient(req, res, getMsg("title.mailheaderinjection.page", locale), bodyHtml.toString()); } @Override @@ -100,21 +93,21 @@ protected void doPost(HttpServletRequest req, HttpServletResponse res) throws Se String subject = req.getParameter("subject"); String content = req.getParameter("content"); if (StringUtils.isBlank(subject) || StringUtils.isBlank(content)) { - resultMessage = MessageUtils.getMsg("msg.mail.is.empty", locale); + resultMessage = getMsg("msg.mail.is.empty", locale); req.setAttribute("message", resultMessage); doGet(req, res); return; } StringBuilder sb = new StringBuilder(); - sb.append(MessageUtils.getMsg("label.name", locale)).append(": ").append(name).append("
"); - sb.append(MessageUtils.getMsg("label.mail", locale)).append(": ").append(mail).append("
").append("
"); - sb.append(MessageUtils.getMsg("label.content", locale)).append(": ").append(content).append("
"); + sb.append(getMsg("label.name", locale)).append(": ").append(name).append("
"); + sb.append(getMsg("label.mail", locale)).append(": ").append(mail).append("
").append("
"); + sb.append(getMsg("label.content", locale)).append(": ").append(content).append("
"); try { EmailUtils.sendEmailWithAttachment(subject, sb.toString(), uploadedFiles); - resultMessage = MessageUtils.getMsg("msg.sent.mail", locale); + resultMessage = getMsg("msg.sent.mail", locale); } catch (Exception e) { log.error("Exception occurs: ", e); - resultMessage = MessageUtils.getErrMsg("msg.unknown.exception.occur", new String[]{e.getMessage()}, locale); + resultMessage = getErrMsg("msg.unknown.exception.occur", new String[]{e.getMessage()}, locale); } finally { deleteUploadFiles(uploadedFiles); req.setAttribute("message", resultMessage); @@ -136,7 +129,7 @@ private List saveUploadedFiles(HttpServletRequest request) if (!multiparts.isEmpty()) { for (Part part : request.getParts()) { // creates a file to be saved - String fileName = extractFileName(part); + String fileName = MultiPartFileUtils.getFileName(part); if (StringUtils.isBlank(fileName)) { // not attachment part, continue continue; @@ -168,20 +161,6 @@ private List saveUploadedFiles(HttpServletRequest request) return listFiles; } - /** - * Retrieves file name of a upload part from its HTTP header - */ - private String extractFileName(Part part) { - String contentDisp = part.getHeader("content-disposition"); - String[] items = contentDisp.split(";"); - for (String s : items) { - if (s.trim().startsWith("filename")) { - return s.substring(s.indexOf('=') + 2, s.length() - 1); - } - } - return null; - } - /** * Deletes all uploaded files, should be called after the e-mail was sent. */ diff --git a/src/main/java/org/t246osslab/easybuggy/vulnerabilities/NullByteInjectionServlet.java b/src/main/java/org/t246osslab/easybuggy/vulnerabilities/NullByteInjectionServlet.java index cb614bc3..bb89f444 100644 --- a/src/main/java/org/t246osslab/easybuggy/vulnerabilities/NullByteInjectionServlet.java +++ b/src/main/java/org/t246osslab/easybuggy/vulnerabilities/NullByteInjectionServlet.java @@ -10,37 +10,31 @@ import javax.servlet.ServletException; import javax.servlet.ServletOutputStream; import javax.servlet.annotation.WebServlet; -import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.commons.lang.StringUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; +import org.t246osslab.easybuggy.core.servlets.AbstractServlet; import org.t246osslab.easybuggy.core.utils.Closer; -import org.t246osslab.easybuggy.core.utils.HTTPResponseCreator; -import org.t246osslab.easybuggy.core.utils.MessageUtils; @SuppressWarnings("serial") @WebServlet("/nullbyteijct") -public class NullByteInjectionServlet extends HttpServlet { +public class NullByteInjectionServlet extends AbstractServlet { - private static final Logger log = LoggerFactory.getLogger(NullByteInjectionServlet.class); - @Override + @Override protected void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { ServletOutputStream os = null; InputStream fis = null; Locale locale = req.getLocale(); StringBuilder bodyHtml = new StringBuilder(); - bodyHtml.append("

" + MessageUtils.getMsg("msg.download.file", locale) + "

"); + bodyHtml.append("

" + getMsg("msg.download.file", locale) + "

"); bodyHtml.append(""); - bodyHtml.append("

" + MessageUtils.getInfoMsg("msg.note.nullbyteinjection", locale) + "

"); + bodyHtml.append("

" + getInfoMsg("msg.note.nullbyteinjection", locale) + "

"); try { String fileName = req.getParameter("fileName"); if (StringUtils.isBlank(fileName)) { - HTTPResponseCreator.createSimpleResponse(req, res, MessageUtils.getMsg("title.nullbyteinjection.page", locale), - bodyHtml.toString()); + responseToClient(req, res, getMsg("title.nullbyteinjection.page", locale), bodyHtml.toString()); return; } else { fileName = fileName + ".pdf"; @@ -51,8 +45,7 @@ protected void doGet(HttpServletRequest req, HttpServletResponse res) throws Ser File file = new File(appPath + File.separator + "pdf" + File.separator + fileName); if (!file.exists()) { - HTTPResponseCreator.createSimpleResponse(req, res, MessageUtils.getMsg("title.nullbyteinjection.page", locale), - bodyHtml.toString()); + responseToClient(req, res, getMsg("title.nullbyteinjection.page", locale), bodyHtml.toString()); return; } log.debug("File location on server::" + file.getAbsolutePath()); diff --git a/src/main/java/org/t246osslab/easybuggy/vulnerabilities/OGNLExpressionInjectionServlet.java b/src/main/java/org/t246osslab/easybuggy/vulnerabilities/OGNLExpressionInjectionServlet.java index 7122150e..7a1aa70e 100644 --- a/src/main/java/org/t246osslab/easybuggy/vulnerabilities/OGNLExpressionInjectionServlet.java +++ b/src/main/java/org/t246osslab/easybuggy/vulnerabilities/OGNLExpressionInjectionServlet.java @@ -5,27 +5,21 @@ import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; -import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.apache.commons.lang.StringUtils; -import org.apache.commons.lang.math.NumberUtils; -import org.owasp.esapi.ESAPI; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.t246osslab.easybuggy.core.utils.HTTPResponseCreator; -import org.t246osslab.easybuggy.core.utils.MessageUtils; - import ognl.Ognl; import ognl.OgnlContext; import ognl.OgnlException; +import org.apache.commons.lang.StringUtils; +import org.apache.commons.lang.math.NumberUtils; +import org.owasp.esapi.ESAPI; +import org.t246osslab.easybuggy.core.servlets.AbstractServlet; + @SuppressWarnings("serial") @WebServlet(urlPatterns = { "/ognleijc" }) -public class OGNLExpressionInjectionServlet extends HttpServlet { - - private static final Logger log = LoggerFactory.getLogger(OGNLExpressionInjectionServlet.class); +public class OGNLExpressionInjectionServlet extends AbstractServlet { @Override protected void service(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { @@ -53,28 +47,27 @@ protected void service(HttpServletRequest req, HttpServletResponse res) throws S } bodyHtml.append("
"); - bodyHtml.append(MessageUtils.getMsg("msg.enter.math.expression", locale)); + bodyHtml.append(getMsg("msg.enter.math.expression", locale)); bodyHtml.append("

"); if (expression == null) { bodyHtml.append(""); } else { bodyHtml.append(""); + + encodeForHTML(expression) + "\">"); } bodyHtml.append(" = "); if (value != null && NumberUtils.isNumber(value.toString())) { bodyHtml.append(value); } bodyHtml.append("

"); - bodyHtml.append(""); + bodyHtml.append(""); bodyHtml.append("

"); if (value == null && expression != null) { - bodyHtml.append(MessageUtils.getErrMsg("msg.invalid.expression", new String[] { errMessage }, locale)); + bodyHtml.append(getErrMsg("msg.invalid.expression", new String[] { errMessage }, locale)); } - bodyHtml.append(MessageUtils.getInfoMsg("msg.note.commandinjection", locale)); + bodyHtml.append(getInfoMsg("msg.note.commandinjection", locale)); bodyHtml.append("
"); - HTTPResponseCreator.createSimpleResponse(req, res, - MessageUtils.getMsg("title.commandinjection.page", locale), bodyHtml.toString()); + responseToClient(req, res, getMsg("title.commandinjection.page", locale), bodyHtml.toString()); } } diff --git a/src/main/java/org/t246osslab/easybuggy/vulnerabilities/OpenRedirectServlet.java b/src/main/java/org/t246osslab/easybuggy/vulnerabilities/OpenRedirectServlet.java index 4063d00e..22c0c89e 100644 --- a/src/main/java/org/t246osslab/easybuggy/vulnerabilities/OpenRedirectServlet.java +++ b/src/main/java/org/t246osslab/easybuggy/vulnerabilities/OpenRedirectServlet.java @@ -1,7 +1,6 @@ package org.t246osslab.easybuggy.vulnerabilities; import java.io.IOException; -import java.net.URL; import java.util.Date; import javax.servlet.ServletException; @@ -10,8 +9,6 @@ import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import org.t246osslab.easybuggy.core.model.User; import org.t246osslab.easybuggy.core.servlets.DefaultLoginServlet; @@ -19,8 +16,6 @@ @WebServlet(urlPatterns = { "/openredirect/login" }) public class OpenRedirectServlet extends DefaultLoginServlet { - private static final Logger log = LoggerFactory.getLogger(OpenRedirectServlet.class); - @Override public void doGet(HttpServletRequest req, HttpServletResponse res) throws IOException, ServletException { req.setAttribute("login.page.note", "msg.note.open.redirect"); @@ -28,66 +23,46 @@ public void doGet(HttpServletRequest req, HttpServletResponse res) throws IOExce } @Override - public void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { + public void doPost(HttpServletRequest req, HttpServletResponse res) throws IOException, ServletException { - String userid = request.getParameter("userid"); - String password = request.getParameter("password"); - String loginQueryString = request.getParameter("loginquerystring"); + String userid = req.getParameter("userid"); + String password = req.getParameter("password"); + String loginQueryString = req.getParameter("loginquerystring"); if (loginQueryString == null) { loginQueryString = ""; } else { loginQueryString = "?" + loginQueryString; } - HttpSession session = request.getSession(true); + HttpSession session = req.getSession(true); if (isAccountLocked(userid)) { session.setAttribute("authNMsg", "msg.account.locked"); - response.sendRedirect("/openredirect/login" + loginQueryString); + res.sendRedirect("/openredirect/login" + loginQueryString); } else if (authUser(userid, password)) { - /* Reset account lock */ - User admin = userLoginHistory.get(userid); - if (admin == null) { - User newAdmin = new User(); - newAdmin.setUserId(userid); - admin = userLoginHistory.putIfAbsent(userid, newAdmin); - if (admin == null) { - admin = newAdmin; - } - } - admin.setLoginFailedCount(0); - admin.setLastLoginFailedTime(null); + /* Reset account lock count */ + resetAccountLock(userid); session.setAttribute("authNMsg", "authenticated"); session.setAttribute("userid", userid); - String gotoUrl = request.getParameter("goto"); + String gotoUrl = req.getParameter("goto"); if (gotoUrl != null) { - response.sendRedirect(gotoUrl); + res.sendRedirect(gotoUrl); } else { String target = (String) session.getAttribute("target"); if (target == null) { - response.sendRedirect("/admins/main"); + res.sendRedirect("/admins/main"); } else { session.removeAttribute("target"); - response.sendRedirect(target); + res.sendRedirect(target); } } } else { /* account lock count +1 */ - User admin = userLoginHistory.get(userid); - if (admin == null) { - User newAdmin = new User(); - newAdmin.setUserId(userid); - admin = userLoginHistory.putIfAbsent(userid, newAdmin); - if (admin == null) { - admin = newAdmin; - } - } - admin.setLoginFailedCount(admin.getLoginFailedCount() + 1); - admin.setLastLoginFailedTime(new Date()); + incrementAccountLockNum(userid); session.setAttribute("authNMsg", "msg.authentication.fail"); - response.sendRedirect("/openredirect/login" + loginQueryString); + res.sendRedirect("/openredirect/login" + loginQueryString); } } } diff --git a/src/main/java/org/t246osslab/easybuggy/vulnerabilities/SQLInjectionServlet.java b/src/main/java/org/t246osslab/easybuggy/vulnerabilities/SQLInjectionServlet.java index d13e6bc9..7ec36996 100644 --- a/src/main/java/org/t246osslab/easybuggy/vulnerabilities/SQLInjectionServlet.java +++ b/src/main/java/org/t246osslab/easybuggy/vulnerabilities/SQLInjectionServlet.java @@ -8,23 +8,17 @@ import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; -import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.commons.lang.StringUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import org.t246osslab.easybuggy.core.dao.DBClient; +import org.t246osslab.easybuggy.core.servlets.AbstractServlet; import org.t246osslab.easybuggy.core.utils.Closer; -import org.t246osslab.easybuggy.core.utils.HTTPResponseCreator; -import org.t246osslab.easybuggy.core.utils.MessageUtils; @SuppressWarnings("serial") @WebServlet(urlPatterns = { "/sqlijc" }) -public class SQLInjectionServlet extends HttpServlet { - - private static final Logger log = LoggerFactory.getLogger(SQLInjectionServlet.class); +public class SQLInjectionServlet extends AbstractServlet { @Override protected void service(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { @@ -36,28 +30,27 @@ protected void service(HttpServletRequest req, HttpServletResponse res) throws S StringBuilder bodyHtml = new StringBuilder(); bodyHtml.append("
"); - bodyHtml.append(MessageUtils.getMsg("msg.enter.name.and.passwd", locale)); + bodyHtml.append(getMsg("msg.enter.name.and.passwd", locale)); bodyHtml.append("

"); - bodyHtml.append(MessageUtils.getMsg("label.name", locale) + ": "); + bodyHtml.append(getMsg("label.name", locale) + ": "); bodyHtml.append(""); bodyHtml.append("  "); - bodyHtml.append(MessageUtils.getMsg("label.password", locale) + ": "); + bodyHtml.append(getMsg("label.password", locale) + ": "); bodyHtml.append(""); bodyHtml.append("

"); - bodyHtml.append(""); + bodyHtml.append(""); bodyHtml.append("

"); if (!StringUtils.isBlank(name) && !StringUtils.isBlank(password) && password.length() >= 8) { bodyHtml.append(selectUsers(name, password, req)); } else { - bodyHtml.append(MessageUtils.getMsg("msg.warn.enter.name.and.passwd", locale)); + bodyHtml.append(getMsg("msg.warn.enter.name.and.passwd", locale)); bodyHtml.append("

"); } - bodyHtml.append(MessageUtils.getInfoMsg("msg.note.sqlijc", locale)); + bodyHtml.append(getInfoMsg("msg.note.sqlijc", locale)); bodyHtml.append("
"); - HTTPResponseCreator.createSimpleResponse(req, res, MessageUtils.getMsg("title.sqlijc.page", locale), - bodyHtml.toString()); + responseToClient(req, res, getMsg("title.sqlijc.page", locale), bodyHtml.toString()); } catch (Exception e) { log.error("Exception occurs: ", e); @@ -69,7 +62,7 @@ private String selectUsers(String name, String password, HttpServletRequest req) Connection conn = null; Statement stmt = null; ResultSet rs = null; - String result = MessageUtils.getErrMsg("msg.error.user.not.exist", req.getLocale()); + String result = getErrMsg("msg.error.user.not.exist", req.getLocale()); try { conn = DBClient.getConnection(); stmt = conn.createStatement(); @@ -80,9 +73,9 @@ private String selectUsers(String name, String password, HttpServletRequest req) } if (sb.length() > 0) { result = "" + sb.toString() + "
" - + MessageUtils.getMsg("label.name", req.getLocale()) + + getMsg("label.name", req.getLocale()) + "" - + MessageUtils.getMsg("label.secret", req.getLocale()) + "
"; + + getMsg("label.secret", req.getLocale()) + "" + sb.toString() + "
"; } } catch (Exception e) { log.error("Exception occurs: ", e); diff --git a/src/main/java/org/t246osslab/easybuggy/vulnerabilities/UnrestrictedExtensionUploadServlet.java b/src/main/java/org/t246osslab/easybuggy/vulnerabilities/UnrestrictedExtensionUploadServlet.java index 07c07ff6..034531af 100644 --- a/src/main/java/org/t246osslab/easybuggy/vulnerabilities/UnrestrictedExtensionUploadServlet.java +++ b/src/main/java/org/t246osslab/easybuggy/vulnerabilities/UnrestrictedExtensionUploadServlet.java @@ -2,36 +2,26 @@ import java.awt.image.BufferedImage; import java.io.File; -import java.io.FileNotFoundException; -import java.io.FileOutputStream; import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; import java.util.Locale; import javax.imageio.ImageIO; import javax.servlet.ServletException; import javax.servlet.annotation.MultipartConfig; import javax.servlet.annotation.WebServlet; -import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.Part; import org.apache.commons.lang.StringUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.t246osslab.easybuggy.core.utils.Closer; -import org.t246osslab.easybuggy.core.utils.HTTPResponseCreator; -import org.t246osslab.easybuggy.core.utils.MessageUtils; +import org.t246osslab.easybuggy.core.servlets.AbstractServlet; +import org.t246osslab.easybuggy.core.utils.MultiPartFileUtils; @SuppressWarnings("serial") @WebServlet(urlPatterns = { "/ureupload" }) // 2MB, 10MB, 50MB @MultipartConfig(fileSizeThreshold = 1024 * 1024 * 2, maxFileSize = 1024 * 1024 * 10, maxRequestSize = 1024 * 1024 * 50) -public class UnrestrictedExtensionUploadServlet extends HttpServlet { - - private static final Logger log = LoggerFactory.getLogger(UnrestrictedExtensionUploadServlet.class); +public class UnrestrictedExtensionUploadServlet extends AbstractServlet { // Name of the directory where uploaded files is saved private static final String SAVE_DIR = "uploadFiles"; @@ -43,20 +33,19 @@ protected void doGet(HttpServletRequest req, HttpServletResponse res) throws Ser StringBuilder bodyHtml = new StringBuilder(); bodyHtml.append("
"); - bodyHtml.append(MessageUtils.getMsg("msg.convert.grayscale", locale)); + bodyHtml.append(getMsg("msg.convert.grayscale", locale)); bodyHtml.append("

"); bodyHtml.append("
"); - bodyHtml.append(MessageUtils.getMsg("msg.select.upload.file", locale)); + bodyHtml.append(getMsg("msg.select.upload.file", locale)); bodyHtml.append("

"); - bodyHtml.append(""); + bodyHtml.append(""); bodyHtml.append("

"); if (req.getAttribute("errorMessage") != null) { bodyHtml.append(req.getAttribute("errorMessage")); } - bodyHtml.append(MessageUtils.getInfoMsg("msg.note.unrestrictedextupload", locale)); + bodyHtml.append(getInfoMsg("msg.note.unrestrictedextupload", locale)); bodyHtml.append("
"); - HTTPResponseCreator.createSimpleResponse(req, res, MessageUtils.getMsg("title.unrestrictedextupload.page", locale), - bodyHtml.toString()); + responseToClient(req, res, getMsg("title.unrestrictedextupload.page", locale), bodyHtml.toString()); } @Override @@ -75,21 +64,21 @@ protected void doPost(HttpServletRequest req, HttpServletResponse res) throws Se } // Save the file - Part filePart = null; + Part filePart; try { filePart = req.getPart("file"); } catch (Exception e) { - req.setAttribute("errorMessage", MessageUtils.getErrMsg("msg.max.file.size.exceed", locale)); + req.setAttribute("errorMessage", getErrMsg("msg.max.file.size.exceed", locale)); doGet(req, res); return; } try { - String fileName = getFileName(filePart); + String fileName = MultiPartFileUtils.getFileName(filePart); if (StringUtils.isBlank(fileName)) { doGet(req, res); return; } - boolean isConverted = writeFile(savePath, filePart, fileName); + boolean isConverted = MultiPartFileUtils.writeFile(filePart, savePath, fileName); if (!isConverted) { isConverted = convert2GrayScale(new File(savePath + File.separator + fileName).getAbsolutePath()); @@ -97,54 +86,22 @@ protected void doPost(HttpServletRequest req, HttpServletResponse res) throws Se StringBuilder bodyHtml = new StringBuilder(); if (isConverted) { - bodyHtml.append(MessageUtils.getMsg("msg.convert.grayscale.complete", locale)); + bodyHtml.append(getMsg("msg.convert.grayscale.complete", locale)); bodyHtml.append("

"); bodyHtml.append(""); bodyHtml.append("

"); } else { - bodyHtml.append(MessageUtils.getErrMsg("msg.convert.grayscale.fail", locale)); + bodyHtml.append(getErrMsg("msg.convert.grayscale.fail", locale)); } bodyHtml.append(""); - HTTPResponseCreator.createSimpleResponse(req, res, MessageUtils.getMsg("title.unrestrictedextupload.page", locale), - bodyHtml.toString()); + + getMsg("label.history.back", locale) + "\">"); + responseToClient(req, res, getMsg("title.unrestrictedextupload.page", locale), bodyHtml.toString()); } catch (Exception e) { log.error("Exception occurs: ", e); } } - private boolean writeFile(String savePath, Part filePart, String fileName) throws IOException { - boolean isConverted = false; - OutputStream out = null; - InputStream in = null; - try { - out = new FileOutputStream(savePath + File.separator + fileName); - in = filePart.getInputStream(); - int read = 0; - final byte[] bytes = new byte[1024]; - while ((read = in.read(bytes)) != -1) { - out.write(bytes, 0, read); - } - } catch (FileNotFoundException e) { - // Ignore because file already exists (converted and Windows locked the file) - isConverted = true; - } finally { - Closer.close(out, in); - } - return isConverted; - } - - // Get file name from content-disposition filename - private String getFileName(final Part part) { - for (String content : part.getHeader("content-disposition").split(";")) { - if (content.trim().startsWith("filename")) { - return content.substring(content.indexOf('=') + 1).trim().replace("\"", ""); - } - } - return null; - } - // Convert color image into gray scale image. private boolean convert2GrayScale(String fileName) throws IOException { boolean isConverted = false; diff --git a/src/main/java/org/t246osslab/easybuggy/vulnerabilities/UnrestrictedSizeUploadServlet.java b/src/main/java/org/t246osslab/easybuggy/vulnerabilities/UnrestrictedSizeUploadServlet.java index 04651405..86e423cb 100644 --- a/src/main/java/org/t246osslab/easybuggy/vulnerabilities/UnrestrictedSizeUploadServlet.java +++ b/src/main/java/org/t246osslab/easybuggy/vulnerabilities/UnrestrictedSizeUploadServlet.java @@ -3,11 +3,7 @@ import java.awt.image.BufferedImage; import java.awt.image.WritableRaster; import java.io.File; -import java.io.FileNotFoundException; -import java.io.FileOutputStream; import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; import java.util.Arrays; import java.util.Locale; @@ -15,49 +11,43 @@ import javax.servlet.ServletException; import javax.servlet.annotation.MultipartConfig; import javax.servlet.annotation.WebServlet; -import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.Part; import org.apache.commons.io.FilenameUtils; import org.apache.commons.lang.StringUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.t246osslab.easybuggy.core.utils.Closer; -import org.t246osslab.easybuggy.core.utils.HTTPResponseCreator; -import org.t246osslab.easybuggy.core.utils.MessageUtils; +import org.t246osslab.easybuggy.core.servlets.AbstractServlet; +import org.t246osslab.easybuggy.core.utils.MultiPartFileUtils; @SuppressWarnings("serial") @WebServlet(urlPatterns = { "/ursupload" }) @MultipartConfig -public class UnrestrictedSizeUploadServlet extends HttpServlet { - - private static final Logger log = LoggerFactory.getLogger(UnrestrictedSizeUploadServlet.class); +public class UnrestrictedSizeUploadServlet extends AbstractServlet { // Name of the directory where uploaded files is saved private static final String SAVE_DIR = "uploadFiles"; - @Override + + @Override protected void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { Locale locale = req.getLocale(); StringBuilder bodyHtml = new StringBuilder(); bodyHtml.append("
"); - bodyHtml.append(MessageUtils.getMsg("msg.reverse.color", locale)); + bodyHtml.append(getMsg("msg.reverse.color", locale)); bodyHtml.append("

"); bodyHtml.append("
"); - bodyHtml.append(MessageUtils.getMsg("msg.select.upload.file", locale)); + bodyHtml.append(getMsg("msg.select.upload.file", locale)); bodyHtml.append("

"); - bodyHtml.append(""); + bodyHtml.append(""); bodyHtml.append("

"); if (req.getAttribute("errorMessage") != null) { bodyHtml.append(req.getAttribute("errorMessage")); } - bodyHtml.append(MessageUtils.getInfoMsg("msg.note.unrestrictedsizeupload", locale)); + bodyHtml.append(getInfoMsg("msg.note.unrestrictedsizeupload", locale)); bodyHtml.append("
"); - HTTPResponseCreator.createSimpleResponse(req, res, MessageUtils.getMsg("title.unrestrictedsizeupload.page", locale), - bodyHtml.toString()); + responseToClient(req, res, getMsg("title.unrestrictedsizeupload.page", locale), bodyHtml.toString()); } @Override @@ -78,16 +68,16 @@ protected void doPost(HttpServletRequest req, HttpServletResponse res) throws Se try { // Save the file final Part filePart = req.getPart("file"); - String fileName = getFileName(filePart); + String fileName = MultiPartFileUtils.getFileName(filePart); if (StringUtils.isBlank(fileName)) { doGet(req, res); return; } else if (!isImageFile(fileName)) { - req.setAttribute("errorMessage", MessageUtils.getErrMsg("msg.not.image.file", locale)); + req.setAttribute("errorMessage", getErrMsg("msg.not.image.file", locale)); doGet(req, res); return; } - boolean isConverted = writeFile(savePath, filePart, fileName); + boolean isConverted = MultiPartFileUtils.writeFile(filePart, savePath, fileName); // Reverse the color of the upload image if (!isConverted) { @@ -96,59 +86,27 @@ protected void doPost(HttpServletRequest req, HttpServletResponse res) throws Se StringBuilder bodyHtml = new StringBuilder(); if (isConverted) { - bodyHtml.append(MessageUtils.getMsg("msg.reverse.color.complete", locale)); + bodyHtml.append(getMsg("msg.reverse.color.complete", locale)); bodyHtml.append("

"); bodyHtml.append(""); bodyHtml.append("

"); } else { - bodyHtml.append(MessageUtils.getErrMsg("msg.reverse.color.fail", locale)); + bodyHtml.append(getErrMsg("msg.reverse.color.fail", locale)); } bodyHtml.append(""); - HTTPResponseCreator.createSimpleResponse(req, res, MessageUtils.getMsg("title.unrestrictedsizeupload.page", locale), - bodyHtml.toString()); + + getMsg("label.history.back", locale) + "\">"); + responseToClient(req, res, getMsg("title.unrestrictedsizeupload.page", locale), bodyHtml.toString()); } catch (Exception e) { log.error("Exception occurs: ", e); } } - private boolean writeFile(String savePath, final Part filePart, String fileName) throws IOException { - boolean isConverted = false; - OutputStream out = null; - InputStream in = null; - try { - out = new FileOutputStream(savePath + File.separator + fileName); - in = filePart.getInputStream(); - int read = 0; - final byte[] bytes = new byte[1024]; - while ((read = in.read(bytes)) != -1) { - out.write(bytes, 0, read); - } - } catch (FileNotFoundException e) { - // Ignore because file already exists (converted) - isConverted = true; - } finally { - Closer.close(out, in); - } - return isConverted; - } - private boolean isImageFile(String fileName) { return Arrays.asList("png", "gif", "jpg", "jpeg", "tif", "tiff", "bmp").contains( FilenameUtils.getExtension(fileName)); } - // Get file name from content-disposition filename - private String getFileName(final Part part) { - for (String content : part.getHeader("content-disposition").split(";")) { - if (content.trim().startsWith("filename")) { - return content.substring(content.indexOf('=') + 1).trim().replace("\"", ""); - } - } - return null; - } - // Reverse the color of the image file private boolean reverseColor(String fileName) throws IOException { boolean isConverted = false; diff --git a/src/main/java/org/t246osslab/easybuggy/vulnerabilities/VerboseErrorMessageServlet.java b/src/main/java/org/t246osslab/easybuggy/vulnerabilities/VerboseErrorMessageServlet.java index 434b522f..4b513202 100644 --- a/src/main/java/org/t246osslab/easybuggy/vulnerabilities/VerboseErrorMessageServlet.java +++ b/src/main/java/org/t246osslab/easybuggy/vulnerabilities/VerboseErrorMessageServlet.java @@ -16,8 +16,6 @@ import org.apache.directory.shared.ldap.message.AliasDerefMode; import org.apache.directory.shared.ldap.name.LdapDN; import org.owasp.esapi.ESAPI; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import org.t246osslab.easybuggy.core.dao.EmbeddedADS; import org.t246osslab.easybuggy.core.model.User; import org.t246osslab.easybuggy.core.servlets.DefaultLoginServlet; @@ -26,8 +24,6 @@ @WebServlet(urlPatterns = { "/verbosemsg/login" }) public class VerboseErrorMessageServlet extends DefaultLoginServlet { - private static final Logger log = LoggerFactory.getLogger(VerboseErrorMessageServlet.class); - @Override public void doGet(HttpServletRequest req, HttpServletResponse res) throws IOException, ServletException { req.setAttribute("login.page.note", "msg.note.verbose.errror.message"); @@ -51,18 +47,8 @@ public void doPost(HttpServletRequest req, HttpServletResponse res) throws IOExc session.setAttribute("authNMsg", "msg.low.alphnum8"); doGet(req, res); } else if (authUser(userid, password)) { - /* Reset account lock */ - User admin = userLoginHistory.get(userid); - if (admin == null) { - User newAdmin = new User(); - newAdmin.setUserId(userid); - admin = userLoginHistory.putIfAbsent(userid, newAdmin); - if (admin == null) { - admin = newAdmin; - } - } - admin.setLoginFailedCount(0); - admin.setLastLoginFailedTime(null); + /* Reset account lock count */ + resetAccountLock(userid); session.setAttribute("authNMsg", "authenticated"); session.setAttribute("userid", userid); @@ -76,17 +62,7 @@ public void doPost(HttpServletRequest req, HttpServletResponse res) throws IOExc } } else { /* account lock count +1 */ - User admin = userLoginHistory.get(userid); - if (admin == null) { - User newAdmin = new User(); - newAdmin.setUserId(userid); - admin = userLoginHistory.putIfAbsent(userid, newAdmin); - if (admin == null) { - admin = newAdmin; - } - } - admin.setLoginFailedCount(admin.getLoginFailedCount() + 1); - admin.setLastLoginFailedTime(new Date()); + incrementAccountLockNum(userid); session.setAttribute("authNMsg", "msg.password.not.match"); doGet(req, res); @@ -95,10 +71,10 @@ public void doPost(HttpServletRequest req, HttpServletResponse res) throws IOExc private boolean isExistUser(String username) { - ExprNode filter = null; + ExprNode filter; EntryFilteringCursor cursor = null; try { - filter = FilterParser.parse("(uid=" + ESAPI.encoder().encodeForLDAP(username.trim()) + ")"); + filter = FilterParser.parse("(uid=" + encodeForLDAP(username.trim()) + ")"); cursor = EmbeddedADS.getAdminSession().search(new LdapDN("ou=people,dc=t246osslab,dc=org"), SearchScope.SUBTREE, filter, AliasDerefMode.NEVER_DEREF_ALIASES, null); if (cursor.available()) { diff --git a/src/main/java/org/t246osslab/easybuggy/vulnerabilities/XEEandXXEServlet.java b/src/main/java/org/t246osslab/easybuggy/vulnerabilities/XEEandXXEServlet.java index 1a8c2ffc..aca2ca09 100644 --- a/src/main/java/org/t246osslab/easybuggy/vulnerabilities/XEEandXXEServlet.java +++ b/src/main/java/org/t246osslab/easybuggy/vulnerabilities/XEEandXXEServlet.java @@ -1,11 +1,7 @@ package org.t246osslab.easybuggy.vulnerabilities; import java.io.File; -import java.io.FileNotFoundException; -import java.io.FileOutputStream; import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; @@ -15,7 +11,6 @@ import javax.servlet.ServletException; import javax.servlet.annotation.MultipartConfig; import javax.servlet.annotation.WebServlet; -import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.Part; @@ -26,13 +21,10 @@ import org.apache.commons.lang.RandomStringUtils; import org.apache.commons.lang.StringUtils; -import org.owasp.esapi.ESAPI; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import org.t246osslab.easybuggy.core.dao.DBClient; +import org.t246osslab.easybuggy.core.servlets.AbstractServlet; import org.t246osslab.easybuggy.core.utils.Closer; -import org.t246osslab.easybuggy.core.utils.HTTPResponseCreator; -import org.t246osslab.easybuggy.core.utils.MessageUtils; +import org.t246osslab.easybuggy.core.utils.MultiPartFileUtils; import org.xml.sax.Attributes; import org.xml.sax.SAXException; import org.xml.sax.helpers.DefaultHandler; @@ -41,9 +33,7 @@ @WebServlet(urlPatterns = { "/xee", "/xxe" }) // 2MB, 10MB, 50MB @MultipartConfig(fileSizeThreshold = 1024 * 1024 * 2, maxFileSize = 1024 * 1024 * 10, maxRequestSize = 1024 * 1024 * 50) -public class XEEandXXEServlet extends HttpServlet { - - private static final Logger log = LoggerFactory.getLogger(XEEandXXEServlet.class); +public class XEEandXXEServlet extends AbstractServlet { // Name of the directory where uploaded files is saved private static final String SAVE_DIR = "uploadFiles"; @@ -58,81 +48,73 @@ protected void doGet(HttpServletRequest req, HttpServletResponse res) throws Ser StringBuilder bodyHtml = new StringBuilder(); if ("/xee".equals(req.getServletPath())) { bodyHtml.append("
"); - bodyHtml.append(MessageUtils.getMsg("msg.add.users.by.xml", locale)); + bodyHtml.append(getMsg("msg.add.users.by.xml", locale)); } else { bodyHtml.append(""); - bodyHtml.append(MessageUtils.getMsg("msg.update.users.by.xml", locale)); + bodyHtml.append(getMsg("msg.update.users.by.xml", locale)); } bodyHtml.append("

"); bodyHtml.append("
");
-        bodyHtml.append(ESAPI.encoder().encodeForHTML("") + "
"); - bodyHtml.append(ESAPI.encoder().encodeForHTML("") + "
"); + bodyHtml.append(encodeForHTML("") + "
"); + bodyHtml.append(encodeForHTML("") + "
"); bodyHtml.append(TAB); - bodyHtml.append(ESAPI.encoder().encodeForHTML( - "")); + bodyHtml.append(encodeForHTML("")); bodyHtml.append("
"); bodyHtml.append(TAB); - bodyHtml.append(ESAPI.encoder().encodeForHTML( - "")); + bodyHtml.append(encodeForHTML("")); bodyHtml.append("
"); - bodyHtml.append(ESAPI.encoder().encodeForHTML("
")); + bodyHtml.append(encodeForHTML("
")); bodyHtml.append("
"); bodyHtml.append("
"); bodyHtml.append("
"); - bodyHtml.append(MessageUtils.getMsg("msg.select.upload.file", locale)); + bodyHtml.append(getMsg("msg.select.upload.file", locale)); bodyHtml.append("

"); - bodyHtml.append(""); + bodyHtml.append(""); bodyHtml.append("

"); if (req.getAttribute("errorMessage") != null) { bodyHtml.append(req.getAttribute("errorMessage")); } if ("/xee".equals(req.getServletPath())) { - bodyHtml.append(MessageUtils.getInfoMsg("msg.note.xee", locale)); + bodyHtml.append(getInfoMsg("msg.note.xee", locale)); bodyHtml.append("
");
-            bodyHtml.append(ESAPI.encoder().encodeForHTML("") + "
"); - bodyHtml.append(ESAPI.encoder().encodeForHTML(""); - bodyHtml.append(ESAPI.encoder().encodeForHTML("") + "
"); - bodyHtml.append(ESAPI.encoder().encodeForHTML("") + "
"); - bodyHtml.append(ESAPI.encoder().encodeForHTML("") + "
"); - bodyHtml.append(ESAPI.encoder().encodeForHTML("") + "
"); - bodyHtml.append(ESAPI.encoder().encodeForHTML("") + "
"); - bodyHtml.append(ESAPI.encoder().encodeForHTML("") + "
"); - bodyHtml.append(ESAPI.encoder().encodeForHTML("") + "
"); - bodyHtml.append(ESAPI.encoder().encodeForHTML("]>") + "
"); - bodyHtml.append(ESAPI.encoder().encodeForHTML("") - + "
"); - bodyHtml.append(TAB + ESAPI.encoder().encodeForHTML("") + "
"); - bodyHtml.append(TAB + ESAPI.encoder().encodeForHTML("
") + "
"); - bodyHtml.append(TAB + ESAPI.encoder().encodeForHTML("") + "
"); - bodyHtml.append(TAB + TAB + ESAPI.encoder().encodeForHTML("") + "
"); - bodyHtml.append(TAB + TAB + TAB + ESAPI.encoder().encodeForHTML("&x100;") + "
"); - bodyHtml.append(TAB + TAB + ESAPI.encoder().encodeForHTML("
") + "
"); - bodyHtml.append(TAB + ESAPI.encoder().encodeForHTML("
") + "
"); - bodyHtml.append(ESAPI.encoder().encodeForHTML("
") + "
"); + bodyHtml.append(encodeForHTML("") + "
"); + bodyHtml.append(encodeForHTML(""); + bodyHtml.append(encodeForHTML("") + "
"); + bodyHtml.append(encodeForHTML("") + "
"); + bodyHtml.append(encodeForHTML("") + "
"); + bodyHtml.append(encodeForHTML("") + "
"); + bodyHtml.append(encodeForHTML("") + "
"); + bodyHtml.append(encodeForHTML("") + "
"); + bodyHtml.append(encodeForHTML("") + "
"); + bodyHtml.append(encodeForHTML("]>") + "
"); + bodyHtml.append(encodeForHTML("")+ "
"); + bodyHtml.append(TAB + encodeForHTML("") + "
"); + bodyHtml.append(TAB + encodeForHTML("
") + "
"); + bodyHtml.append(TAB + encodeForHTML("") + "
"); + bodyHtml.append(TAB + TAB + encodeForHTML("") + "
"); + bodyHtml.append(TAB + TAB + TAB + encodeForHTML("&x100;") + "
"); + bodyHtml.append(TAB + TAB + encodeForHTML("
") + "
"); + bodyHtml.append(TAB + encodeForHTML("
") + "
"); + bodyHtml.append(encodeForHTML("
") + "
"); bodyHtml.append("
"); bodyHtml.append("
"); - HTTPResponseCreator.createSimpleResponse(req, res, MessageUtils.getMsg("title.xee.page", locale), - bodyHtml.toString()); + responseToClient(req, res, getMsg("title.xee.page", locale), bodyHtml.toString()); } else { - bodyHtml.append(MessageUtils.getInfoMsg("msg.note.xxe.step1", locale)); + bodyHtml.append(getInfoMsg("msg.note.xxe.step1", locale)); bodyHtml.append("
");
-            bodyHtml.append(ESAPI.encoder().encodeForHTML("") + "
"); - bodyHtml.append( - ESAPI.encoder().encodeForHTML("\">") + "
"); - bodyHtml.append(ESAPI.encoder().encodeForHTML("%p2;")); + bodyHtml.append(encodeForHTML("") + "
"); + bodyHtml.append(encodeForHTML("\">") + "
"); + bodyHtml.append(encodeForHTML("%p2;")); bodyHtml.append("
"); bodyHtml.append("
"); - bodyHtml.append(MessageUtils.getInfoMsg("msg.note.xxe.step2", locale)); + bodyHtml.append(getInfoMsg("msg.note.xxe.step2", locale)); bodyHtml.append("
");
-            bodyHtml.append(ESAPI.encoder().encodeForHTML("") + "
"); - bodyHtml.append( - ESAPI.encoder().encodeForHTML("") - + "
"); - bodyHtml.append(ESAPI.encoder().encodeForHTML("")); + bodyHtml.append(encodeForHTML("") + "
"); + bodyHtml.append(encodeForHTML("") + "
"); + bodyHtml.append(encodeForHTML("")); bodyHtml.append("
"); bodyHtml.append(""); - HTTPResponseCreator.createSimpleResponse(req, res, MessageUtils.getMsg("title.xxe.page", locale), - bodyHtml.toString()); + responseToClient(req, res, getMsg("title.xxe.page", locale), bodyHtml.toString()); } } @@ -156,21 +138,21 @@ protected void doPost(HttpServletRequest req, HttpServletResponse res) throws Se try { filePart = req.getPart("file"); } catch (Exception e) { - req.setAttribute("errorMessage", MessageUtils.getMsg("msg.max.file.size.exceed", locale)); + req.setAttribute("errorMessage", getMsg("msg.max.file.size.exceed", locale)); doGet(req, res); return; } try { - String fileName = getFileName(filePart); + String fileName = MultiPartFileUtils.getFileName(filePart); if (StringUtils.isBlank(fileName)) { doGet(req, res); return; } else if (!fileName.endsWith(".xml")) { - req.setAttribute("errorMessage", MessageUtils.getErrMsg("msg.not.xml.file", locale)); + req.setAttribute("errorMessage", getErrMsg("msg.not.xml.file", locale)); doGet(req, res); return; } - writeFile(savePath, filePart, fileName); + MultiPartFileUtils.writeFile(filePart, savePath, fileName); CustomHandler customHandler = new CustomHandler(); customHandler.setLocale(locale); @@ -179,27 +161,25 @@ protected void doPost(HttpServletRequest req, HttpServletResponse res) throws Se StringBuilder bodyHtml = new StringBuilder(); if (isRegistered && customHandler.isRegistered()) { if ("/xee".equals(req.getServletPath())) { - bodyHtml.append(MessageUtils.getMsg("msg.batch.registration.complete", locale)); + bodyHtml.append(getMsg("msg.batch.registration.complete", locale)); } else { - bodyHtml.append(MessageUtils.getMsg("msg.batch.update.complete", locale)); + bodyHtml.append(getMsg("msg.batch.update.complete", locale)); } bodyHtml.append("

"); } else { if ("/xee".equals(req.getServletPath())) { - bodyHtml.append(MessageUtils.getErrMsg("msg.batch.registration.fail", locale)); + bodyHtml.append(getErrMsg("msg.batch.registration.fail", locale)); } else { - bodyHtml.append(MessageUtils.getErrMsg("msg.batch.update.fail", locale)); + bodyHtml.append(getErrMsg("msg.batch.update.fail", locale)); } } bodyHtml.append(customHandler.getResult()); bodyHtml.append(""); + + getMsg("label.history.back", locale) + "\">"); if ("/xee".equals(req.getServletPath())) { - HTTPResponseCreator.createSimpleResponse(req, res, MessageUtils.getMsg("title.xee.page", locale), - bodyHtml.toString()); + responseToClient(req, res, getMsg("title.xee.page", locale), bodyHtml.toString()); } else { - HTTPResponseCreator.createSimpleResponse(req, res, MessageUtils.getMsg("title.xxe.page", locale), - bodyHtml.toString()); + responseToClient(req, res, getMsg("title.xxe.page", locale), bodyHtml.toString()); } } catch (Exception e) { log.error("Exception occurs: ", e); @@ -233,34 +213,6 @@ private boolean parseXML(HttpServletRequest req, String savePath, String fileNam return isRegistered; } - private void writeFile(String savePath, Part filePart, String fileName) throws IOException { - OutputStream out = null; - InputStream in = null; - try { - out = new FileOutputStream(savePath + File.separator + fileName); - in = filePart.getInputStream(); - int read = 0; - final byte[] bytes = new byte[1024]; - while ((read = in.read(bytes)) != -1) { - out.write(bytes, 0, read); - } - } catch (FileNotFoundException e) { - // Ignore because file already exists - } finally { - Closer.close(out, in); - } - } - - // Get file name from content-disposition filename - private String getFileName(final Part part) { - for (String content : part.getHeader("content-disposition").split(";")) { - if (content.trim().startsWith("filename")) { - return content.substring(content.indexOf('=') + 1).trim().replace("\"", ""); - } - } - return null; - } - public class CustomHandler extends DefaultHandler { private StringBuilder result = new StringBuilder(); private boolean isRegistered = false; @@ -275,21 +227,21 @@ public void startElement(String uri, String localName, String qName, Attributes isUsersExist = true; result.append(""); result.append(""); - result.append(""); - result.append(""); - result.append(""); - result.append(""); - result.append(""); + result.append(""); + result.append(""); + result.append(""); + result.append(""); + result.append(""); result.append(""); } else if (isUsersExist && "user".equals(qName)) { String executeResult = upsertUser(attributes, locale); result.append(""); - result.append(""); + result.append(""); if (executeResult == null) { - result.append(""); - result.append(""); - result.append(""); - result.append(""); + result.append(""); + result.append(""); + result.append(""); + result.append(""); } else { result.append(""); } @@ -321,7 +273,7 @@ boolean isRegistered() { return isRegistered; } - public String upsertUser(Attributes attributes, Locale locale) { + String upsertUser(Attributes attributes, Locale locale) { PreparedStatement stmt = null; PreparedStatement stmt2 = null; @@ -338,11 +290,11 @@ public String upsertUser(Attributes attributes, Locale locale) { rs = stmt.executeQuery(); if (rs.next()) { if (isInsert) { - return MessageUtils.getMsg("msg.user.already.exist", locale); + return getMsg("msg.user.already.exist", locale); } } else { if (!isInsert) { - return MessageUtils.getMsg("msg.user.not.exist", locale); + return getMsg("msg.user.not.exist", locale); } } if (isInsert) { @@ -355,7 +307,7 @@ public String upsertUser(Attributes attributes, Locale locale) { stmt2.setString(6, attributes.getValue("phone")); stmt2.setString(7, attributes.getValue("mail")); if (stmt2.executeUpdate() != 1) { - resultMessage = MessageUtils.getMsg("msg.user.already.exist", locale); + resultMessage = getMsg("msg.user.already.exist", locale); } } else { stmt2 = conn @@ -366,15 +318,15 @@ public String upsertUser(Attributes attributes, Locale locale) { stmt2.setString(4, attributes.getValue("mail")); stmt2.setString(5, attributes.getValue("uid")); if (stmt2.executeUpdate() != 1) { - resultMessage = MessageUtils.getMsg("msg.user.not.exist", locale); + resultMessage = getMsg("msg.user.not.exist", locale); } } } catch (SQLException e) { - resultMessage = MessageUtils.getMsg("msg.unknown.exception.occur", new String[] { e.getMessage() }, + resultMessage = getMsg("msg.unknown.exception.occur", new String[] { e.getMessage() }, locale); log.error("SQLException occurs: ", e); } catch (Exception e) { - resultMessage = MessageUtils.getMsg("msg.unknown.exception.occur", new String[] { e.getMessage() }, + resultMessage = getMsg("msg.unknown.exception.occur", new String[] { e.getMessage() }, locale); log.error("Exception occurs: ", e); } finally { diff --git a/src/main/java/org/t246osslab/easybuggy/vulnerabilities/XSSServlet.java b/src/main/java/org/t246osslab/easybuggy/vulnerabilities/XSSServlet.java index d55c7471..8ca3acfa 100644 --- a/src/main/java/org/t246osslab/easybuggy/vulnerabilities/XSSServlet.java +++ b/src/main/java/org/t246osslab/easybuggy/vulnerabilities/XSSServlet.java @@ -5,21 +5,15 @@ import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; -import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.commons.lang.StringUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.t246osslab.easybuggy.core.utils.HTTPResponseCreator; -import org.t246osslab.easybuggy.core.utils.MessageUtils; +import org.t246osslab.easybuggy.core.servlets.AbstractServlet; @SuppressWarnings("serial") @WebServlet(urlPatterns = { "/xss" }) -public class XSSServlet extends HttpServlet { - - private static final Logger log = LoggerFactory.getLogger(XSSServlet.class); +public class XSSServlet extends AbstractServlet { @Override protected void service(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { @@ -31,28 +25,27 @@ protected void service(HttpServletRequest req, HttpServletResponse res) throws S StringBuilder bodyHtml = new StringBuilder(); bodyHtml.append(""); - bodyHtml.append(MessageUtils.getMsg("description.reverse.string", locale)); + bodyHtml.append(getMsg("description.reverse.string", locale)); bodyHtml.append("

"); - bodyHtml.append(MessageUtils.getMsg("label.string", locale) + ": "); + bodyHtml.append(getMsg("label.string", locale) + ": "); bodyHtml.append(""); bodyHtml.append("

"); - bodyHtml.append(""); + bodyHtml.append(""); bodyHtml.append("

"); if (!StringUtils.isBlank(string)) { // Reverse the given string String reversedName = StringUtils.reverse(string); - bodyHtml.append(MessageUtils.getMsg("label.reversed.string", locale) + " : " + bodyHtml.append(getMsg("label.reversed.string", locale) + " : " + reversedName); } else { - bodyHtml.append(MessageUtils.getMsg("msg.enter.string", locale)); + bodyHtml.append(getMsg("msg.enter.string", locale)); } bodyHtml.append("

"); - bodyHtml.append(MessageUtils.getInfoMsg("msg.note.xss", locale)); + bodyHtml.append(getInfoMsg("msg.note.xss", locale)); bodyHtml.append(""); - HTTPResponseCreator.createSimpleResponse(req, res, MessageUtils.getMsg("title.xss.page", locale), - bodyHtml.toString()); + responseToClient(req, res, getMsg("title.xss.page", locale), bodyHtml.toString()); } catch (Exception e) { log.error("Exception occurs: ", e); diff --git a/src/main/resources/indexpage_en.properties b/src/main/resources/indexpage_en.properties index 1582eb77..8d495885 100644 --- a/src/main/resources/indexpage_en.properties +++ b/src/main/resources/indexpage_en.properties @@ -21,7 +21,7 @@ function.description.infinite.loop = Infinite loop occurs i function.description.int.overflow = Integer overflow can occur. function.description.jvm.crash.eav = JVM crashes if you click this link. function.description.ldap.injection = There is an LDAP injection vulnerability in this page. -function.description.loss.of.trailing.digits = Loss of trailing digits can occur. +function.description.loss.of.trailing.digits = Loss of trailing digits can occur. function.description.mail.header.injection = There is a mail header injection vulnerability in this page. function.description.memory.leak = Memory leak occurs in Java heap space every time you load this page. function.description.memory.leak2 = Memory leak occurs in {0} every time you load this page. diff --git a/src/main/webapp/dfi/includable.jsp b/src/main/webapp/dfi/includable.jsp index f2e99772..a5851183 100644 --- a/src/main/webapp/dfi/includable.jsp +++ b/src/main/webapp/dfi/includable.jsp @@ -11,7 +11,7 @@ <fmt:message key="title.design.test.page" /> - + " /> @@ -27,15 +27,15 @@ -
" + MessageUtils.getMsg("label.user.id", locale) + "" + MessageUtils.getMsg("label.name", locale) + "" + MessageUtils.getMsg("label.password", locale) + "" + MessageUtils.getMsg("label.phone", locale) + "" + MessageUtils.getMsg("label.mail", locale) + "" + getMsg("label.user.id", locale) + "" + getMsg("label.name", locale) + "" + getMsg("label.password", locale) + "" + getMsg("label.phone", locale) + "" + getMsg("label.mail", locale) + "
" + ESAPI.encoder().encodeForHTML(attributes.getValue("uid")) + "" + encodeForHTML(attributes.getValue("uid")) + "" + ESAPI.encoder().encodeForHTML(attributes.getValue("name")) + "" + ESAPI.encoder().encodeForHTML(attributes.getValue("password")) + "" + ESAPI.encoder().encodeForHTML(attributes.getValue("phone")) + "" + ESAPI.encoder().encodeForHTML(attributes.getValue("mail")) + "" + encodeForHTML(attributes.getValue("name")) + "" + encodeForHTML(attributes.getValue("password")) + "" + encodeForHTML(attributes.getValue("phone")) + "" + encodeForHTML(attributes.getValue("mail")) + "" + executeResult + "
+
-
+
- +
diff --git a/src/main/webapp/dt/includable.jsp b/src/main/webapp/dt/includable.jsp index 6c39d39b..ec87def9 100644 --- a/src/main/webapp/dt/includable.jsp +++ b/src/main/webapp/dt/includable.jsp @@ -11,7 +11,7 @@ <fmt:message key="title.design.test.page" /> - + @@ -23,11 +23,11 @@ - + -
+
IuJfZ2tcW1llDlfe_^Gmzq@$z5 z*4|#$%S&i_dYV^QII6l@5dJl{q2XRrQ&X89r=Ed9`}8!GoF;CPC80E$OTdzA9WOtB z$oRO<@3FBq_$@Uxwn0#RwwI%Brg)wzggz9UbKq z72%AHjjhg>{<-+y)19CXA36(DZ*FZ#`}>Q3H{gnhh$w4r#*aBjOm`pn^^2I349C~k z_vie4Jlym5@86|LCq8}siaj_u$i~AH*=8!`=JpVN2Ju`A3km=JxqK@wZrgH~Aw-i2 zf+we-rk1m^Vt%c_7!et{UG&I^=J%?qk9BpF4<9}>rNH<#yuPt9 zGB<~p+>2H@^%|be-NU2Jt_pF8Zfz_4V{akZ3b8{o%;NVEh$mlpY;Q##j zGu$A4a&Oq~uA{q`*Qe4_g8u&gRX1H-U9)mMQ(g+h{l9-tS!+~6$A>{AM`(i@*%2Hc zk1z1(k(skIp?U!csk|m`M-CkMqeqVr)(8xgBqJwZau&ui%OtZ+kC=0e9J7@?WW=;hK}974=YMf=AvNlrNR9YKt)?|Ih{LFy zQcWTU-`d>SkylZ{DMvFo74foo@#4tT-+e5DYvS1aN6Y$ z7M7N1U?w;tRC%8t<=`S}YHG%O9fvW+#ay^}cppE0M83YhCPYIHp=&iS2g6!eTdy0H zN`lV|W0p-hbY6U7OAxga%ozFoTW)qu2#+il9qt)?GKVe3RU~us?_aqmPcW;itLJ~% zV}r{NQJ|ut!aX7UP+s%*>M9d11}Y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lE& z$u}f0f!RrvmSk*vbj)kExqqGB#HsVfj5 z;M2Q;n zL7ieYLx!A>pbnqFHy9v5=SGJkL^mKWOlrsr6==;}h!As`{irx=R&y-G$#D=JzroD5 zzvCE`CC8u=QIVDOO$G=Mpnao56QUQ^7ia;|0Ze4}@jpZd@mU`se_I6aF$oah{f$mV zhyelw2v80x_D+=m0RjZ*=m-cgK!5-N3`G7vMmZszzhx7600000NkvXXu0mjfacsbG diff --git a/src/main/webapp/index.jsp b/src/main/webapp/index.jsp index 23527b9c..beee1614 100644 --- a/src/main/webapp/index.jsp +++ b/src/main/webapp/index.jsp @@ -1,7 +1,7 @@ <%@ page pageEncoding="UTF-8"%> <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> <%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%> -<%@ page import="org.t246osslab.easybuggy.core.utils.MessageUtils" %> +<%@ page import="java.util.ResourceBundle" %> @@ -9,11 +9,12 @@ <% session.removeAttribute("dlpinit"); - String permName = MessageUtils.getMsg("label.metaspace", request.getLocale()); + ResourceBundle rb = ResourceBundle.getBundle("messages", request.getLocale()); + String permName = rb.getString("label.metaspace"); String permNameInErrorMsg = permName; String javaVersion = System.getProperty("java.version"); if (javaVersion.startsWith("1.6") || javaVersion.startsWith("1.7")) { - permName = MessageUtils.getMsg("label.permgen.space", request.getLocale()); + permName = rb.getString("label.permgen.space"); permNameInErrorMsg = "PermGen space"; } String mode = System.getProperty("easybuggy.mode"); @@ -22,15 +23,19 @@ -EasyBuggy - - + EasyBuggy + + +
- +

@@ -214,26 +219,26 @@

  • - :

  • - :

  • - :

  • - : + :

  • - :

  • @@ -271,11 +276,6 @@ key="function.name.slow.unnecessary.object.creation" />:

    -

    diff --git a/src/main/webapp/uid/clientinfo.jsp b/src/main/webapp/uid/clientinfo.jsp index 12670eef..7879728e 100644 --- a/src/main/webapp/uid/clientinfo.jsp +++ b/src/main/webapp/uid/clientinfo.jsp @@ -11,7 +11,7 @@ <fmt:message key="title.clientinfo.page" /> - + @@ -23,11 +23,11 @@

    - + -
    +
    diff --git a/src/main/webapp/uid/serverinfo.jsp b/src/main/webapp/uid/serverinfo.jsp index 4b575b92..001eefed 100644 --- a/src/main/webapp/uid/serverinfo.jsp +++ b/src/main/webapp/uid/serverinfo.jsp @@ -11,7 +11,7 @@ <fmt:message key="title.serverinfo.page" /> - + @@ -24,11 +24,11 @@
    : <%=session.getAttribute("userid")%> -
    +
    -
    +
    <% request.setAttribute("systemProperties", java.lang.System.getProperties()); %>