[MGNLDAM-700] DamDownloadServlet returns HTTP 200 when an exception is thrown Created: 16/Mar/17  Updated: 30/Aug/17  Resolved: 21/Jul/17

Status: Closed
Project: Magnolia DAM Module
Component/s: DAM Core
Affects Version/s: 2.1.7
Fix Version/s: 2.2.6

Type: Bug Priority: Neutral
Reporter: Edwin Guilbert Assignee: AntonĂ­n Juran
Resolution: Fixed Votes: 0
Labels: support
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Magnolia 5.4.7
Oracle XE 11.2.0.2


Attachments: Text File DamDownloadServlet.patch     PNG File youtube200error.png    
Issue Links:
causality
relation
is related to MGNLDAM-679 Broken pipe when video is loaded Closed
Template:
Patch included:
Yes
Acceptance criteria:
Empty
Task DoD:
[ ]* Doc/release notes changes? Comment present?
[ ]* Downstream builds green?
[ ]* Solution information and context easily available?
[ ]* Tests
[ ]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Bug DoR:
[ ]* Steps to reproduce, expected, and actual results filled
[ ]* Affected version filled
Release notes required:
Yes
Date of First Response:
Sprint: Kromeriz 105
Story Points: 5

 Description   

DamDownloadServlet doesn't handle exceptions thrown within the doGet method:

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        try {
            process(request, response);
        } catch (Exception e) {
            log.error("error during download", e);
        }
    }

If anything wrong happens when processing of the dam download, the exception thrown is only logged. The servlet should handle the error either throwing a new exception or taking care of the response manually.

This affects cases like using a database for the repository (with a file system datastore) and deleting (or loosing connection in case of NFS) the datastore folder.

When accessing an image through the dam servlet:
http://localhost:8080/magnoliaAuthor/dam/jcr:5b9ee0d9-9ee2-4943-ba91-ff8240065fda/youtube.png
It will return HTTP 200 with an empty image. Screenshot attached.



 Comments   
Comment by Christian Ringele [ 16/Mar/17 ]

I added a patch.
I think it should return a 500 on it:

protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        try {
            process(request, response);
        } catch (RuntimeRepositoryException e) {
            response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
            log.error("error during download", e);
        } catch (Exception e) {
            log.error("error during download", e);
        }
    }
Generated at Mon Feb 12 05:02:24 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.