return;
}
Objectify ofy = ObjectifyService.factory().begin();
BasicErrorInfo basicInfo = ofy.load().type(BasicErrorInfo.class).filter("REPORT_ID", request.getParameter("REPORT_ID")).first().now();
if (basicInfo == null)
{
String PACKAGE_NAME = request.getParameter("PACKAGE_NAME");
// get package.
log.warning("PACKAGE = " + PACKAGE_NAME);
AppPackage appPackage = ofy.load().type(AppPackage.class).filter("PACKAGE_NAME", PACKAGE_NAME).first().now();
if (appPackage == null)
{
// System.out.println("package unknown " + PACKAGE_NAME);
log.severe("package unknown " + PACKAGE_NAME);
response.sendError(HttpServletResponse.SC_FORBIDDEN);
// response.getWriter().println("FAIL PACKAGE UNKNOWN");
return;
}
if(!appPackage.enabled)
{
// System.out.println("package disabled " + PACKAGE_NAME);
log.severe("package disabled " + PACKAGE_NAME);
response.sendError(HttpServletResponse.SC_FORBIDDEN);
return;
}
ACRALog acraLog = populateACRA(request);
String auth = request.getHeader("Authorization");
if (Utils.isEmpty(auth))
{
response.getWriter().println("FAIL AUTH");
log.severe("Authentication Failed " + acraLog.PACKAGE_NAME);
return;
}
auth = auth.replace("Basic ", "").trim();
if (!auth.equals(appPackage.AuthString))
{
response.getWriter().println("FAIL AUTH");
log.severe("Authentication Failed " + acraLog.PACKAGE_NAME);
return;
}
// get user for package.
AppUser appUser = ofy.load().type(AppUser.class).id(appPackage.Owner).now();
if (appUser == null)
{
response.getWriter().println("FAIL USER UNKNOWN");
log.severe("User not found " + acraLog.PACKAGE_NAME);
response.sendError(HttpServletResponse.SC_FORBIDDEN);
return;
}
if (appUser.isUser && !appUser.isSubscriptionPaid)
{
response.getWriter().println("FAIL SUBSCRIPTION NOT PAID");
log.severe("subscription unpaid " + appUser.EMailAddress + " - " + acraLog.PACKAGE_NAME);
response.sendError(HttpServletResponse.SC_FORBIDDEN);
return;
}
acraLog.Owner = appUser.id;
basicInfo = new BasicErrorInfo();
basicInfo.Owner = appUser.id;
basicInfo.ANDROID_VERSION = acraLog.ANDROID_VERSION;
basicInfo.APP_VERSION_NAME = acraLog.APP_VERSION_NAME;
basicInfo.PACKAGE_NAME = acraLog.PACKAGE_NAME;
basicInfo.REPORT_ID = acraLog.REPORT_ID;