Skip to content

Commit

Permalink
Fix the work around issue #9
Browse files Browse the repository at this point in the history
  • Loading branch information
k-tamura committed Mar 3, 2017
1 parent cbe9dff commit bfb1b8b
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ protected void doPost(HttpServletRequest req, HttpServletResponse res) throws Se
doGet(req, res);
}
// TODO Remove this try block that is a workaround of issue #9 (FileNotFoundException on Jetty * Windows)
boolean isConverted = false;
try {
out = new FileOutputStream(savePath + File.separator + fileName);
in = filePart.getInputStream();
Expand All @@ -91,16 +92,18 @@ protected void doPost(HttpServletRequest req, HttpServletResponse res) throws Se
}
} catch (FileNotFoundException e) {
// Ignore because file already exists
isConverted = true;
}

boolean isConverted = true;
try {
// Reverse the color of the upload image
revereColor(new File(savePath + File.separator + fileName).getAbsolutePath());
if(!isConverted){
revereColor(new File(savePath + File.separator + fileName).getAbsolutePath());
isConverted = true;
}
} catch (Exception e) {
// Log and ignore the exception
log.warn("Exception occurs: ", e);
isConverted = false;
}

StringBuilder bodyHtml = new StringBuilder();
Expand Down

0 comments on commit bfb1b8b

Please sign in to comment.