对于部署在Heroku上的基于Play Framework 1.2的Java应用程序,文件下载似乎不起作用

时间:2012-05-09 01:38:41

标签: heroku playframework playframework-1.x

我在heroku上使用ClearDB MySQL,而不是默认情况下给出的Postgres。我的代码在我的本地机器上完美运行。这是我的下载文件方法:

public static void downloadFile(long id) throws Exception {

final Article doc = Article.findById(id);
        notFoundIfNull(doc);

    User current_user = User.find("byEmail", Security.connected()).first();

    if(!current_user.equals(doc.author)){
        SelectedArticles selectedArticle = SelectedArticles.find("byArticleAndReviewer", doc, current_user).first();
        if(selectedArticle == null)
        {
             SelectedArticles newSelected = new SelectedArticles(current_user, doc);
             newSelected.save();
             selectedArticle = newSelected;
        }
        selectedArticle.download();
    }

    response.setContentTypeIfNotSet(doc.article_pdf.type());
    renderBinary(doc.article_pdf.get(), doc.pdfName);
}

这是我在Heroku日志中看到的:

←[36m2012-05-09T01:29:41+00:00 app[web.1]:←[0m Caused by: java.lang.NullPointerE
xception
←[36m2012-05-09T01:29:41+00:00 app[web.1]:←[0m  ... 2 more
←[36m2012-05-09T01:29:41+00:00 app[web.1]:←[0m  at play.mvc.results.RenderBinary
.apply(RenderBinary.java:167)

0 个答案:

没有答案