diff options
Diffstat (limited to 'juick-www/src/main/java/com/juick/www/NewMessage.java')
-rw-r--r-- | juick-www/src/main/java/com/juick/www/NewMessage.java | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/juick-www/src/main/java/com/juick/www/NewMessage.java b/juick-www/src/main/java/com/juick/www/NewMessage.java index dc1b25f7..397badbb 100644 --- a/juick-www/src/main/java/com/juick/www/NewMessage.java +++ b/juick-www/src/main/java/com/juick/www/NewMessage.java @@ -38,6 +38,8 @@ import java.net.URL; import java.net.URLEncoder; import java.util.ArrayList; import java.util.List; +import java.util.logging.Level; +import java.util.logging.Logger; /** * @@ -45,6 +47,8 @@ import java.util.List; */ public class NewMessage { + private static final Logger logger = Logger.getLogger(NewMessage.class.getName()); + protected void doGetNewMessage(JdbcTemplate sql, HttpServletRequest request, HttpServletResponse response, com.juick.User visitor) throws ServletException, IOException { response.setContentType("text/html; charset=UTF-8"); try (PrintWriter out = response.getWriter()) { @@ -159,7 +163,7 @@ public class NewMessage { try { attachmentFName = Utils.receiveMultiPartFile(request, "attach"); } catch (Exception e) { - System.out.println("MULTIPART ERROR: " + e.toString()); + logger.log(Level.SEVERE, "MULTIPART ERROR", e); response.sendError(400); return; } @@ -170,7 +174,7 @@ public class NewMessage { URL imgUrl = new URL(paramImg); attachmentFName = Utils.downloadImage(imgUrl); } catch (Exception e) { - System.out.println("DOWNLOAD ERROR: " + e.toString()); + logger.log(Level.SEVERE, "DOWNLOAD ERROR", e); response.sendError(500); return; } @@ -314,7 +318,7 @@ public class NewMessage { try { attachmentFName = Utils.receiveMultiPartFile(request, "attach"); } catch (Exception e) { - System.out.println("MULTIPART ERROR: " + e.toString()); + logger.log(Level.SEVERE, "MULTIPART ERROR", e); response.sendError(400); return; } @@ -324,7 +328,7 @@ public class NewMessage { try { attachmentFName = Utils.downloadImage(new URL(paramImg)); } catch (Exception e) { - System.out.println("DOWNLOAD ERROR: " + e.toString()); + logger.log(Level.SEVERE, "DOWNLOAD ERROR", e); response.sendError(500); return; } |