Run the application, then:
- Add a "Paper" with some name.
- Add a second Paper with some other name and an attached TXT file.
- List the Papers and open the one without a file; it won't show you a download link, which is correct.
- Open the second Paper, and there also won't be a download link, which is incorrect.
After a little bit of debugging, I pinpointed the cause. The method PaperBean.getViewPanelGrid caches an HtmlPanelGrid object. Line 242 of PaperBean.populateViewPanel checks whether the attached file exists, and if not, creates a PanelGrid without a download link. That's correct for the first object, since it didn't have an attached file, but the second time, it just uses the cached HtmlPanelGrid that doesn't have a download link.