Skip to content

Commit

Permalink
sonar reviewed
Browse files Browse the repository at this point in the history
  • Loading branch information
kenu committed May 24, 2014
1 parent 4dfbd27 commit 67512dc
Show file tree
Hide file tree
Showing 30 changed files with 128 additions and 138 deletions.
3 changes: 3 additions & 0 deletions docs/okboard_deleted.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
select count(*) from okboard_deleted where wtime < '2014-05-17';

delete from okboard_deleted where wtime < '2014-05-17';
16 changes: 16 additions & 0 deletions sonar-project.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Required metadata
sonar.projectKey=okjsp:site
sonar.projectName=okjsp-site
sonar.projectVersion=1.0

# Path to the parent source code directory.
# Path is relative to the sonar-project.properties file. Replace "\" by "/" on Windows.
# Since SonarQube 4.2, this property is optional. If not set, SonarQube starts looking for source code
# from the directory containing the sonar-project.properties file.
sonar.sources=src

# Encoding of the source code
sonar.sourceEncoding=ms949

# Additional parameters
sonar.my.property=value
2 changes: 1 addition & 1 deletion src/main/java/kr/pe/okjsp/Article.java
Original file line number Diff line number Diff line change
Expand Up @@ -519,7 +519,7 @@ public long getSid() {
? 0
: Long.parseLong(this.id);
} catch (NumberFormatException e) {
e.printStackTrace();
System.out.println(e);
}
return sid;
}
Expand Down
24 changes: 11 additions & 13 deletions src/main/java/kr/pe/okjsp/ArticleDao.java
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,6 @@ public Article getArticle(int seq, String sql, Connection conn) throws SQLExcept
article.setCcl_id(rs.getString(18));
}

} catch (Exception e) {
e.printStackTrace();
} finally {
dbCon.close(null, pstmt, rs);
}
Expand Down Expand Up @@ -155,7 +153,7 @@ public int write(Connection conn, Article article) {
new PointDao().log(article.getSid(), 2, 10, String.valueOf(article.getSeq()));
}
} catch (SQLException e) {
e.printStackTrace();
System.out.println(e);
} finally {
dbCon.close(null, pstmt, rs);
}
Expand Down Expand Up @@ -339,7 +337,7 @@ public void addFile(Connection conn, int seq, ArrayList<DownFile> arrdf)
}
}
} catch (Exception e) {
e.printStackTrace();
System.out.println(e);
} finally {
dbCon.close(null, pstmt);
}
Expand All @@ -362,7 +360,7 @@ public void deleteFiles(Connection conn, String[] fseqs) {
pstmt.executeUpdate();
}
} catch (Exception e) {
e.printStackTrace();
System.out.println(e);
} finally {
dbCon.close(null, pstmt);
}
Expand Down Expand Up @@ -396,21 +394,21 @@ public int write(Article article) throws IOException {
try {
conn.rollback();
} catch (SQLException e1) {
e1.printStackTrace();
System.out.println(e1);
}
System.out.println("write err: "+e);
} catch (IOException e) {
try {
conn.rollback();
} catch (SQLException e1) {
e1.printStackTrace();
System.out.println(e1);
}
throw e;
} finally {
try {
conn.setAutoCommit(true);
} catch (SQLException e) {
e.printStackTrace();
System.out.println(e);
}
dbCon.close(conn, null);
}
Expand All @@ -435,7 +433,7 @@ public void checkSpam(Connection conn, String bbs, String sid) throws IOExceptio
}

} catch (SQLException e) {
e.printStackTrace();
System.out.println(e);
} finally {
dbCon.close(null, pstmt, rs);
}
Expand All @@ -460,7 +458,7 @@ public int[] getAdList() {
}

} catch (SQLException e) {
e.printStackTrace();
System.out.println(e);
} finally {
dbCon.close(conn, pstmt, rs);
}
Expand Down Expand Up @@ -509,17 +507,17 @@ public int delete(long seq) {
pstmt.setLong(1, seq);
result = pstmt.executeUpdate();
} catch (SQLException e) {
e.printStackTrace();
System.out.println(e);
} finally {
try {
pstmt.close();
} catch (SQLException e) {
e.printStackTrace();
System.out.println(e);
}
try {
conn.close();
} catch (SQLException e) {
e.printStackTrace();
System.out.println(e);
}
}
return result;
Expand Down
9 changes: 1 addition & 8 deletions src/main/java/kr/pe/okjsp/ControllerServlet.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,6 @@ public void init(ServletConfig config) throws ServletException {

public void doGet(HttpServletRequest req, HttpServletResponse res)
throws IOException {
String url = req.getRequestURL().toString() + "?"
+ req.getQueryString();
if (url.toLowerCase().contains("okjsp.pe.kr")) {
url = url.replaceAll("okjsp.pe.kr", "okjsp.net");
res.sendRedirect(url);
return;
}

String act = CommonUtil.nchk(req.getParameter("act"), "VIEW");
String resourceName = Navigation.getPath(act);
Expand Down Expand Up @@ -112,7 +105,7 @@ public void doGet(HttpServletRequest req, HttpServletResponse res)
try {
req.getRequestDispatcher(resourceName).forward(req, res);
} catch (Exception e) {
e.printStackTrace();
System.out.println(e);
}

} // end doGet()
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/kr/pe/okjsp/DeleteServlet.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public void doPost(HttpServletRequest req, HttpServletResponse res)
try {
seq = Integer.parseInt(req.getParameter("seq"));
} catch (Exception e) {
e.printStackTrace();
System.out.println(e);
}
/*
db 가져오기
Expand Down Expand Up @@ -92,7 +92,7 @@ public void doPost(HttpServletRequest req, HttpServletResponse res)
long sid = Long.parseLong(article.getId());
new PointDao().log(sid, 3, -50, String.valueOf(article.getSeq()));
} catch (Exception e) {
e.printStackTrace();
System.out.println(e);
}
} else {
resourceName = "/jsp/error.jsp";
Expand All @@ -116,7 +116,7 @@ private void doQuery(Connection conn, String query, int seq) throws SQLException
pstmt.setInt(1, seq);
pstmt.executeUpdate();
} catch (Exception e) {
e.printStackTrace();
System.out.println(e);
} finally {
dbCon.close(null, pstmt);
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/kr/pe/okjsp/DownloadServlet.java
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ private void countUp(String maskname) {
pstmt.executeUpdate();
pstmt.close();
} catch (Exception e) {
e.printStackTrace();
System.out.println(e);
} finally {
dbCon.close(conn, pstmt);
}
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/kr/pe/okjsp/MemoDao.java
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public int write(Connection conn, String id, long sid, String writer, String bco
new PointDao().log(sid, 2, 1, String.valueOf(mseq));
}
} catch (Exception e) {
e.printStackTrace();
System.out.println(e);
} finally {
dbCon.close(null, pstmt, rs);
}
Expand All @@ -96,10 +96,10 @@ public void setCount(Connection conn, int seq, int memocnt) throws SQLException
pstmt.executeUpdate();
pstmt.close();
} catch (Exception e) {
e.printStackTrace();
System.out.println(e);
} finally {
try { pstmt.close(); } catch (Exception e2) {
e2.printStackTrace();
System.out.println(e2);
}
}
}
Expand Down Expand Up @@ -140,7 +140,7 @@ public int getMemoCount(int seq) {
memocnt = rs.getInt(1);

} catch (Exception e) {
e.printStackTrace();
System.out.println(e);
} finally {
dbCon.close(conn, pstmt, rs);
}
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/kr/pe/okjsp/ModifyServlet.java
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,9 @@ public void doPost(HttpServletRequest req, HttpServletResponse res)

req.setAttribute("arrdf", arrdf);

} catch(Throwable t) {
req.setAttribute("javax.servlet.jsp.jspException", t);
System.out.println("ModifyServlet err:"+seq+"|"+t.toString());
} catch(Exception e) {
req.setAttribute("javax.servlet.jsp.jspException", e);
System.out.println("ModifyServlet err:"+seq+"|"+e.toString());
} finally {
dbCon.close(conn, pstmt, rs);
}
Expand All @@ -113,7 +113,7 @@ private String getEncryptedString(String confirmPassword, Connection conn) {
cryptedString = rs.getString(1);
}
} catch(Exception e) {
e.printStackTrace();
System.out.println(e);
} finally {
dbCon.close(null, pstmt, rs);
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/kr/pe/okjsp/PopBbsInfoMapServlet.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public void init() {
pstmt.close();
} catch(Exception e) {
System.out.println("can't populate bbsInfoMap due to : "+e.toString());
e.printStackTrace();
System.out.println(e);
} finally {
dbCon.close(conn, pstmt, rs);
} // end try catch
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/kr/pe/okjsp/ReplyServlet.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public void doGet(HttpServletRequest req, HttpServletResponse res)
int seq = 0;
try {
seq = Integer.parseInt(req.getParameter("seq"));
} catch(Exception e) { e.printStackTrace(); }
} catch(Exception e) { System.out.println(e); }
/*
db 가져오기
*/
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/kr/pe/okjsp/TagController.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ protected void doGet(HttpServletRequest req, HttpServletResponse res) throws Ser
tagseq = new TagHandler().findTagseqByTag(pathInfo.substring(1));
req.getRequestDispatcher("/jsp/taglist.jsp?tagseq="+tagseq).forward(req,res);
} catch (Exception e) {
e.printStackTrace();
System.out.println(e);
}
}
}
2 changes: 1 addition & 1 deletion src/main/java/kr/pe/okjsp/WriteServlet.java
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ private void setWriterCookie(String domain, HttpServletResponse res, Article art
CommonUtil.setCookie(domain, res, "sid", ""+article.getSid());
CommonUtil.setCookie(domain, res, "okhome", ""+article.getHomepage());
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
System.out.println(e);
}

}
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/kr/pe/okjsp/ad/AdLogDao.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public int log(AdLog log) {
result = pstmt.executeUpdate();

} catch (Exception e) {
e.printStackTrace();
System.out.println(e);
} finally {
dbCon.close(conn, pstmt);
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/kr/pe/okjsp/member/ArticleDao.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public List<Article> getArticleListBy(String sid) {
}

} catch (Exception e) {
e.printStackTrace();
System.out.println(e);
} finally {
dbCon.close(conn, pstmt, rs);
}
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/kr/pe/okjsp/member/MemberDao.java
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public int validateParams(String email, String token) {
pstmt.close();
rs.close();
} catch (SQLException e) {
e.printStackTrace();
System.out.println(e);
}
return count;
}
Expand All @@ -85,7 +85,7 @@ public boolean checkBySid(long sid) {
"select count(*) from okmember where sid = ?",
new Object[] { sid });
} catch (SQLException e) {
e.printStackTrace();
System.out.println(e);
}

return result == 1;
Expand Down
7 changes: 3 additions & 4 deletions src/main/java/kr/pe/okjsp/member/MemberService.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ public String[] sendRecoverPassword(String email) {
success = "true";
message = email + "로 메일을 발송했습니다.";
} catch (Exception e) {
e.printStackTrace();
System.out.println(e.toString() + "\nfailed: " + email);
success = "false";
message = email + "로 발송하지 못했습니다.";
Expand Down Expand Up @@ -63,7 +62,7 @@ public int changePassword(String email, String password,
try {
result = dao.setPasswordByEmail(email, password);
} catch (SQLException e) {
e.printStackTrace();
System.out.println(e);
}
return result;
}
Expand All @@ -84,7 +83,7 @@ public int changePassword(String email, String password,
result = dao.setTokenUsed(token);
}
} catch (SQLException e) {
e.printStackTrace();
System.out.println(e);
}
return result;
}
Expand All @@ -95,7 +94,7 @@ private boolean isMemberEmail(String email) {
try {
emailExist = handler.isEmailExist(email);
} catch (SQLException e) {
e.printStackTrace();
System.out.println(e);
}
return emailExist;
}
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/kr/pe/okjsp/member/PointDao.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public int log(long sid, int code, int point, String info) {

addPoint(conn, sid, point);
} catch (Exception e) {
e.printStackTrace();
System.out.println(e);
} finally {
dbCon.close(conn, pstmt);
}
Expand Down Expand Up @@ -150,7 +150,7 @@ public int deletePoint(long sid) {
result = pstmt.executeUpdate();

} catch (Exception e) {
e.printStackTrace();
System.out.println(e);
} finally {
dbCon.close(conn, pstmt);
}
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/kr/pe/okjsp/member/ProfileUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ public int copyDefaultProfile(String contextRoot, long sid) {
try {
result = 1 - copy(sourcePath, destPath);
} catch (IOException e) {
e.printStackTrace();
System.out.println(e);
} catch (InterruptedException e) {
e.printStackTrace();
System.out.println(e);
}
return result;
}
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/kr/pe/okjsp/mobile/MobileDeleteServlet.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public void doPost(HttpServletRequest req, HttpServletResponse res)
try {
seq = Integer.parseInt(req.getParameter("seq"));
} catch (Exception e) {
e.printStackTrace();
System.out.println(e);
}
/*
db 가져오기
Expand Down Expand Up @@ -121,7 +121,7 @@ private void doQuery(Connection conn, String query, int seq) throws SQLException
pstmt.setInt(1, seq);
pstmt.executeUpdate();
} catch (Exception e) {
e.printStackTrace();
System.out.println(e);
} finally {
dbCon.close(null, pstmt);
}
Expand Down
Loading

0 comments on commit 67512dc

Please sign in to comment.